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

Python utils.get_files函数代码示例

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

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



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

示例1: __init__

    def __init__(self, name=None):
	self.img = img
        self.path = SRC_PATH
        self.mv_path = MOVE_PATH
        self.notime_path = NOTIME_PATH
        self.files = get_files(self.path, name)
        self.dics = self.to_dic(self.files)
开发者ID:kevin89126,项目名称:picture_manager,代码行数:7,代码来源:pic.py


示例2: get

 def get(self):
     try:
         num = int(self.get_argument('num'))
         files = utils.get_files(settings.PICDIR, num)
         self.write(json.dumps(files))
     except Exception as e:
         self.write(json.dumps(None))
开发者ID:marcellmars,项目名称:letssharebooks,代码行数:7,代码来源:serv.py


示例3: main

def main(argv):
    model_file_path = os.path.join(FLAGS.vgg_model, vgg19.MODEL_FILE_NAME)
    vgg_net = vgg19.VGG19(model_file_path)
    content_images = utils.get_files(FLAGS.train)
    style_image = utils.load_image(FLAGS.style)

    # create a map for content layers info
    CONTENT_LAYERS = {}
    for layer, weight in zip(CONTENT_LAYERS_NAME, CONTENT_LAYER_WEIGHTS):
        CONTENT_LAYERS[layer] = weight

    # create a map for style layers info
    STYLE_LAYERS = {}
    for layer, weight in zip(STYLE_LAYERS_NAME, STYLE_LAYER_WEIGHTS):
        STYLE_LAYERS[layer] = weight

    with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess:
        trainer = style_transfer_trainer.StyleTransferTrainer(
            session=sess,
            content_layer_ids=CONTENT_LAYERS,
            style_layer_ids=STYLE_LAYERS,
            content_images=content_images,
            style_image=add_one_dim(style_image),
            net=vgg_net,
            num_epochs=FLAGS.num_epochs,
            batch_size=FLAGS.batch_size,
            content_weight=FLAGS.content_weight,
            style_weight=FLAGS.style_weight,
            tv_weight=FLAGS.tv_weight,
            learn_rate=FLAGS.learn_rate,
            save_path=FLAGS.output,
            check_period=FLAGS.checkpoint_every,
            max_size=FLAGS.max_size or None)

        trainer.train()
开发者ID:yaoyaowd,项目名称:tensorflow_demo,代码行数:35,代码来源:run_train.py


示例4: on_query_completions

	def on_query_completions(self, view, prefix, locations):
		window=sublime.active_window()
		view=window.active_view()
		self.clases=set()
		lang=utils.get_language()
		if lang=="html" or lang=="php":
			punto=view.sel()[0].a
			linea=view.substr(sublime.Region(view.line(punto).a, punto)).replace('"', "'")
			linea=linea[:linea.rfind("'")].strip()
			print("la linea es :"+linea)
			if linea.endswith("class="):
				print("en compass")
				cssFiles=utils.get_files({"ext":"css"})
				self.clases=[]
				for cssFile in cssFiles:
					texto=open(cssFile).read()
					cssClases=re.findall("\.(?P<clase>[a-z][-\w]*)\s+", texto)
					self.clases=self.clases + cssClases
				self.clases=list(set(self.clases))
				self.clases=[[clase + "\t(CSS)", clase] for clase in self.clases]

				return list(self.clases)

			linea=view.substr(sublime.Region(view.line(punto).a, punto)).replace('"', "'").strip()
			if linea.endswith("src='") and linea.startswith("<script"):
				path=view.file_name()
				path=path[:path.rfind("/")] if path.find("/")!=-1 else path[:path.rfind("\\")]
				RecursosHtml(path, "js").insertar()
			elif linea.endswith("href='") and linea.startswith("<link "):
				path=view.file_name()
				path=path[:path.rfind("/")] if path.find("/")!=-1 else path[:path.rfind("\\")]
				RecursosHtml(path, "css").insertar()
开发者ID:programadorsito,项目名称:Packages,代码行数:32,代码来源:html5.py


示例5: upload

def upload(directory):
    """Upload a directory to S3.

    DIRECTORY: Directory to upload. Required.
    """
    if not AWS_BUCKET:
        utils.error('AWS_BUCKET environment variable not set. Exiting.')
        return

    conn = S3Connection()
    bucket = get_or_create_bucket(conn, AWS_BUCKET)

    files = list(utils.get_files(directory))
    total_size = 0

    utils.info('Found', len(files), 'files to upload to s3://' + AWS_BUCKET)

    for path in files:
        filesize = os.path.getsize(path)
        total_size += filesize

        utils.info('Uploading', path, '-', sizeof_fmt(filesize))

        k = Key(bucket)
        k.key = path
        k.set_contents_from_filename(path)

    utils.success('Done. Uploaded', sizeof_fmt(total_size))
开发者ID:nathancahill,项目名称:Processing,代码行数:28,代码来源:upload.py


示例6: restore_all

def restore_all(password_file=None):
    for file_ in get_files(ATK_VAULT):
        if os.path.basename(file_) == 'encrypted':

            # Get the path without the atk vault base and encrypted filename
            original_path = os.path.join(*split_path(file_)[1:-1])
            restore(original_path, password_file)
开发者ID:bsacks99,项目名称:ansible-toolkit,代码行数:7,代码来源:vault.py


示例7: _get_all_config_files

    def _get_all_config_files(self):
        """

        :return:[(<absolute_path>, <relative_path>), ..]

        """
        return utils.get_files(self.absolute_path_of_patch, self.filter)
开发者ID:kevin-zhangsen,项目名称:badam,代码行数:7,代码来源:engineering_factory.py


示例8: eval_predictor

def eval_predictor(func_predict, target_dir=PATH_VAL_IMAGES,
                   batch_size=32, item_handler=default_handler):
    print('Start eval predictor...')
    results = []
    return_array = Flag()
    images = utils.get_files(target_dir)
    n_images = len(images)
    n_batch = n_images // batch_size
    n_last_batch = n_images % batch_size

    def predict_batch(start, end):
        predictions = func_predict(images[start: end])
        if not utils.is_multi_predictions(predictions):
            predictions = [predictions]
            return_array.value = False
        if len(results) == 0:
            for i in range(len(predictions)):
                results.append([])
        else:
            assert len(results) == len(predictions), 'The predictions length is not equal with last time\'s.'
        image_ids = [os.path.basename(image) for image in images[start: end]]
        for index, prediction in enumerate(predictions):
            results[index].extend([item_handler(image_ids[i], prediction[i]) for i in range(end - start)])
            sys.stdout.write('\rProcessing %d/%d' % (end, n_images))
            sys.stdout.flush()

    for batch in range(n_batch):
        index = batch * batch_size
        predict_batch(index, index + batch_size)
    if n_last_batch:
        index = n_batch * batch_size
        predict_batch(index, index + n_last_batch)
    sys.stdout.write('\n')
    return results if return_array.value else results[0], return_array.value
开发者ID:qiHuang112,项目名称:SceneClassify,代码行数:34,代码来源:eval.py


示例9: run

	def run(self, edit):
		print("va a importar")
		window=sublime.active_window()
		view=window.active_view()
		self.window=sublime.active_window()
		self.view=self.window.active_view()
		java=Java()
		tipos=java.get_tipos()
		self.packages=utils.load_json(PATH_INDEX_PACKAGES)
		projectFiles=utils.get_files({"ext":"java"})
		projectFiles=[x.replace("/", ".").replace("\\", ".") for x in projectFiles]
		projectFiles=[x[x.rfind(".java.")+6:x.rfind(".")] for x in projectFiles]
		
		##print(projectFiles)
		viewPackage=view.substr(view.find(utils.REG_JAVA_PACKAGE, 0))
		viewPackage=viewPackage.replace("package ", "").replace(";", "")

		for projectFile in projectFiles:
			className=projectFile[projectFile.rfind(".")+1:]
			packageClass=projectFile[:projectFile.rfind(".")]
			if packageClass==viewPackage:continue
			if self.packages.get(className)==None:
				self.packages[className]=[]
			self.packages[className].append(packageClass)
		
		self.clases=list(set(tipos))
		##print(self.clases)
		self.i=0
		self.importar(None)
开发者ID:programadorsito,项目名称:Packages,代码行数:29,代码来源:java.py


示例10: _download_module

    def _download_module(self, module_url):
        request = self.request
        session = request.session
        conn = sword2cnx.Connection(session['login'].service_document_url,
                                    user_name=session['login'].username,
                                    user_pass=session['login'].password,
                                    always_authenticate=True,
                                    download_service_document=False)

        parts = urlparse.urlsplit(module_url)
        path = parts.path.split('/')
        path = path[:path.index('sword')]
        module_url = '%s://%s%s' % (parts.scheme, parts.netloc, '/'.join(path))

        # example: http://cnx.org/Members/user001/m17222/sword/editmedia
        zip_file = conn.get_cnx_module(module_url = module_url,
                                       packaging = 'zip')
         
        save_dir = get_save_dir(request)
        if save_dir is None:
            request.session['upload_dir'], save_dir = create_save_dir(request)
        extract_to_save_dir(zip_file, save_dir)

        cnxml_file = open(os.path.join(save_dir, 'index.cnxml'), 'rb')
        cnxml = cnxml_file.read()
        cnxml_file.close()
        conversionerror = None
        try:
            htmlpreview = cnxml_to_htmlpreview(cnxml)
            save_and_backup_file(save_dir, 'index.html', htmlpreview)
            files = get_files(save_dir)
            save_zip(save_dir, cnxml, htmlpreview, files)
        except libxml2.parserError:
            conversionerror = traceback.format_exc()
            raise ConversionError(conversionerror)
开发者ID:saketkc,项目名称:oerpub.remix,代码行数:35,代码来源:module_association.py


示例11: run

    def run(self, edit):
        paquete_snippets=sublime.packages_path()+os.sep+"snippets"
        lista=[]
        comandos=[]
        for archivo in utils.get_files({"folder":paquete_snippets, "ext":"json"}):
            snip=utils.load_json(archivo)
            lista=lista + list(snip.keys())
        lista=list(set(lista))
        for snippet in lista:
            snippet=snippet.lower().replace("-", "_").replace("(", "").replace(")", "").replace(" ", "").replace("?", "").replace(":", "")
            utils.file_write(RUTA_COMANDOS+"code_"+snippet+".bat", "echo code_"+snippet+" > d:/sublime3/comando.txt")
            comandos.append("code_"+snippet)
        archivos_plantillas=utils.get_files({"folder":RUTA_PLANTILLAS})
        for plantilla in archivos_plantillas:
            plantilla=os.path.basename(plantilla)
            if plantilla.rfind(".")!=-1:plantilla=plantilla[:plantilla.rfind(".")]
            plantilla=plantilla.replace(" ", "_").lower()
            utils.file_write(RUTA_COMANDOS+"make_"+plantilla+".bat", "echo make_"+plantilla+" > d:/sublime3/comando.txt")
            comandos.append("make_"+plantilla)
        archivos_python=utils.get_files({"folder":sublime.packages_path(), "ext":".py"})
        for programa in archivos_python:
            rutaPrograma=programa
            try:programa=utils.file_read(programa)
            except:
                print("saco error al leer : "+rutaPrograma)
                continue
            comandosPython=re.findall("class ([\w]+)\(sublime_plugin.TextCommand\)",programa, re.IGNORECASE)
            for comandoPython in comandosPython:
                comandoPython=comandoPython[0].lower()+comandoPython[1:]
                cp=""
                for c in comandoPython:
                    if c.isupper():cp+="_"
                    cp+=c.lower()
                if cp.endswith("_command"):cp=cp.replace("_command", "")
                comandos.append(cp)
        comandosInternos=utils.file_read("D:/sublime3/Data/Packages/User/Default (Windows).sublime-keymap")
        comandosInternos=re.findall('"command": *"(\w+)" *\}', comandosInternos, re.IGNORECASE)
        for comandoInterno in comandosInternos:comandos.append(comandoInterno)
        comandos=sorted(list(set(comandos)))
        strComandos=""
        for comando in comandos:strComandos+=comando+"\n"

        window=sublime.active_window()
        view=window.active_view()
        utils.file_write("d:/sublime3/comandos.txt", strComandos)
        view.run_command("ejecutar_comando", {"comando":"taskkill /f /im CustomizeableJarvis.exe\njarvis\nexit"})
        
开发者ID:programadorsito,项目名称:Packages,代码行数:46,代码来源:prepare_commands.py


示例12: process_nga_artists

def process_nga_artists():
    # print "process_nga_artists"
    nga_reconciled_artists = get_files()["nga-artists-dbpedia"]

    with open(nga_reconciled_artists, 'rb') as ngafile:
        csv_reader = csv.reader(ngafile)
        for row in csv_reader:
            try:
                # If we hit a duplicate artist, select the one with
                # url which is not foaf:Person
                artists[row[0]]
                url = artists[row[0]][1]
                if "Person" not in url:
                    artists[row[0]] = (row[0], url, "nga")
                else:
                    url = get_resource_url(row)
                    if "dbpedia" in url:
                        artists[row[0]] = (row[0], url, "nga")
            except KeyError:
                # Open Refine rule bug consequence :
                # Applicable to only nga artists
                # Process the row to see if there is a dbpedia link
                artists[row[0]] = (row[0], get_resource_url(row), "nga")
    ngafile.close()

    with open('nga-artists-dbpedia-info.csv', 'a') as opfile:
        csvwriter = csv.writer(opfile, delimiter=',', quotechar='"',
                               quoting=csv.QUOTE_ALL)
        csvwriter.writerow(["Name", "Url", "Source", "Birth Date",
                            "Death Date", "Short description",
                            "Long description", "Movement"])
        processed = 0
        for artist, info in artists.items():
            if artist not in already_artists:
                if "dbpedia" in info[1]:
                    result = get_info_from_dbpedia(info[1])
                    # print result
                else:
                    result = get_info_from_nga(artist)
                artist = convert(artist)
                name = artist
                url = info[1]
                source = "nga"
                birth_date = result["birth_date"]
                birth_date = convert(birth_date)
                death_date = result["death_date"]
                death_date = convert(death_date)
                short_descr = result["short_descr"]
                short_descr = convert(short_descr)
                long_descr = result["long_descr"]
                long_descr = convert(long_descr)
                movement = result["movement"]
                movement = convert(movement)
                csvwriter.writerow([name, url, source, birth_date,
                                    death_date, short_descr,
                                    long_descr, movement])
                processed += 1
                print processed
    opfile.close()
开发者ID:warunsl,项目名称:Provenir,代码行数:59,代码来源:get-dbpedia-info.py


示例13: read_action

def read_action(action_path):
    action_name=get_action_name(action_path)
    category=get_category(action_name)
    person=get_person(action_name)
    all_files=utils.get_files(action_path)
    all_files=utils.append_path(action_path+"/",all_files)
    frames=utils.read_images(all_files)
    return Action(category,person,frames)
开发者ID:tjacek,项目名称:conv_frames,代码行数:8,代码来源:actions.py


示例14: clean_dir

def clean_dir(base_directory):
    print('Cleaning all of the files in "%s".' % base_directory)
    files = get_files(base_directory)
    for f in files:
        file_name = '%s/%s' % (base_directory, f)
        print('Deleting file "%s".' % file_name)
        delete_file(file_name)
    print('Deleted %d file%s.' % (len(files), 's' if len(files) > 1 else ''))
开发者ID:deltafront,项目名称:speedtest_scripts,代码行数:8,代码来源:cleanup_utils.py


示例15: get_polarity_of_modified_files

def get_polarity_of_modified_files(path):
    reload(sys)
    list_of_files = utils.get_files(path)
    for f1 in list_of_files:
        #print f1
        key = f1
        value = utils.convert_doc(path+"/"+f1)
        dictonary_modified[key] = value
开发者ID:geek-manish,项目名称:ML_Work,代码行数:8,代码来源:Polarity.py


示例16: read_img_action

def read_img_action(path):
    raw_names=utils.get_files(path+"xy/")
    names_size=len(raw_names)
    names=["act"+str(i)+".png" for i in range(names_size)]
    names=[utils.get_name(frame_path) for frame_path in names]
    print(names)
    new_proj=[read_projection_frame(path,name) for name in names]
    return ProjectionAction(new_proj)
开发者ID:tjacek,项目名称:deep_shape_context,代码行数:8,代码来源:projections.py


示例17: run

 def run(self, edit, **args):    
     if not args.get("folder"):return
     self.folder=args.get("folder")
     self.resources_folder=os.path.normpath(sublime.packages_path()+os.sep+".."+os.sep+"recursos")
     self.files=utils.get_files({"folder":self.resources_folder})
     self.nombres=[[os.path.basename(x), os.path.basename(os.path.dirname(x))] for x in self.files]
     window=sublime.active_window()
     window.show_quick_panel(self.nombres,self.utilizar)
     print(self.nombres)
开发者ID:programadorsito,项目名称:Packages,代码行数:9,代码来源:agregar_recurso.py


示例18: backup_all

def backup_all(password_file=None, vault_file=None):

    if vault_file:
        if not os.path.isfile(vault_file):
            raise RuntimeError("Unable to locate vault file")
        backup(vault_file, password_file)
    else:
        for file_ in get_files('.'):
            backup(file_, password_file)
开发者ID:bsacks99,项目名称:ansible-toolkit,代码行数:9,代码来源:vault.py


示例19: run

 def run(self, edit):
     window=sublime.active_window()
     if not window.folders():return
     folder=window.folders()[0]
     view=window.active_view()
     self.lista=[]
     self.lista=utils.get_files({"ignores":["target", "build", ".svn", ".git", "bin"]})
     self.Clista=[[os.path.basename(l), l] for l in self.lista]
     window.show_quick_panel(self.Clista, self.abrir)
开发者ID:programadorsito,项目名称:Packages,代码行数:9,代码来源:searchFile.py


示例20: get_polarity_of_original_files

def get_polarity_of_original_files(path):    
    reload(sys)
    list_of_files = utils.get_files(path)
    for f1 in list_of_files:
        f = open(f1,'r')
        file_content = f.read()
        original_encoded_file_content = unicode(file_content,'utf-8')
        document = TextBlob(original_encoded_file_content)
        dictonary_original[f1] = document.sentiment.polarity
        f.close()
开发者ID:geek-manish,项目名称:ML_Work,代码行数:10,代码来源:Polarity.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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