attilasimko commited on
Commit
ba642f0
·
1 Parent(s): 08a78c1

new loader

Browse files
Files changed (1) hide show
  1. evaluations/utils.py +4 -8
evaluations/utils.py CHANGED
@@ -8,14 +8,10 @@ import streamlit as st
8
 
9
  def fetch_code(path):
10
  zip_content_dict = {}
11
- with zipfile.ZipFile(path, 'r') as zip_ref:
12
- for file_name in zip_ref.namelist():
13
- if ((file_name.lower().endswith(".py") | (file_name.lower().endswith(".ipynb")) | (file_name.lower().endswith(".md")) | (file_name.lower().endswith(".txt")))):
14
- with zip_ref.open(file_name) as file:
15
- file_content = file.read().decode('utf-8')
16
- zip_content_dict[file_name] = file_content
17
- with zip_ref.open(file_name) as file:
18
- file_content = file.read().decode('utf-8')
19
  zip_content_dict[file_name] = file_content
20
  return zip_content_dict
21
 
 
8
 
9
  def fetch_code(path):
10
  zip_content_dict = {}
11
+ zipfile = zipfile.ZipFile(path)
12
+ for file_name in zipfile.namelist():
13
+ if ((file_name.lower().endswith(".py") | (file_name.lower().endswith(".ipynb")) | (file_name.lower().endswith(".md")) | (file_name.lower().endswith(".txt")))):
14
+ file_content = zipfile.open(file_name).read().decode("utf-8")
 
 
 
 
15
  zip_content_dict[file_name] = file_content
16
  return zip_content_dict
17