コード例 #1
0
ファイル: output.py プロジェクト: svisser/green
 def _restoreColor(self):
     """Unfortunately other programs (that we test) can mess with termstyle's
     global settings, so we need to reset termstyle to the correct mode after
     each test (which I think is faster than just checking whether it matches
     the current mode...)
     """
     if self.termcolor:
         termstyle.enable()
     else:
         termstyle.disable()
コード例 #2
0
ファイル: output.py プロジェクト: simudream/green
 def _restoreColor(self):
     """
     Unfortunately other programs (that we test) can mess with termstyle's
     global settings, so we need to reset termstyle to the correct mode after
     each test (which I think is faster than just checking whether it matches
     the current mode...)
     """
     if self.termcolor:
         termstyle.enable()
     else:
         termstyle.disable()
コード例 #3
0
ファイル: formatter.py プロジェクト: dobcey/pea
	def configure(self, options, conf):
		self.enabled = options.verbosity >= 2
		if not self.enabled: return
		color = getattr(options, 'color', True)
		force_color = getattr(options, 'force_color', False)
		if color:
			try:
				(termstyle.enable if force_color else termstyle.auto)()
			except TypeError: # happens when stdout is closed
				pass
		else:
			termstyle.disable()
コード例 #4
0
 def configure(self, options, conf):
     self.enabled = options.verbosity >= 2
     if not self.enabled: return
     color = getattr(options, 'rednose', True)
     force_color = getattr(options, 'rednose_color', 'auto') == 'force'
     if color:
         try:
             (termstyle.enable if force_color else termstyle.auto)()
         except TypeError:  # happens when stdout is closed
             pass
     else:
         termstyle.disable()
コード例 #5
0
def get_cmd(args):
    entry = pybib.get_bibtex(args.DOI)

    termstyle.disable()
    print(entry)
    termstyle.enable()