Skip to content

Commit 3d2827b

Browse files
Fixes formatting issues according to Flake8
1 parent 86564a5 commit 3d2827b

12 files changed

+13
-14
lines changed

2023.01.03.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
word = 'advection fog'
1616

17-
cutoffs = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
17+
cutoffs = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
1818

1919
print(f'Looking for {word} in {", ".join(possibilities)}')
2020

2023.01.05.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
from functools import reduce
55
n, k = (10, 4)
6-
permutations = reduce(lambda x, i: x*i, range(1, n+1)) / reduce(lambda x, i: x*i, range(1, 2 if n == k else n - k))
6+
permutations = reduce(lambda x, i: x * i, range(1, n + 1)) / reduce(lambda x, i: x * i, range(1, 2 if n == k else n - k))
77
print(f'P({n}, {k}) = {permutations}')

2023.01.06.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import datetime
66
from functools import lru_cache
77

8+
89
@lru_cache(maxsize=120)
910
def top_n_terms(filepath, stop=None, n=10):
1011
"""
@@ -37,6 +38,7 @@ def top_n_terms(filepath, stop=None, n=10):
3738
top_n.reverse()
3839
return top_n
3940

41+
4042
if __name__ == '__main__':
4143
n_terms = 32
4244
stop_path = './data/text/stop.txt'

2023.01.08.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
text = f.read().replace('\n', ' ')[:-1]
77
items = text.split(' ')
88

9-
n_grams = [(i, i+n, ' '.join(items[i:i+n])) for i in range(0, len(items))]
9+
n_grams = [(i, i + n, ' '.join(items[i:i + n])) for i in range(0, len(items))]
1010

1111
print(n_grams[100:110])
12-
13-

2023.01.11.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@
88
# Remove all puncuations (Sorry Darwin)
99
punc_free_text = text.translate(str.maketrans('', '', string.punctuation))
1010
print(punc_free_text)
11-

2023.01.12.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
with open('./data/text/darwin-origin_of_species-pg2009.txt') as f:
1010
text = ' '.join(f.read().split('\n'))
1111

12-
#Remove stop words
12+
# Remove stop words
1313
text = ' '.join([word for word in re.sub(r'[^\w\s]', '', text).split(' ') if word.lower() not in stop])
1414

1515
print(text)

2023.01.13.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
n = 8
1212
top_n = 50
13-
phrases = Counter([' '.join(tokens[i:i+n]) for i in range(0, len(tokens))]).most_common(top_n)
13+
phrases = Counter([' '.join(tokens[i:i + n]) for i in range(0, len(tokens))]).most_common(top_n)
1414

1515
for i, (phrase, count) in enumerate(phrases):
1616
if len(phrase.strip()):

2023.01.14.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@
1919
for r in result:
2020
term, start, end = r[0], r[1], r[1] + len(r[0])
2121
print(term, start, end, text[start:end])
22-
23-

2023.01.17.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[11, 12, 0]
1313
]
1414

15-
result = [[sum([x*y for x, y in zip(row, col)]) for col in zip(*b)] for row in a]
15+
result = [[sum([x * y for x, y in zip(row, col)]) for col in zip(*b)] for row in a]
1616

1717
for i, _ in enumerate(result):
1818
print(f'{i}: {_}')

2023.01.18.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[5, 4, 3, 2, 1, 0],
77
[2, 4, 6, 8, 10, 12],
88
[3, 6, 9, 12, 15, 18]
9-
]
9+
]
1010

1111
x, y = [0, 2], [1, 4]
1212
sub = [m[y[0]:y[1]] for m in a[x[0]:x[1]]]

0 commit comments

Comments
 (0)