Skip to content

Commit

Permalink
pls directory
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed Jun 10, 2024
1 parent cee82e6 commit 8415887
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import time
import os
from io import StringIO
import sys
import pandas as pd
import nltk
import os
Expand Down Expand Up @@ -77,28 +79,37 @@ def upload_file():

@app.route('/get-classifiers', methods=["GET"])
def get_classifiers():
#print(build_tree('../..'))
print(build_tree('../../..'))
classifiers = get_available_classifiers()
return jsonify(classifiers)

def build_tree(directory, indent=''):
def build_tree(directory, indent='', d=0):
"""
Recursively build directory tree structure as a string.
"""
if d == 2:
return ''

tree = indent + os.path.basename(directory) + '/' + '\n'
indent += ' '
try:
for item in os.listdir(directory):
if item != 'node_modules' and item != 'dist' and item != 'venv' and item != '.git':
item_path = os.path.join(directory, item)
# try:
# fake_stdout = StringIO()
# sys.stdout = fake_stdout
# print(item)
# sys.stdout = sys.__stdout__
# except:
# for char in item:
# byte_value = ord(char)
# print(hex(byte_value), end=' ')
if os.path.isdir(item_path):
try:
tree += build_tree(item_path, indent)
except PermissionError as e:
print(f"Permission error: {e}")
tree += build_tree(item_path, indent, d + 1)
else:
tree += indent + item + '\n'
except PermissionError as e:
except:
pass
return tree

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "TailLinguifAI",
"email": ""
},
"version": "0.1.4",
"version": "0.3.5",
"main": "./public/electron.js",
"homepage": "./",
"private": true,
Expand Down

0 comments on commit 8415887

Please sign in to comment.