Skip to content

Commit 06aee84

Browse files
committed
cleanup
1 parent e763774 commit 06aee84

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

python_autocomplete/create_dataset.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from typing import Optional
1515

1616
import numpy as np
17-
1817
from labml import lab, monit
1918
from labml import logger
2019
from labml.internal.util import rm_tree
@@ -59,12 +58,10 @@ def _collect_python_files(path: Path):
5958

6059
_collect_python_files(source_path)
6160

62-
logger.inspect([f.path for f in files])
63-
6461
return files
6562

6663

67-
def _read_file(path: Path) -> str:
64+
def read_file(path: Path) -> str:
6865
"""
6966
Read a file
7067
"""
@@ -76,11 +73,11 @@ def _read_file(path: Path) -> str:
7673
return content
7774

7875

79-
def _load_code(path: PurePath, source_files: List[PythonFile]):
76+
def concat_and_save(path: PurePath, source_files: List[PythonFile]):
8077
with open(str(path), 'w') as f:
8178
for i, source in monit.enum(f"Write {path.name}", source_files):
8279
f.write(f"# PROJECT: {source.project} FILE: {str(source.relative_path)}\n")
83-
f.write(_read_file(source.path) + "\n")
80+
f.write(read_file(source.path) + "\n")
8481

8582

8683
def get_repos_from_readme(filename: str):
@@ -227,8 +224,8 @@ def main():
227224
logger.inspect(source_files)
228225

229226
train_valid_split = int(len(source_files) * 0.9)
230-
_load_code(lab.get_data_path() / 'train.py', source_files[:train_valid_split])
231-
_load_code(lab.get_data_path() / 'valid.py', source_files[train_valid_split:])
227+
concat_and_save(lab.get_data_path() / 'train.py', source_files[:train_valid_split])
228+
concat_and_save(lab.get_data_path() / 'valid.py', source_files[train_valid_split:])
232229

233230

234231
if __name__ == '__main__':

setup.py

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

66
setuptools.setup(
77
name='labml_python_autocomplete',
8-
version='0.0.1',
8+
version='0.0.3',
99
author="Varuna Jayasiri",
1010
author_email="vpjayasiri@gmail.com",
1111
description="A simple model that learns to predict Python source code",

0 commit comments

Comments
 (0)