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

Python output.bold函数代码示例

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

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



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

示例1: usage

def usage():
    print("esync (%s) - Calls 'emerge sync' and 'eupdatedb' and shows updates" \
        % version)
    print("")
    print(bold("Usage:"), "esync [", darkgreen("options"), "]")
    print(bold("Options:"))
    print(darkgreen("  --help") + ", " + darkgreen("-h"))
    print("    Print this help message")
    print("")
    print(darkgreen("  --webrsync") + ", " + darkgreen("-w"))
    print("    Use 'emerge-webrsync' instead of 'emerge --sync'")
    print("")
    print(darkgreen("  --delta-webrsync") + ", " + darkgreen("-d"))
    print("    Use 'emerge-delta-webrsync' instead of 'emerge --sync'")
    print("")
    print(darkgreen("  --metadata") + ", " + darkgreen("-m"))
    print("    Use 'emerge --metadata' instead of 'emerge --sync'")
    print("")
    print(darkgreen("  --layman-sync") + ", " + darkgreen("-l"))
    print("    Use layman to sync any installed overlays, then sync the main tree")
    print("")
    print(darkgreen("  --nocolor") + ", " + darkgreen("-n"))
    print("    Don't use ANSI codes for colored output")
    print("")
    print(darkgreen("  --quiet") + ", " + darkgreen("-q"))
    print("    Less output (implies --nospinner)")
    print("")
    print(darkgreen("  --verbose") + ", " + darkgreen("-v"))
    print("    Verbose output")
    print("")
    print(darkgreen("  --nospinner") + ", " + darkgreen("-s"))
    print("    Don't display the remaining index count")

    sys.exit(0)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:34,代码来源:sync.py


示例2: _suggest

	def _suggest(self):
		print()
		if self.suggest['ignore_masked']:
			print(bold(
				"Note: use --without-mask to check "
				"KEYWORDS on dependencies of masked packages"))

		if self.suggest['include_dev']:
			print(bold(
				"Note: use --include-dev (-d) to check "
				"dependencies for 'dev' profiles"))
		print()
开发者ID:dol-sen,项目名称:portage,代码行数:12,代码来源:actions.py


示例3: chk_updated_cfg_files

def chk_updated_cfg_files(eroot, config_protect):
	target_root = eroot
	result = list(
		portage.util.find_updated_config_files(target_root, config_protect))

	for x in result:
		writemsg_level("\n %s " % (colorize("WARN", "* " + _("IMPORTANT:"))),
			level=logging.INFO, noiselevel=-1)
		if not x[1]: # it's a protected file
			writemsg_level( _("config file '%s' needs updating.\n") % x[0],
				level=logging.INFO, noiselevel=-1)
		else: # it's a protected dir
			if len(x[1]) == 1:
				head, tail = os.path.split(x[1][0])
				tail = tail[len("._cfg0000_"):]
				fpath = os.path.join(head, tail)
				writemsg_level(_("config file '%s' needs updating.\n") % fpath,
					level=logging.INFO, noiselevel=-1)
			else:
				writemsg_level(
					_("%d config files in '%s' need updating.\n") % \
					(len(x[1]), x[0]), level=logging.INFO, noiselevel=-1)

	if result:
		print(" " + yellow("*") + " See the " +
			colorize("INFORM", _("CONFIGURATION FILES")) + " and " +
			colorize("INFORM", _("CONFIGURATION FILES UPDATE TOOLS")))
		print(" " + yellow("*") + " sections of the " + bold("emerge") + " " +
			_("man page to learn how to update config files."))
开发者ID:aeroniero33,项目名称:portage,代码行数:29,代码来源:chk_updated_cfg_files.py


示例4: search_ebuilds

def search_ebuilds(path, portdir=True, searchdef="", repo_num="",
        config=None, data=None):
    pv = ""
    pkgs = []
    nr = len(data['ebuilds']) + 1

    if portdir:
        rep = darkgreen("Portage    ")
    else:
        rep = red("Overlay "+str(repo_num)+"  ")

    if isdir(path):
        filelist = listdir(path)

        for file in filelist:
            if file[-7:] == ".ebuild":
                pv = file[:-7]
                pkgs.append(list(pkgsplit(pv)))
                pkgs[-1].append(path + file)
                if searchdef != "" and pv == searchdef:
                    data['defebuild'] = (searchdef, pkgs[-1][3])
        if not portdir:
            config['found_in_overlay'] = True
        pkgs.sort(key=cmp_sort_key(mypkgcmp))
        for pkg in pkgs:
            rev = ""
            if pkg[2] != "r0":
                rev = "-" + pkg[2]
            data['output'].append(" " + rep + " [" + bold(str(nr)) + "] " +
                pkg[0] + "-" + pkg[1] + rev + "\n")
            data['ebuilds'].append(pkg[len(pkg)-1])
            nr += 1
开发者ID:magical,项目名称:esearch,代码行数:32,代码来源:search.py


示例5: __init__

	def __init__(self, scanned_files, logger, searchlibs=None, searchbits=None,
				all_masks=None, masked_dirs=None):
		'''LibCheck init function.

		@param scanned_files: optional dictionary if the type created by
				scan_files().  Defaults to the class instance of scanned_files
		@param logger: python style Logging function to use for output.
		@param searchlibs: optional set() of libraries to search for. If defined
				it toggles several settings to configure this class for
				a target search rather than a broken libs search.
		'''
		self.scanned_files = scanned_files
		self.logger = logger
		self.searchlibs = searchlibs
		self.searchbits = sorted(searchbits) or ['32', '64']
		self.all_masks = all_masks
		self.masked_dirs = masked_dirs
		self.logger.debug("\tLibCheck.__init__(), new searchlibs: %s" %(self.searchbits))
		if searchlibs:
			self.smsg = '\tLibCheck.search(), Checking for %s bit dependants'
			self.pmsg = yellow(" * ") + 'Files that depend on: %s (%s bits)'
			self.setlibs = self._setslibs
			self.check = self._checkforlib
		else:
			self.smsg = '\tLibCheck.search(), Checking for broken %s bit libs'
			self.pmsg = green(' * ') + bold('Broken files that require:') + ' %s (%s bits)'
			self.setlibs = self._setlibs
			self.check = self._checkbroken
		self.sfmsg = "\tLibCheck.search(); Total found: %(count)d libs, %(deps)d files in %(time)d milliseconds"
		self.alllibs = None
开发者ID:zmedico,项目名称:gentoolkit,代码行数:30,代码来源:analyse.py


示例6: _set_no_columns

	def _set_no_columns(self, pkg, pkg_info):
		"""prints pkg info without column indentation.

		@param pkg: _emerge.Package.Package instance
		@param pkg_info: dictionary
		@rtype the updated addl
		"""
		pkg_str = pkg.cpv
		if self.conf.verbosity == 3:
			pkg_str = self._append_slot(pkg_str, pkg, pkg_info)
			pkg_str = self._append_repository(pkg_str, pkg, pkg_info)
		if not pkg_info.merge:
			addl = self.empty_space_in_brackets()
			myprint = "[%s%s] %s%s %s" % \
				(self.pkgprint(pkg_info.operation.ljust(13),
				pkg_info), addl,
				self.indent, self.pkgprint(pkg_str, pkg_info),
				pkg_info.oldbest)
		else:
			myprint = "[%s %s%s] %s%s %s" % \
				(self.pkgprint(pkg.type_name, pkg_info),
				pkg_info.attr_display, \
				bold(blue("L")) if self._has_local_patch(pkg) else " ", \
				self.indent, \
				self.pkgprint(pkg_str, pkg_info), pkg_info.oldbest)
				#if self.localpatch_enabled:
				#self. += bold(blue("L")) if self._has_local_patch(pkg) else " "
		return myprint
开发者ID:clickbeetle,项目名称:portage-cb,代码行数:28,代码来源:output.py


示例7: get_best_match

def get_best_match(cpv, cp, logger):
	"""Tries to find another version of the pkg with the same slot
	as the deprecated installed version.  Failing that attempt to get any version
	of the same app

	@param cpv: string
	@param cp: string
	@rtype tuple: ([cpv,...], SLOT)
	"""

	slot = portage.db[portage.root]["vartree"].dbapi.aux_get(cpv, ["SLOT"])[0]
	logger.warning('\t%s "%s" %s.' % (yellow('* Warning:'), cpv,bold('ebuild not found.')))
	logger.debug('\tget_best_match(); Looking for %s:%s' %(cp, slot))
	try:
		match = portdb.match('%s:%s' %(cp, slot))
	except portage.exception.InvalidAtom:
		match = None

	if not match:
		logger.warning('\t' + red('!!') + ' ' + yellow(
			'Could not find ebuild for %s:%s' %(cp, slot)))
		slot = ['']
		match = portdb.match(cp)
		if not match:
			logger.warning('\t' + red('!!') + ' ' +
				yellow('Could not find ebuild for ' + cp))
	return match, slot
开发者ID:zmedico,项目名称:gentoolkit,代码行数:27,代码来源:assign.py


示例8: shorthelp

def shorthelp():
	print(bold("emerge:")+" the other white meat (command-line interface to the Portage system)")
	print(bold("Usage:"))
	print("   "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("@set")+" | "+turquoise("atom")+" ] [ ... ]")
	print("   "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >")
	print("   "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >")
	print("   "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]")
	print("   "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("--verbose")+" ] ")
	print(bold("Options:")+" "+green("-")+"["+green("abBcCdDefgGhjkKlnNoOpPqrsStuvV")+"]")
	print("          [ " + green("--color")+" < " + turquoise("y") + " | "+ turquoise("n")+" >            ] [ "+green("--columns")+"    ]")
	print("          [ "+green("--complete-graph")+"             ] [ "+green("--deep")+"       ]")
	print("          [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + "            ]")
	print("          [ "+green("--newuse")+"    ] [ "+green("--noconfmem")+"  ] [ "+green("--nospinner")+"  ]")
	print("          [ "+green("--oneshot")+"   ] [ "+green("--onlydeps")+"   ]")
	print("          [ "+green("--reinstall ")+turquoise("changed-use")+"      ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" >         ]")
	print(bold("Actions:")+"  [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+"        ]")
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:16,代码来源:help.py


示例9: print_changelog

	def print_changelog(self):
		"""Prints the changelog text to std_out
		"""
		if not self.changelogs:
			return
		writemsg_stdout('\n', noiselevel=-1)
		for revision, text in self.changelogs:
			writemsg_stdout(bold('*'+revision) + '\n' + text,
				noiselevel=-1)
		return
开发者ID:zy-sunshine,项目名称:easymgc,代码行数:10,代码来源:output.py


示例10: usage

def usage():
    print("esearch (%s) - Replacement for 'emerge search' with search-index" % version)
    print("")
    print(bold("Usage:"), "esearch [", darkgreen("options"), "] pattern")
    print(bold("Options:"))
    print(darkgreen("  --help") + ", " + darkgreen("-h"))
    print("    Print help message")
    print("")
    print(darkgreen("  --searchdesc") + ", " + darkgreen("-S"))
    print("    Search package descriptions as well")
    print("")
    print(darkgreen("  --fullname") + ", " + darkgreen("-F"))
    print("    Search packages full name (includes category)")
    print("")
    print(darkgreen("  --instonly") + ", " + darkgreen("-I"))
    print("    Find only packages which are installed")
    print("")
    print(darkgreen("  --notinst") + ", " + darkgreen("-N"))
    print("    Find only packages which are not installed")
    print("")
    print(darkgreen("  --exclude=") + "xpattern" + ", " + darkgreen("-x"), "xpattern")
    print("    Exclude packages matching xpattern from search result")
    print("")
    print(darkgreen("  --compact") + ", " + darkgreen("-c"))
    print("    More compact output format")
    print("")
    print(darkgreen("  --verbose") + ", " + darkgreen("-v"))
    print("    Give a lot of additional information (slow!)")
    print("")
    print(darkgreen("  --ebuild") + ", " + darkgreen("-e"))
    print("    View ebuilds of found packages")
    print("")
    print(darkgreen("  --own=") + "format" + ", " + darkgreen("-o"), "format")
    print("    Use your own output format, see manpage for details of format")
    print("")
    print(darkgreen("  --directory=") + "dir" + ", " + darkgreen("-d"), "dir")
    print("    Use dir as directory to load esearch index from")
    print("")
    print(darkgreen("  --nocolor") + ", " + darkgreen("-n"))
    print("    Don't use ANSI codes for colored output")

    sys.exit(0)
开发者ID:magical,项目名称:esearch,代码行数:42,代码来源:search.py


示例11: query

    def query(self, prompt, enter_invalid, responses=None, colours=None):
        """Display a prompt and a set of responses, then waits for user input
		and check it against the responses. The first match is returned.

		An empty response will match the first value in the list of responses,
		unless enter_invalid is True. The input buffer is *not* cleared prior
		to the prompt!

		prompt: The String to display as a prompt.
		responses: a List of Strings with the acceptable responses.
		colours: a List of Functions taking and returning a String, used to
		process the responses for display. Typically these will be functions
		like red() but could be e.g. lambda x: "DisplayString".

		If responses is omitted, it defaults to ["Yes", "No"], [green, red].
		If only colours is omitted, it defaults to [bold, ...].

		Returns a member of the List responses. (If called without optional
		arguments, it returns "Yes" or "No".)

		KeyboardInterrupt is converted to SystemExit to avoid tracebacks being
		printed."""
        if responses is None:
            responses = ["Yes", "No"]
            colours = [create_color_func("PROMPT_CHOICE_DEFAULT"), create_color_func("PROMPT_CHOICE_OTHER")]
        elif colours is None:
            colours = [bold]
        colours = (colours * len(responses))[: len(responses)]
        responses = [_unicode_decode(x) for x in responses]
        if "--alert" in self.myopts:
            prompt = "\a" + prompt
        print(bold(prompt), end=" ")
        try:
            while True:
                if sys.hexversion >= 0x3000000:
                    try:
                        response = input("[%s] " % "/".join([colours[i](responses[i]) for i in range(len(responses))]))
                    except UnicodeDecodeError as e:
                        response = _unicode_decode(e.object).rstrip("\n")
                else:
                    response = raw_input(
                        "[" + "/".join([colours[i](responses[i]) for i in range(len(responses))]) + "] "
                    )
                    response = _unicode_decode(response)
                if response or not enter_invalid:
                    for key in responses:
                        # An empty response will match the
                        # first value in responses.
                        if response.upper() == key[: len(response)].upper():
                            return key
                print("Sorry, response '%s' not understood." % response, end=" ")
        except (EOFError, KeyboardInterrupt):
            print("Interrupted.")
            sys.exit(128 + signal.SIGINT)
开发者ID:amadio,项目名称:portage,代码行数:54,代码来源:UserQuery.py


示例12: usage

def usage():
    print("eupdatedb (%s) - Update the search-index for esearch" % version)
    print("")
    print(bold("Usage:"), "eupdatedb [", darkgreen("options"), "]")
    print(bold("Options:"))
    print(darkgreen("  --help") + ", " + darkgreen("-h"))
    print("    Print this help message")
    print("")
    print(darkgreen("  --verbose") + ", " + darkgreen("-v"))
    print("    Verbose mode, show categories")
    print("")
    print(darkgreen("  --quiet") + ", " + darkgreen("-q"))
    print("    Print only summary")
    print("")
    print(darkgreen("  --directory=") + "dir, " + darkgreen("-d") + " dir")
    print("    Load esearch index from dir")
    print("")
    print(darkgreen("  --nocolor") + ", " + darkgreen("-n"))
    print("    Don't use ANSI codes for colored output")

    sys.exit(0)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:21,代码来源:update.py


示例13: userquery

def userquery(prompt, responses=None, default_response_num=1):
	"""
	Inspired by portage's _emerge.userquery.

	Gives the user a question ('prompt') and forces him to chose one of the
	responses ('responses', defaulting to 'Yes' and 'No').

	Returns the (full) choice made.
	"""

	# Colour for the default response:
	default_colour_f = output.green
	# Colour for all the other responses:
	normal_colour_f = output.red

	if responses is None:
		responses = ["Yes", "No"]

	coloured_responses = [None] * len(responses)
	for i, r in enumerate(responses):
		if i + 1 == default_response_num:
			coloured_responses[i] = default_colour_f(r)
		else:
			coloured_responses[i] = normal_colour_f(r)

	final_prompt = \
		"%s [%s] " % (output.bold(prompt), "/".join(coloured_responses))

	if sys.hexversion >= 0x3000000:
		input_function = input
	else:
		input_function = raw_input

	while True:
		# Directly using 'input_function(final_prompt)'
		# leads to problems on my machine.

		print(final_prompt, end='')
		response = input_function()

		if not response:
			# Return the default choice:
			return responses[default_response_num-1]

		for r in responses:
			if response.lower() == r[:len(response)].lower():
				return r

		print("Sorry, response '%s' not understood." % response)
开发者ID:gg7,项目名称:gentoostats,代码行数:49,代码来源:configure.py


示例14: _non_commit

	def _non_commit(self, result):
		if result['full']:
			print(bold("Note: type \"repoman full\" for a complete listing."))
		if result['warn'] and not result['fail']:
			if self.options.quiet:
				print(bold("Non-Fatal QA errors found"))
			else:
				utilities.repoman_sez(
					"\"You're only giving me a partial QA payment?\n"
					"              I'll take it this time, but I'm not happy.\""
					)
		elif not result['fail']:
			if self.options.quiet:
				print("No QA issues found")
			else:
				utilities.repoman_sez(
					"\"If everyone were like you, I'd be out of business!\"")
		elif result['fail']:
			print(bad("Please fix these important QA issues first."))
			if not self.options.quiet:
				utilities.repoman_sez(
					"\"Make your QA payment on time"
					" and you'll never see the likes of me.\"\n")
			sys.exit(1)
开发者ID:dol-sen,项目名称:portage,代码行数:24,代码来源:actions.py


示例15: rebuild

def rebuild(logger, assigned, settings):
	"""rebuilds the assigned pkgs"""

	args = settings['pass_through_options']
	if settings['EXACT']:
		_assigned = filter_masked(assigned, logger)
		emerge_command = '=' + ' ='.join(_assigned)
	else:
		_assigned = get_slotted_cps(assigned, logger)
		emerge_command = ' '.join(_assigned)
	if settings['PRETEND']:
		args += ' --pretend'
	if settings['VERBOSITY'] >= 2:
		args += ' --verbose'
	elif settings['VERBOSITY'] < 1:
		args += ' --quiet'
	if settings['nocolor']:
		args += ' --color n'

	if len(emerge_command) == 0:
		logger.warning(bold('\nThere is nothing to emerge. Exiting.'))
		return 0

	logger.warning(yellow(
		'\nemerge') + args +
		' --oneshot --complete-graph=y ' +
		bold(emerge_command))

	stime = current_milli_time()
	_args = 'emerge ' + args + ' --oneshot --complete-graph=y ' + emerge_command
	_args = _args.split()
	success = subprocess.call(_args)
	ftime = current_milli_time()
	logger.debug("\trebuild(); emerge call for %d ebuilds took: %s seconds"
		% (len(_assigned), str((ftime-stime)/1000.0)))
	return success
开发者ID:zmedico,项目名称:gentoolkit,代码行数:36,代码来源:rebuild.py


示例16: assign_packages

def assign_packages(broken, logger, settings):
	''' Finds and returns packages that owns files placed in broken.
		Broken is list of files
	'''
	stime = current_milli_time()

	broken_matcher = _file_matcher()
	for filename in broken:
		broken_matcher.add(filename)

	assigned_pkgs = set()
	assigned_filenames = set()
	for group in os.listdir(settings['PKG_DIR']):
		grppath = settings['PKG_DIR'] + group
		if not os.path.isdir(grppath):
			continue
		for pkg in os.listdir(grppath):
			pkgpath = settings['PKG_DIR'] + group + '/' + pkg
			if not os.path.isdir(pkgpath):
				continue
			f = pkgpath + '/CONTENTS'
			if os.path.exists(f):
				contents_matcher = _file_matcher()
				try:
					with io.open(f, 'r', encoding='utf_8') as cnt:
						for line in cnt.readlines():
							m = re.match('^obj (/[^ ]+)', line)
							if m is not None:
								contents_matcher.add(m.group(1))
				except Exception as e:
					logger.warning(red(' !! Failed to read ' + f))
					logger.warning(red(' !! Error was:' + str(e)))
				else:
					for m in contents_matcher.intersection(broken_matcher):
						found = group+'/'+pkg
						assigned_pkgs.add(found)
						assigned_filenames.add(m)
						logger.info('\t' + green('* ') + m +
									' -> ' + bold(found))

	broken_filenames = set(broken)
	orphaned = broken_filenames.difference(assigned_filenames)
	ftime = current_milli_time()
	logger.debug("\tassign_packages(); assigned "
		"%d packages, %d orphans in %d milliseconds"
		% (len(assigned_pkgs), len(orphaned), ftime-stime))

	return (assigned_pkgs, orphaned)
开发者ID:zmedico,项目名称:gentoolkit,代码行数:48,代码来源:assign.py


示例17: chk_updated_cfg_files

	def chk_updated_cfg_files(self, eroot, config_protect):
		target_root = eroot
		result = list(portage.util.find_updated_config_files(target_root, config_protect))

		print("DEBUG: scanning /etc for config files....")

		for x in result:
			print("\n"+colorize("WARN", " * IMPORTANT:"), end=' ')
			if not x[1]: # it's a protected file
				print("config file '%s' needs updating." % x[0])
			else: # it's a protected dir
				print("%d config files in '%s' need updating." % (len(x[1]), x[0]))
	
		if result:
			print(" "+yellow("*")+" See the "+colorize("INFORM","CONFIGURATION FILES")\
					+ " section of the " + bold("emerge"))
			print(" "+yellow("*")+" man page to learn how to update config files.")
开发者ID:danielrobbins,项目名称:funports,代码行数:17,代码来源:extensions.py


示例18: extract_dependencies_from_la

def extract_dependencies_from_la(la, libraries, to_check, logger):
	broken = []

	libnames = []
	for lib in libraries:
		match = re.match('.+\/(.+)\.(so|la|a)(\..+)?', lib)
		if match is not None:
			libname = match.group(1)
			if libname not in libnames:
				libnames += [libname, ]

	for _file in la:
		if not os.path.exists(_file):
			continue

		for line in open(_unicode_encode(_file, encoding=_encodings['fs']), mode='r',
			encoding=_encodings['content']).readlines():
			line = line.strip()
			if line.startswith('dependency_libs='):
				match = re.match("dependency_libs='([^']+)'", line)
				if match is not None:
					for el in match.group(1).split(' '):
						el = el.strip()
						if (len(el) < 1 or el.startswith('-L')
							or el.startswith('-R')
							):
							continue

						if el.startswith('-l') and 'lib'+el[2:] in libnames:
							pass
						elif el in la or el in libraries:
							pass
						else:
							if to_check:
								_break = False
								for tc in to_check:
									if tc in el:
										_break = True
										break
								if not _break:
									continue

							logger.info('\t' + yellow(' * ') + _file +
								' is broken (requires: ' + bold(el)+')')
							broken.append(_file)
	return broken
开发者ID:zmedico,项目名称:gentoolkit,代码行数:46,代码来源:analyse.py


示例19: userquery

def userquery(prompt, enter_invalid, responses=None, colours=None):
	"""Displays a prompt and a set of responses, then waits for a response
	which is checked against the responses and the first to match is
	returned. An empty response will match the first value in responses,
	unless enter_invalid is True. The input buffer is *not* cleared prior
	to the prompt!

	prompt: a String.
	responses: a List of Strings.
	colours: a List of Functions taking and returning a String, used to
	process the responses for display. Typically these will be functions
	like red() but could be e.g. lambda x: "DisplayString".
	If responses is omitted, defaults to ["Yes", "No"], [green, red].
	If only colours is omitted, defaults to [bold, ...].

	Returns a member of the List responses. (If called without optional
	arguments, returns "Yes" or "No".)
	KeyboardInterrupt is converted to SystemExit to avoid tracebacks being
	printed."""
	if responses is None:
		responses = ["Yes", "No"]
		colours = [
			create_color_func("PROMPT_CHOICE_DEFAULT"),
			create_color_func("PROMPT_CHOICE_OTHER")
		]
	elif colours is None:
		colours=[bold]
	colours=(colours*len(responses))[:len(responses)]
	print(bold(prompt), end=' ')
	try:
		while True:
			if sys.hexversion >= 0x3000000:
				response=input("["+"/".join([colours[i](responses[i]) for i in range(len(responses))])+"] ")
			else:
				response=raw_input("["+"/".join([colours[i](responses[i]) for i in range(len(responses))])+"] ")
			if response or not enter_invalid:
				for key in responses:
					# An empty response will match the
					# first value in responses.
					if response.upper()==key[:len(response)].upper():
						return key
			print("Sorry, response '%s' not understood." % response, end=' ')
	except (EOFError, KeyboardInterrupt):
		print("Interrupted.")
		sys.exit(1)
开发者ID:TommyD,项目名称:gentoo-portage-multilib,代码行数:45,代码来源:userquery.py


示例20: do_compact

def do_compact(pkg):
    prefix0 = " "
    prefix1 = " "

    if pkg[3] == pkg[4]:
        color = darkgreen
        prefix1 = "I"
    elif not pkg[4]:
        color = darkgreen
        prefix1 = "N"
    else:
        color = turquoise
        prefix1 = "U"

    if pkg[2]:
        prefix0 = "M"

    return " [%s%s] %s (%s):  %s" % \
            (red(prefix0), color(prefix1), bold(pkg[1]), color(pkg[3]), pkg[7])
开发者ID:magical,项目名称:esearch,代码行数:19,代码来源:search.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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