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()
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()
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()
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()
def get_cmd(args): entry = pybib.get_bibtex(args.DOI) termstyle.disable() print(entry) termstyle.enable()