Skip to content

Commit d921c41

Browse files
authored
add new function to library and init
1 parent 2401d60 commit d921c41

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

PDL/package/pdlparse/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#https://www.freecodecamp.org/news/build-your-first-python-package/
22
from parse import scrap_library, get_variable, filter_file, get_strings, get_class, get_type, get_value, get_comments
3-
from library import get_libs, get_lib_info, get_main_lib, read_lib, format_lib, remove_comments
3+
from library import get_libs, get_lib_info, get_main_lib, read_lib, format_lib, rm_library, remove_comments
44
from new import create_lib, create_lib_script, create_manifest

PDL/package/pdlparse/library.py

+11
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ def format_lib(library):
133133
pass
134134

135135

136+
def rm_library(library):
137+
# Burry the library 6-feet under. (delete it)
138+
if not os.path.exists(library):
139+
raise FileNotFoundError(f'ERROR: Package pdlparse cannot find file {library}.')
140+
141+
try:
142+
os.remove(library)
143+
except Exception as e:
144+
raise Exception(f'ERROR: An unknown error occurred during runtime \n{e}\n')
145+
146+
136147
def remove_comments(library):
137148
# Removes all comments from a library
138149
if not os.path.exists(library):

0 commit comments

Comments
 (0)