Skip to content

Commit

Permalink
Removed a manual file handler pitfall
Browse files Browse the repository at this point in the history
  • Loading branch information
NaelsonDouglas committed Nov 2, 2021
1 parent 82d6951 commit 2139081
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions gitfiti.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,29 +252,29 @@ def load_images(img_names):
return {}

for image_name in img_names:
img = open(image_name)
loaded_imgs = {}
img_list = ''
img_line = ' '
name = img.readline().replace('\n', '')
name = name[1:]

while True:
img_line = img.readline()
if img_line == '':
break

img_line.replace('\n', '')
if img_line[0] == ':':
loaded_imgs[name] = json.loads(img_list)
name = img_line[1:]
img_list = ''
else:
img_list += img_line

loaded_imgs[name] = json.loads(img_list)

return loaded_imgs
with open(image_name) as img:
loaded_imgs = {}
img_list = ''
img_line = ' '
name = img.readline().replace('\n', '')
name = name[1:]

while True:
img_line = img.readline()
if img_line == '':
break

img_line.replace('\n', '')
if img_line[0] == ':':
loaded_imgs[name] = json.loads(img_list)
name = img_line[1:]
img_list = ''
else:
img_list += img_line

loaded_imgs[name] = json.loads(img_list)

return loaded_imgs


def retrieve_contributions_calendar(username, base_url):
Expand Down

0 comments on commit 2139081

Please sign in to comment.