Spaces:
Sleeping
Sleeping
stefanches7
commited on
Commit
·
cd91161
1
Parent(s):
9887d83
remove redundant arg
Browse files
extract_dir_structure_xml.py
CHANGED
|
@@ -2,8 +2,6 @@ import sys
|
|
| 2 |
from pathlib import Path
|
| 3 |
import xml.etree.ElementTree as ET
|
| 4 |
|
| 5 |
-
FOLDER_LOCATION = sys.argv[1] if len(sys.argv) > 1 else "sample_dataset"
|
| 6 |
-
|
| 7 |
def build_xml(dir_path: Path, root_level: bool = True) -> ET.Element:
|
| 8 |
"""
|
| 9 |
Recursively build the XML tree.
|
|
@@ -43,7 +41,7 @@ def indent(elem: ET.Element, level: int = 0) -> None:
|
|
| 43 |
if level and (not elem.tail or not elem.tail.strip()):
|
| 44 |
elem.tail = i
|
| 45 |
|
| 46 |
-
def main(directory: str =
|
| 47 |
path = Path(directory)
|
| 48 |
if not path.is_dir():
|
| 49 |
print(f"Error: '{directory}' is not a directory.", file=sys.stderr)
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
import xml.etree.ElementTree as ET
|
| 4 |
|
|
|
|
|
|
|
| 5 |
def build_xml(dir_path: Path, root_level: bool = True) -> ET.Element:
|
| 6 |
"""
|
| 7 |
Recursively build the XML tree.
|
|
|
|
| 41 |
if level and (not elem.tail or not elem.tail.strip()):
|
| 42 |
elem.tail = i
|
| 43 |
|
| 44 |
+
def main(directory: str = "sample_dataset") -> None:
|
| 45 |
path = Path(directory)
|
| 46 |
if not path.is_dir():
|
| 47 |
print(f"Error: '{directory}' is not a directory.", file=sys.stderr)
|