mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2025-01-08 13:48:05 -05:00
Set all lines the same function
This commit is contained in:
parent
256d6e72a0
commit
d0d687325c
@ -21,16 +21,18 @@ def content_about():
|
|||||||
|
|
||||||
for line, value in enumerate(content_readme):
|
for line, value in enumerate(content_readme):
|
||||||
if checker in value:
|
if checker in value:
|
||||||
# words = i[len(checker):-2].split(', ')
|
|
||||||
# Check for trailing slash
|
# Check for trailing slash
|
||||||
if value[-1] != '\\':
|
if value[-2] != '\\':
|
||||||
last = value[-2:-1]
|
if value[-2] == ' ':
|
||||||
replaced = last.replace(' ', '\\', 1)
|
content_readme[line] = value[:-1] + '\\' + '\n'
|
||||||
content_readme[line] = value[:-2] + ' ' + replaced + '\n'
|
with open(file_readme, 'w') as write_readme:
|
||||||
with open(file_readme, 'w') as write_readme:
|
write_readme.writelines(content_readme)
|
||||||
write_readme.writelines(content_readme)
|
else:
|
||||||
result = "Found errors. Fixed them."
|
content_readme[line] = value[:-1] + ' \\' + '\n'
|
||||||
# Check for comma separated words
|
with open(file_readme, 'w') as write_readme:
|
||||||
|
write_readme.writelines(content_readme)
|
||||||
|
|
||||||
|
result = "Trailing slash wasn't found.\nFixed."
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -1,21 +1,42 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
here = pathlib.Path(__file__).parent
|
here = pathlib.Path(__file__).parent
|
||||||
file_readme = here / './../readme.md'
|
file_readme = here / '../../test.md'
|
||||||
with open(file_readme, 'r') as read_readme:
|
with open(file_readme, 'r') as read_readme:
|
||||||
content_readme = read_readme.readlines()
|
content_readme = read_readme.readlines()
|
||||||
|
|
||||||
|
|
||||||
def featured_playlists():
|
def featured_playlists():
|
||||||
featured_playlists_errors_nums = []
|
"""
|
||||||
featured_playlists_line = 'Featured playlists:'
|
Looks for trailing slashes and words separated by commas at
|
||||||
featured_playlists_dlen = 124
|
every "Featured playlists:" section found in the readme.md file
|
||||||
|
(this is, the list itself).
|
||||||
|
|
||||||
for j, i in enumerate(content_readme):
|
result (str): return value of the function.
|
||||||
if featured_playlists_line in i:
|
checker (str): detector of the line corresponding the file.
|
||||||
if len(i) < featured_playlists_dlen and i[-2] != '\\':
|
length (int): length of the corresponding line.
|
||||||
featured_playlists_errors_nums.append(j)
|
"""
|
||||||
return featured_playlists_errors_nums
|
|
||||||
|
result = 'No errors found.'
|
||||||
|
checker = 'Featured playlists:'
|
||||||
|
length = 124
|
||||||
|
|
||||||
|
for line, value in enumerate(content_readme):
|
||||||
|
if checker in value:
|
||||||
|
# Check for trailing slash
|
||||||
|
if len(value) < length and value[-2] != '\\':
|
||||||
|
if value[-2] == ' ':
|
||||||
|
content_readme[line] = value[:-1] + '\\' + '\n'
|
||||||
|
with open(file_readme, 'w') as write_readme:
|
||||||
|
write_readme.writelines(content_readme)
|
||||||
|
else:
|
||||||
|
content_readme[line] = value[:-1] + ' \\' + '\n'
|
||||||
|
with open(file_readme, 'w') as write_readme:
|
||||||
|
write_readme.writelines(content_readme)
|
||||||
|
|
||||||
|
result = "Trailing slash wasn't found.\nFixed."
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
featured_playlists_errors_nums = featured_playlists()
|
print(featured_playlists())
|
||||||
|
@ -1,20 +1,40 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
here = pathlib.Path(__file__).parent
|
here = pathlib.Path(__file__).parent
|
||||||
file_readme = here / './../readme.md'
|
file_readme = here / '../../test.md'
|
||||||
with open(file_readme, 'r') as read_readme:
|
with open(file_readme, 'r') as read_readme:
|
||||||
content_readme = read_readme.readlines()
|
content_readme = read_readme.readlines()
|
||||||
|
|
||||||
|
|
||||||
def youtubers_names():
|
def youtubers_names():
|
||||||
youtubers_name_errors_nums = []
|
"""
|
||||||
youtuber_count_char = '[**'
|
Looks for trailing slashes and words separated by commas at
|
||||||
|
every YouTuber's name line found in the readme.md file
|
||||||
|
(this is, the list itself).
|
||||||
|
|
||||||
for j, i in enumerate(content_readme):
|
result (str): return value of the function.
|
||||||
if youtuber_count_char in i:
|
checker (str): detector of the line corresponding the file.
|
||||||
if i[-2] != '\\':
|
"""
|
||||||
youtubers_name_errors_nums.append(j)
|
|
||||||
return youtubers_name_errors_nums
|
result = 'No errors found.'
|
||||||
|
checker = '[**'
|
||||||
|
|
||||||
|
for line, value in enumerate(content_readme):
|
||||||
|
if checker in value:
|
||||||
|
# Check for trailing slash
|
||||||
|
if value[-2] != '\\':
|
||||||
|
if value[-2] == ' ':
|
||||||
|
content_readme[line] = value[:-1] + '\\' + '\n'
|
||||||
|
with open(file_readme, 'w') as write_readme:
|
||||||
|
write_readme.writelines(content_readme)
|
||||||
|
else:
|
||||||
|
content_readme[line] = value[:-1] + ' \\' + '\n'
|
||||||
|
with open(file_readme, 'w') as write_readme:
|
||||||
|
write_readme.writelines(content_readme)
|
||||||
|
|
||||||
|
result = "Trailing slash wasn't found.\nFixed."
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
youtubers_name_errors_nums = youtubers_names()
|
print(youtubers_names())
|
||||||
|
Loading…
Reference in New Issue
Block a user