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


Python C.yellow方法代码示例

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


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

示例1: checkreport

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkreport(fn, o):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('FIXD'))
	r = checkon(fn, o)
	# non-verbose mode by default
	if verbose or r != 0:
		report(statuses[r], fn)
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:9,代码来源:refine-giveNames.py

示例2: checkreport

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkreport(fn, o):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('WARN'))
	r, msg = checkon(fn, o)
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {}: {}'.format(statuses[r], fn, msg))
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:9,代码来源:analyse-bibtex.py

示例3: checkon

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkon(fn, o):
	if not os.path.exists(fn) or os.path.isdir(fn):
		fn = fn + '.json'
	if not os.path.exists(fn):
		# if it still does not exist, let us create a minimal one
		f = open(fn, 'w')
		f.write('{{\n\t"title": "{name}",\n\t"type": "proceedings",\n\t"year": {year}\n}}'.format(\
			name=fn.split('/')[-1][:-5].replace('-', ' '),
			year=findYear(fn.split('/')[-1])\
		))
		f.close()
		print('[ {} ] {}'.format(C.yellow('MADE'), fn))
		return 2
	f = open(fn, 'r')
	lines = f.readlines()[1:-1]
	f.close()
	for line in lines:
		if line.find('"year"') > -1 and findYear(line) > 3000:
			os.remove(fn)
			print('[ {} ] {}'.format(C.red('KILL'), fn))
			return 1
	flines = sorted([strictstrip(s) for s in lines])
	plines = sorted([strictstrip(s) for s in o.getJSON().split('\n')[1:-1]])
	if flines != plines:
		f1 = [line for line in flines if line not in plines]
		f2 = [line for line in plines if line not in flines]
		print('∆:', f1, '\nvs', f2)
	if flines == plines:
		return 0
	else:
		return 1
开发者ID:bibtex,项目名称:bibsleigh,代码行数:33,代码来源:refine-checkJson.py

示例4: report

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def report(fn, r):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('UNEX'))
	special = ('', '- no crossref found!', '- illegal crossref')
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {} {}'.format(statuses[r], fn, special[r]))
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:9,代码来源:refine-findTangled.py

示例5: checkreport

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkreport(m, o):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('FIXD'))
	r = checkon(m, o)
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {}'.format(statuses[r], o.filename))
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:9,代码来源:refine-liftProceedings.py

示例6: checkreport

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkreport(fn, o, br):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('FIXD'))
	if br:
		r = checkbrand(fn, br)
	else:
		r = checkon(fn, o)
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {}'.format(statuses[r], fn))
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:12,代码来源:refine-stem.py

示例7: checkreport

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkreport(fn, o):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('FIXD'))
	if isinstance(o, int):
		r = o
	else:
		r = checkon(fn, o)
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {}'.format(statuses[r], fn))
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:12,代码来源:refine-sortJson.py

示例8: checkon

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkon(m, o):
	# if no common model found, we failed
	if not m:
		return 1
	if 'type' in m.keys() and m['type'] in ('inproceedings', 'article'):
		m['type'] = 'proceedings'
	if 'type' in m.keys() and m['type'] == 'incollection':
		m['type'] = 'book'
	if 'crossref' in m.keys():
		del m['crossref']
	if 'booktitle' in m.keys():
		m['title'] = m['booktitle']
		del m['booktitle']
	if 'booktitleshort' in m.keys():
		# TODO: ???
		del m['booktitleshort']
	r = 0
	n = {}
	for k in m.keys():
		if o.get(k) == m[k]:
			if verbose:
				print(C.blue('Confirmed:  '), k, 'as', m[k])
		else:
			if verbose:
				print(C.red('Conflicted: '), k, 'as', m[k], 'vs', o.get(k))
			v = heurichoose(k, m[k], o.json[k]) if k in o.json.keys() else m[k]
			if verbose:
				print(C.yellow('Settled for:'), v)
			n[k] = v
			r = 2
	if r == 0:
		return r
	if r == 2 and not n:
		# nothing to fix?!
		return 0
	if not os.path.exists(o.filename):
		return 0
	if os.path.isdir(o.filename):
		fn = o.filename + '.json'
	else:
		fn = o.filename
	if os.path.exists(fn):
		f = open(fn, 'r')
		lines = f.read()
		f.close()
		if lines != o.getJSON():
			# strange, should be equal (run all normalisers first!)
			return 1
	for k in n.keys():
		o.json[k] = n[k]
	f = open(fn, 'w')
	f.write(o.getJSON())
	f.close()
	return 2
开发者ID:bibtex,项目名称:bibsleigh,代码行数:56,代码来源:refine-liftProceedings.py

示例9: report

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def report(s, r):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('FIXD'))
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {}'.format(statuses[r], s))
	return r

if __name__ == "__main__":
	verbose = sys.argv[-1] == '-v'
	# All known contributors
	cx = {0: 0, 1: 0, 2: 0}
	people = {}
	for fn in glob.glob(ienputdir + '/people/*.json'):
		p = parseJSON(fn)
		if p['name'] in people.keys():
			cx[report(C.red('duplicate')+' '+C.yellow(p), 1)] += 1
			continue
		people[p['name']] = p
	print('{}: {} venues, {} papers written by {} people\n{}'.format(\
		C.purple('BibSLEIGH'),
		C.red(len(sleigh.venues)),
		C.red(sleigh.numOfPapers()),
		C.red(len(people)),
		C.purple('='*42)))
	# traverse ALL the papers!
	for v in sleigh.venues:
		for c in v.getConfs():
			for p in c.papers:
				if 'author' in p.json.keys():
					for a in listify(p.json['author']):
						if a in people.keys():
开发者ID:bibtex,项目名称:bibsleigh,代码行数:33,代码来源:refine-whowrote.py

示例10: report

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def report(one, two):
	print('[ {} ] {}'.format(one, two))

def checkreport(fn, o):
	statuses = (C.blue('PASS'), C.red('FAIL'), C.yellow('FIXD'))
	r = checkon(fn, o)
	# non-verbose mode by default
	if verbose or r != 0:
		report(statuses[r], fn)
	return r

if __name__ == "__main__":
	if len(sys.argv) > 1:
		verbose = sys.argv[1] == '-v'
	print('{}: {} venues, {} papers\n{}'.format(\
		C.purple('BibSLEIGH'),
		C.red(len(sleigh.venues)),
		C.red(sleigh.numOfPapers()),
		C.purple('='*42)))
	cx = {0: 0, 1: 0, 2: 0}
	for v in sleigh.venues:
		for c in v.getConfs():
			cx[checkreport(c.filename, c)] += 1
			for p in c.papers:
				cx[checkreport(p.filename, p)] += 1
	print('{} files checked, {} ok, {} fixed, {} failed'.format(\
		C.bold(cx[0] + cx[1] + cx[2]),
		C.blue(cx[0]),
		C.yellow(cx[2]),
		C.red(cx[1])))
开发者ID:bibtex,项目名称:bibsleigh,代码行数:32,代码来源:refine-giveNames.py

示例11: checkon

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkon(fn, o):
	if not os.path.exists(fn) or os.path.isdir(fn):
		fn = fn + '.json'
	f = open(fn, 'r')
	lines = f.readlines()[1:-1]
	f.close()
	flines = json2lines(lines)
	plines = sorted(json2lines(o.getJSON().split('\n')))
	# bad variants
	for bad in unfoldName:
		for key in wheretolook:
			if o.get(key) == bad:
				o.json[key] = unfoldName[bad]
	# contractions
	for short in short2long:
		for key in wheretolook:
			if o.get(key) == short:
				o.json[key] = short2long[short]
			if o.get(key) == short2long[short]:
				o.json[key+'short'] = short
	# a heuristic contraction for conference names
	if o.get('type') == 'inproceedings' \
	and 'booktitleshort' not in o.json.keys() \
	and 'booktitle' in o.up().json.keys() \
	and len(o.get('booktitle')) > len(o.up().get('booktitle')):
		o.json['booktitleshort'] = o.up().get('booktitle')
	# a heuristic expansion of conference names
	# if o.get('type') == 'proceedings' \
	# and 'booktitleshort' not in o.json.keys() \
	# and 'booktitle' in o.up().json.keys() \
	# and len(o.get('booktitle')) > len(o.up().get('booktitle')):
	# 	o.json['booktitleshort'] = o.up().get('booktitle')
	# remove faulty series: journal wins
	if 'series' in o.json and 'journal' in o.json and o.get('series') == o.get('journal'):
		del o.json['series']
	# *short legacy while no longer version present
	for key in [k for k in o.json.keys() if k.endswith('short') and k[:-5] not in o.json.keys()]:
		del o.json[key]
	# Springer name change
	if o.get('publisher').find('Springer') > -1 and 'year' in o.json.keys():
		if int(o.get('year')) < 2002:
			o.json['publisher'] = 'Springer-Verlag'
			o.json['publishershort'] = 'Springer'
		else:
			o.json['publisher'] = 'Springer International Publishing'
			o.json['publishershort'] = 'Springer'
	for key in wheretolook:
		if key not in o.json:
			continue
		val = o.get(key)
		# ends with a dot
		if val.endswith('.'):
			o.json[key] = o.json[key][:-1]
			continue
		# suspiciousness
		if val.find('.') > -1:
			problem = True
			for ok in ('. Volume', 'CEUR-WS.org', 'icml.cc', 'JMLR.org', 'Vol. ', '. Part', \
				' Inc. ', 'WG2.8'):
				if val.find(ok) > -1:
					problem = False
					break
			if problem:
				report(C.yellow('LOOK'), key + ' of ' + o.getKey() + ' is “' + o.get(key) + '”')
		# superfluousness
		if key+'short' in o.json.keys() and val == o.get(key+'short'):
			del o.json[key+'short']
	nlines = sorted(json2lines(o.getJSON().split('\n')))
	if flines != plines:
		return 1
	elif plines != nlines:
		f = open(fn, 'w')
		f.write(o.getJSON())
		f.close()
		return 2
	else:
		return 0
开发者ID:bibtex,项目名称:bibsleigh,代码行数:79,代码来源:refine-giveNames.py

示例12: chr

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
			paperAuths = paperAuths[:-1]
			paperAuths.extend(auths)
		paperLnk = li.get('id')
		hope = li.find_all('a')
		if hope and hope[0].get('href').endswith('.pdf'):
			paperPdf = urlstart + hope[0].get('href')
		else:
			paperPdf = ''
		paperEntry = {'type': 'inproceedings', 'series': 'CEUR Workshop Proceedings',\
			'publisher': 'CEUR-WS.org', 'year': volYear, 'booktitle': volTitles[-1],\
			'editor': volEds, 'volume': volNr.split('-')[-1], 'title': paperTitle,\
			'author': paperAuths, 'pages': paperPages, 'venue': volVenue}
		if paperPdf:
			paperEntry['openpdf'] = paperPdf
		if paperLnk:
			paperEntry['url'] = urlstart + '#' + paperLnk
		paperFilename = outputdir.split('/')[-1] + '-' + paperAuths[0].split(' ')[-1]
		for a in paperAuths[1:]:
			paperFilename += a.split(' ')[-1][0]
		if paperFilename in done:
			paperFilename += 'a'
			while paperFilename in done:
				paperFilename = paperFilename[:-1] + chr(ord(paperFilename[-1])+1)
		# print(jsonify(paperEntry), '-->', outputdir+'/'+paperFilename+'.json')
		f = open(outputdir+'/'+paperFilename+'.json', 'w')
		f.write(jsonify(paperEntry))
		f.close()
		cx += 1
		done.append(paperFilename)
	print(C.red(volVenue), '-', C.yellow(volTitles[-1]), '-', C.blue(cx), 'papers.')
开发者ID:bibtex,项目名称:bibsleigh,代码行数:32,代码来源:import-ceur.py

示例13: open

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
		C.purple('BibSLEIGH'),
		C.red(len(sleigh.venues)),
		C.red(sleigh.numOfPapers()),
		C.purple('='*42)))
	# read the CSV
	f = open('scrap-committees/scraped-by-grammarware.csv', 'r')
	# CBSE;2001;Heinz;Schmidt;;Organising Committee
	for line in f.readlines():
		vs = line.strip().split(';')
		if len(vs) == 0:
			continue
		v = vs[0] + '-' + vs[1]
		n = vs[2] + ' ' + vs[3]
		# normalise!
		if n in renameto.keys():
			print('[', C.yellow('ALIA'), ']', 'Treating', n, 'as', renameto[n])
			n = renameto[n]
		# sex is ignored, mostly absent anyway
		r = vs[5]
		if v not in roles.keys():
			roles[v] = []
		# NB: the next line uses lists for the sake of JSON compatibility
		roles[v].append([n,r])
	f.close()
	print('Metadata on {} editions loaded with {} role assignments'.format(C.red(len(roles)), C.red(sum([len(roles[k]) for k in roles.keys()]))))
	# now add
	cx = {0: 0, 1: 0, 2: 0}
	for v in sleigh.venues:
		for c in v.getConfs():
			cx[checkreport(c.filename, c)] += 1
			for p in c.papers:
开发者ID:bibtex,项目名称:bibsleigh,代码行数:33,代码来源:refine-committees.py

示例14: checkon

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def checkon(fn, o):
	if 'dblpkey' not in o.json.keys():
		print('[ {} ] {}'.format(C.red('DONT'), 'DBLP key not found on the entry'))
		return 1
	mykey = o.get('dblpkey')
	# for the rare case of multiple dblpkeys
	# (can happen as a DBLP error or when same proceedings span over multiple volumes)
	if isinstance(mykey, list):
		mykey = mykey[0]
	if mykey not in procs.keys():
		print('[ {} ] {}'.format(C.red('DONT'), 'DBLP key not found in the dump'))
		return 1
	title = procs[mykey]
	if title.endswith('.'):
		title = title[:-1]
	ws = title.replace(' - ', ', ').replace(' (', ', ').split(', ')
	country = findOneIn(knownCountries, ws)
	state = findOneIn(usaStateNames, ws)
	found = False
	if country:
		town = ws[ws.index(country)-1]
		state = '?'
		# what if "town" is an USA state? (full)
		if country == 'USA' and town in usaStateNames:
			state = town
			town = ws[ws.index(town)-1]
		# what if "town" is an USA state? (abbreviated)
		if country == 'USA' and town in usaStateAB:
			state = usaStateNames[usaStateAB.index(town)]
			town = ws[ws.index(town)-1]
		# what if "town" is a Canadian state? (full)
		if country == 'Canada' and town in canStateNames:
			state = town
			town = ws[ws.index(town)-1]
		# what if "town" is a Canadian state? (abbreviated)
		if country == 'Canada' and town in canStateAB:
			state = canStateNames[canStateAB.index(town)]
			town = ws[ws.index(town)-1]
		# the same can happen in the UK
		if country in ('UK', 'United Kingdom') and town in ('Scotland', 'Scottland'):
			state = town
			town = ws[ws.index(town)-1]
		# Georgia the country vs Georgia the state
		if country == 'Georgia' and town == 'Atlanta':
			state = country
			country = 'USA'
		# near Something
		if town.startswith('near '):
			town = ws[ws.index(town)-1]
		# Luxembourg, Luxembourg
		if country == 'Luxembourg':
			town = 'Luxembourg'
		# Saint-Malo / St. Malo
		if country == 'France' and town == 'St. Malo':
			town = 'Saint-Malo'
		# Florence / Firenze
		if country == 'Italy' and town.find('Firenze') > -1:
			town = 'Florence'
		found = True
	elif state:
		country = 'USA'
		town = ws[ws.index(state)-1]
		found = True
	else:
		# desperate times
		for sol in desperateSolutions.keys():
			if sol in ws:
				town, state, country = desperateSolutions[sol]
				found = True
	# normalise
	if country in countryMap.keys():
		country = countryMap[country]
	if country == 'United Kingdom' and state == '?':
		if town.endswith('London') or town in ('Birmingham', 'York',\
		'Coventry', 'Nottingham', 'Lancaster', 'Oxford', 'Manchester',\
		'Southampton', 'Norwich', 'Leicester', 'Canterbury'):
			state = 'England'
		elif town in ('Edinburgh', 'Glasgow'):
			state = 'Scotland'
	# report
	if 'address' in o.json.keys():
		print('[ {} ] {}'.format(C.blue('OLDA'), o.get('address')))
	if 'location' in o.json.keys():
		print('[ {} ] {}'.format(C.blue('OLDL'), o.get('location')))
	if found:
		# print('[ {} ] {}'.format(C.blue('KNOW'), country))
		print('[ {} ] {}'.format(C.blue('AD||'), title))
		print('[ {} ] {:30} || {:30} || {:20}'.format(C.blue('AD->'), C.yellow(town), C.yellow(state), C.yellow(country)))
		# TODO: perhaps later we can act more aggressively
		newaddr = [town, '' if state=='?' else state, country]
		if 'address' not in o.json.keys() or newaddr != o.json['address']:
			o.json['address'] = newaddr
			f = open(o.json['FILE'], 'w')
			f.write(o.getJSON())
			f.close()
			return 2
		# nothing changed
		return 0
	print('[ {} ] {}'.format(C.yellow('AD??'), title))
	return 1
开发者ID:bibtex,项目名称:bibsleigh,代码行数:102,代码来源:vsdump-address.py

示例15: report

# 需要导入模块: from fancy.ANSI import C [as 别名]
# 或者: from fancy.ANSI.C import yellow [as 别名]
def report(fn1, fn2, r):
	statuses = (C.blue(' PASS '), C.red(' FAIL '), C.yellow('RENAME'))
	# non-verbose mode by default
	if verbose or r != 0:
		print('[ {} ] {} → {}'.format(statuses[r], fn1, fn2))
	return r
开发者ID:bibtex,项目名称:bibsleigh,代码行数:8,代码来源:refine-yearnorm.py


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