From: David Stainton Date: Mon, 14 Sep 2015 04:29:56 +0000 (+0200) Subject: Simply should_ignore_file helper function X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/css/@manifest?a=commitdiff_plain;h=6a7801c64013bac07649b19756e0991d7c031ac3;p=tahoe-lafs%2Ftahoe-lafs.git Simply should_ignore_file helper function --- diff --git a/src/allmydata/magicpath.py b/src/allmydata/magicpath.py index e2728421..b072b463 100644 --- a/src/allmydata/magicpath.py +++ b/src/allmydata/magicpath.py @@ -9,22 +9,15 @@ def magic2path(path): return re.sub(ur'@[_@]', lambda m: {u'@_': u'/', u'@@': u'@'}[m.group(0)], path) -IGNORE_SUFFIXES = ['.backup', '.tmp', '.conflicted'] -IGNORE_PREFIXES = ['.'] +IGNORE_SUFFIXES = [u'.backup', u'.tmp', u'.conflicted'] +IGNORE_PREFIXES = [u'.'] def should_ignore_file(path_u): for suffix in IGNORE_SUFFIXES: if path_u.endswith(suffix): return True - while True: - head, tail = os.path.split(path_u) - if tail != "": - for prefix in IGNORE_PREFIXES: - if tail.startswith(prefix): - return True - else: - path_u = head - else: - if head == "": - return False + while path_u != u"": + path_u, tail_u = os.path.split(path_u) + if tail_u.startswith(u"."): + return True return False