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


Python utils.clean函数代码示例

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


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

示例1: register

def register(username, password):
	"""Registra el usuario y clave, devuelve:
		0 si se registro exitosamente
		1 si el usuario ya existe
		2 si hubo otro problema
	"""
	username = utils.clean(username)
	password = utils.clean(password)

	# vemos si existe (medio feo, pero por ahora funciona, dependemos de
	# que get_personal tira una excepcion si el usuario no existe)
	p = None
	try:
		p = get_personal(username)
	except:
		pass
	if p != None:
		return 1

	p = Personal()
	p.username = username
	p.password = password

	try:
		p.save()
	except:
		return 2
	return 0
开发者ID:crazy2k,项目名称:planifid,代码行数:28,代码来源:personal.py

示例2: get_data

def get_data():
    path = '/Users/zyzdiana/Dropbox/vNav_Test_Data/Apr_17_test_data/'
    dict_10mm = {}
    dict_6_4mm = {}
    dict_8mm = {}
    for root, dirs, files in os.walk(path):
        if len(dirs)==0:
            if('10mm' in root):
                dict_10mm[root] = clean(files)
            if('6_4mm' in root):
                dict_6_4mm[root] = clean(files)
            if('8mm' in root):
                dict_8mm[root] = clean(files)

    list_10mm = []
    for item in dict_10mm.iteritems():
        list_10mm.append(os.path.join(item[0],item[1][0]))
    list_10mm.sort()
    vols_10mm = get_volume(list_10mm, 26)
    list_6_4mm = []
    for item in dict_6_4mm.iteritems():
        list_6_4mm.append(os.path.join(item[0],item[1][0]))
    list_6_4mm.sort()
    vols_6_4mm = get_volume(list_6_4mm, 40)
    list_8mm = []
    for item in dict_8mm.iteritems():
        list_8mm.append(os.path.join(item[0],item[1][0]))
    list_8mm.sort()
    vols_8mm = get_volume(list_8mm, 32)
    return vols_6_4mm, vols_8mm, vols_10mm
开发者ID:mdtisdall,项目名称:AC297r-Volume-Registration,代码行数:30,代码来源:get_data.py

示例3: get_data_all

def get_data_all():
    path = '/Users/zyzdiana/Dropbox/vNav_Test_Data/Apr_17_test_data/'
    dict_10mm = {}
    dict_6_4mm = {}
    dict_8mm = {}
    for root, dirs, files in os.walk(path):
        if len(dirs)==0:
            if('10mm' in root):
                dict_10mm[root] = clean(files)
            if('6_4mm' in root):
                dict_6_4mm[root] = clean(files)
            if('8mm' in root):
                dict_8mm[root] = clean(files)
    keys_10 = sorted(dict_10mm.keys())
    keys_8 = sorted(dict_8mm.keys())
    keys_6_4 = sorted(dict_6_4mm.keys())
    all_10mm = {}
    all_8mm = {}
    all_6_4mm = {}
    for i in xrange(5):
        all_10mm[idx_to_key(i, keys_10)] = []
        all_8mm[idx_to_key(i, keys_8)] = []
        all_6_4mm[idx_to_key(i, keys_6_4)] = []
        for j in xrange(5):
            # 10mm
            path = os.path.join(idx_to_key(i, keys_10),dict_10mm[idx_to_key(i, keys_10)][j])
            all_10mm[idx_to_key(i, keys_10)].append(get_volume_1(path, 26))
            # 8mm
            path = os.path.join(idx_to_key(i, keys_8),dict_8mm[idx_to_key(i, keys_8)][j])
            all_8mm[idx_to_key(i, keys_8)].append(get_volume_1(path, 32))
            # 6.4mm
            path = os.path.join(idx_to_key(i, keys_6_4),dict_6_4mm[idx_to_key(i, keys_6_4)][j])
            all_6_4mm[idx_to_key(i, keys_6_4)].append(get_volume_1(path, 40))
    return all_10mm, all_8mm, all_6_4mm
开发者ID:mdtisdall,项目名称:AC297r-Volume-Registration,代码行数:34,代码来源:get_data.py

示例4: main

def main(_):

    if FLAGS.train:
        if FLAGS.clean:
            clean(FLAGS)
        train()
    else:
        evaluate_line()
开发者ID:chongp,项目名称:Name-Entity-Recognition,代码行数:8,代码来源:main.py

示例5: install

def install():
    utils.clean()
    peg.install()
    fcgi.install()
    json_glib.install()
    discount.install()
    balde.install()
    bluster.install()
    utils.clean()
开发者ID:rafaelmartins,项目名称:bluster,代码行数:9,代码来源:__init__.py

示例6: register

def register(username, password):
	"""Registra el usuario y clave, devuelve:
		0 si se registro exitosamente
		1 si el usuario ya existe
		2 si hubo otro problema
	"""
	# TODO: si alguien molesta con esto, hay que armar un mecanismo para
	# evitar DoS (tampoco es muy complicado).

	username = utils.clean(username)
	password = utils.clean(password)
	return personal.register(username, password)
开发者ID:crazy2k,项目名称:planifid,代码行数:12,代码来源:for_export.py

示例7: listar_radios

def listar_radios(name,url):
    link= clean(abrir_url(url))
    radios=re.compile('<td><a href="/portalradio/conteudos/ficha/.+?radio_id=(.+?)">(.+?)</a></td><td>(.+?)</td>.+?<td align="center">').findall(link)
    for idradio,nomeradio,concelho in radios:
        addDir('[B]'+nomeradio+'[/B] ('+concelho+')',RadiosURL + 'Sintonizador/?radio_id=' + idradio + '&scope=0',21,'http://www.radio.com.pt/APR.ROLI.WEB/Images/Logos/'+ idradio +'.gif',len(radios),'',False)
    xbmc.executebuiltin("Container.SetViewMode(501)")
    paginasradios(url,link)
开发者ID:brunosantos,项目名称:plugin.video.kodi,代码行数:7,代码来源:radios.py

示例8: eligibility

    def eligibility(self):
        try:
            table = utils.Table(self.soup.select("table[summary~=Land]")[0])
        except IndexError:
            return None

        return utils.clean(table["Eligibility"].text.strip())
开发者ID:kchmck,项目名称:scrape-fcc,代码行数:7,代码来源:record.py

示例9: load_words

	def load_words(self, folderpath):
		filenames = glob.glob(folderpath)
		for f in filenames:
			with open(f, 'r') as infile:
				text = infile.read()
				text = utils.clean(text)
				self.words.append([text])
开发者ID:Studentblanchard,项目名称:DataMining,代码行数:7,代码来源:tagger.py

示例10: post

	def post(self):
		db=self.application.database
		content = self.request.arguments.get("content", [""])[0]
		parent = self.request.arguments.get("parent", [None])[0]
		super_parent = self.request.arguments.get("super_parent", [None])[0]

		content = clean(content)
		
		new_comment = {
			"content" : content,
			"time" : datetime.utcnow(),
			"author" : self.get_current_user(),
			"plusvote": list(),
			"minusvote": list()
		}

		if parent != None:
			new_comment["parent"] = parent
		if super_parent != None:
			new_comment["super_parent"] = super_parent
		new_id = db.comments.insert(new_comment)
		print new_id
		print parent
		print db.comments.update({"_id": ObjectId(parent)}, {"$push": {"children": str(new_id)}})
		self.redirect("/")
开发者ID:yquemener,项目名称:noy-nested,代码行数:25,代码来源:PostCommentHandler.py

示例11: __init__

    def __init__(self, schema, output_dir=None):
        ''' Bind array of cleaned schema file lines to validator object. ''' 

        self.schema = utils.clean(schema)
        self.output_dir = output_dir
        self.indent_size = self._find_first_indent()['indent_size']
        self.error = {'msg': None}
开发者ID:foundling,项目名称:scaffolder,代码行数:7,代码来源:validator.py

示例12: rate

def rate(classifier,filename,medi,mad,medi_ld,mad_ld):
	#For now, just assuming the text is csv
	results = classifier
	with open(filename,'rU') as f:
		reader = csv.reader(f,delimiter=',')
		data = [(get_features(tech.clean(row[2]),medi,mad,medi_ld,mad_ld),row[0]) for row in reader]
	print nltk.classify.accuracy(classifier,data)
开发者ID:mac389,项目名称:ytpy,代码行数:7,代码来源:NaiveBernoulliClassifier.py

示例13: new

 def new(self):
     self.name = self.parse('company.name')
     self.suffix = self.fetch('company.suffix')
     self.website = "http://www.%s.%s" % (
         clean(self.name),
         self.fetch('internet.domain_suffix')
         )
开发者ID:mpuig,项目名称:faker,代码行数:7,代码来源:company.py

示例14: process_text

 def process_text(self):
     text = utils.clean(self.get_tweet_text())
     self.set_tweet_text(text)
     self.set_tweet_source(utils.parse_alink(self.get_tweet_source()))
     if self.translation:
         self.detect_language_or_translate()
     self.filter_text()
开发者ID:mftaher,项目名称:TweetMiner,代码行数:7,代码来源:textprocess.py

示例15: listasextras

def listasextras():
    iptvurl='http://01.gen.tr/HasBahCa_IPTV/'
    link= clean(abrir_url(iptvurl))
    streams=re.compile('<a class="autoindex_a" href="./(.+?)">.+?<td class="autoindex_td_right">.+?</td.+?td class="autoindex_td_right">(.+?)</td>').findall(link)
    for nomepasta,act in streams:
        if re.search('.m3u',nomepasta):
            titulo=nomepasta.replace('.m3u','').replace('_',' ').title()
            addDir("[B]%s[/B] (act.%s)" % (titulo,act[2:-2]),iptvurl + nomepasta,5,tvporpath + art + 'listas-ver2.png',1,'',True)
开发者ID:brunosantos,项目名称:plugin.video.kodi,代码行数:8,代码来源:listas.py


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