浏览代码

Fix indentation

master
Chris Smith 7 年前
父节点
当前提交
5c3e95a877
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7
    7
      14.py

+ 7
- 7
14.py 查看文件

10
 
10
 
11
 @functools.lru_cache(maxsize=1024)
11
 @functools.lru_cache(maxsize=1024)
12
 def md5(index):
12
 def md5(index):
13
-	return hashlib.md5((salt + str(index)).encode('UTF-8')).hexdigest()
13
+    return hashlib.md5((salt + str(index)).encode('UTF-8')).hexdigest()
14
 
14
 
15
 
15
 
16
 @functools.lru_cache(maxsize=1024)
16
 @functools.lru_cache(maxsize=1024)
17
 def stretched(index):
17
 def stretched(index):
18
-	key = salt + str(index)
19
-	for _ in range(2017): key = hashlib.md5(key.encode('UTF-8')).hexdigest()
20
-	return key
18
+    key = salt + str(index)
19
+    for _ in range(2017): key = hashlib.md5(key.encode('UTF-8')).hexdigest()
20
+    return key
21
 
21
 
22
 
22
 
23
 @functools.lru_cache(maxsize=1024)
23
 @functools.lru_cache(maxsize=1024)
24
 def trip(index, fn):
24
 def trip(index, fn):
25
-	return tripmatcher.search(fn(index))
25
+    return tripmatcher.search(fn(index))
26
 
26
 
27
 tripmatcher = re.compile(r'(.)\1{2}')
27
 tripmatcher = re.compile(r'(.)\1{2}')
28
 matches = lambda fn: ((i, fn(i)) for i in itertools.count()
28
 matches = lambda fn: ((i, fn(i)) for i in itertools.count()
29
-	          if trip(i, fn) and any(trip(i, fn).group(1) * 5 in fn(n)
30
-	          	                     for n in range(i + 1, i + 1000)))
29
+                      if trip(i, fn) and any(trip(i, fn).group(1) * 5 in fn(n)
30
+                                             for n in range(i + 1, i + 1000)))
31
  
31
  
32
 print("Part one: %s" % next(itertools.islice(matches(md5), 63, 64))[0])
32
 print("Part one: %s" % next(itertools.islice(matches(md5), 63, 64))[0])
33
 print("Part two: %s" % next(itertools.islice(matches(stretched), 63, 64))[0])
33
 print("Part two: %s" % next(itertools.islice(matches(stretched), 63, 64))[0])

正在加载...
取消
保存