From bcde93a8752d428ac2ecdcf2608c0c1d75ee5be2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 21 Oct 2011 00:19:48 -0700 Subject: _update_copyright_year: optimize no-match case --- pym/repoman/utilities.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'pym/repoman') diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 9be69011b..eecd46ffa 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -546,9 +546,16 @@ def _update_copyright_year(year, line): 1999 here (in order to be more generic). """ is_bytes = isinstance(line, bytes) + if is_bytes: + if not line.startswith(b'# Copyright '): + return line + else: + if not line.startswith('# Copyright '): + return line + year = _unicode_encode(year) line = _unicode_encode(line) - + line = _copyright_re1.sub(br'\1-' + year + b' ', line) line = _copyright_re2.sub(_copyright_repl(year), line) if not is_bytes: -- cgit v1.2.3-1-g7c22