Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
mursalatul committed Jan 23, 2024
1 parent 385ac51 commit 4e9f746
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 177 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/update_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
with:
python-version: 3.12.1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ADMIN/MAINTAIN/REQUIREMENTS.txt
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r REQUIREMENTS.txt

- name: Run ADMIN/MAINTAIN/UPDATE_DOC.py
run: python ADMIN/MAINTAIN/UPDATE_DOC.py
- name: Run UPDATE_DOC.py
run: python UPDATE_DOC.py

- name: Commit and push changes
run: |
Expand Down
17 changes: 0 additions & 17 deletions ADMIN/MAINTAIN/DOCUMENTATION.md

This file was deleted.

27 changes: 0 additions & 27 deletions ADMIN/MAINTAIN/DOC_DATA.json

This file was deleted.

Empty file removed ADMIN/MAINTAIN/REQUIREMENTS.txt
Empty file.
27 changes: 0 additions & 27 deletions ADMIN/MAINTAIN/UPDATE_DOC.py

This file was deleted.

23 changes: 0 additions & 23 deletions ADMIN/MAINTAIN/classes/Documentation.py

This file was deleted.

31 changes: 0 additions & 31 deletions ADMIN/MAINTAIN/classes/handle_json.py

This file was deleted.

File renamed without changes.
23 changes: 0 additions & 23 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
# Code Park Documentation
This documentation provides a front view of the content presented in the repository. Here, you can see the folders and the files with a tree-view structure.

## Content
- [ERROR](https://github.com/mursalatul/code-park/tree/master/ERROR)
- [-](https://github.com/mursalatul/code-park/tree/master/ERROR/-)
- [name](https://github.com/mursalatul/code-park/tree/master/name)
- [c](https://github.com/mursalatul/code-park/tree/master/name/c)
- [o](https://github.com/mursalatul/code-park/tree/master/name/o)
- [d](https://github.com/mursalatul/code-park/tree/master/name/d)
- [e](https://github.com/mursalatul/code-park/tree/master/name/e)
- [-](https://github.com/mursalatul/code-park/tree/master/name/-)
- [p](https://github.com/mursalatul/code-park/tree/master/name/p)
- [a](https://github.com/mursalatul/code-park/tree/master/name/a)
- [r](https://github.com/mursalatul/code-park/tree/master/name/r)
- [k](https://github.com/mursalatul/code-park/tree/master/name/k)
- [target](https://github.com/mursalatul/code-park/tree/master/target)
- [f](https://github.com/mursalatul/code-park/tree/master/target/f)
- [o](https://github.com/mursalatul/code-park/tree/master/target/o)
- [l](https://github.com/mursalatul/code-park/tree/master/target/l)
- [d](https://github.com/mursalatul/code-park/tree/master/target/d)
- [e](https://github.com/mursalatul/code-park/tree/master/target/e)
- [r](https://github.com/mursalatul/code-park/tree/master/target/r)
44 changes: 22 additions & 22 deletions DOC_DATA.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"ERROR": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/ERROR",
"-": "https://github.com/mursalatul/code-park/tree/master/ERROR/-"
"hello_diu": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/hello_diu",
"hello_diu.c": "https://github.com/mursalatul/code-park/tree/master/hello_diu/hello_diu.c"
},
"target": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/target",
"f": "https://github.com/mursalatul/code-park/tree/master/target/f",
"o": "https://github.com/mursalatul/code-park/tree/master/target/o",
"l": "https://github.com/mursalatul/code-park/tree/master/target/l",
"d": "https://github.com/mursalatul/code-park/tree/master/target/d",
"e": "https://github.com/mursalatul/code-park/tree/master/target/e",
"r": "https://github.com/mursalatul/code-park/tree/master/target/r"
"palindrom": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/palindrom",
"is_palindrom_number.c": "https://github.com/mursalatul/code-park/tree/master/palindrom/is_palindrom_number.c"
},
"name": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/name",
"c": "https://github.com/mursalatul/code-park/tree/master/name/c",
"o": "https://github.com/mursalatul/code-park/tree/master/name/o",
"d": "https://github.com/mursalatul/code-park/tree/master/name/d",
"e": "https://github.com/mursalatul/code-park/tree/master/name/e",
"-": "https://github.com/mursalatul/code-park/tree/master/name/-",
"p": "https://github.com/mursalatul/code-park/tree/master/name/p",
"a": "https://github.com/mursalatul/code-park/tree/master/name/a",
"r": "https://github.com/mursalatul/code-park/tree/master/name/r",
"k": "https://github.com/mursalatul/code-park/tree/master/name/k"
"prime": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/prime",
"is_prime.cpp": "https://github.com/mursalatul/code-park/tree/master/prime/is_prime.cpp"
},
"search": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/search",
"binary_search.cpp": "https://github.com/mursalatul/code-park/tree/master/search/binary_search.cpp",
"linear_search.cpp": "https://github.com/mursalatul/code-park/tree/master/search/linear_search.cpp"
},
"selection_sort": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/selection_sort",
"selection_sort_cpp.cpp": "https://github.com/mursalatul/code-park/tree/master/selection_sort/selection_sort_cpp.cpp"
},
"prefix_sum": {
"folder_url": "https://github.com/mursalatul/code-park/tree/master/prefix_sum",
"prefix_sum.cpp": "https://github.com/mursalatul/code-park/tree/master/prefix_sum/prefix_sum.cpp"
}
}
78 changes: 77 additions & 1 deletion ADMIN/MAINTAIN/classes/Files.py → UPDATE_DOC.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
import os, json


class HandleJson:
# reformat data as actual json format
def add_link(self):
self.dic = {
# "folder_number" : f"{len(self.data)}",
# "folder1" : {
# "folder1_url" : "",
# "file_number" : "",
# "file1" : "file1 url",
# "file2" : "file2 url"
# },
}

for folder, file in self.data.items():
inner_dic = dict()
inner_dic["folder_url"] = "https://github.com/mursalatul/code-park/tree/master/" + folder
#inner_dic["file_number"] = f"{len(file)}"
# sort is working locally but is not working in github action. will fix it later
# file.sort()
for f in file:
inner_dic[f] = inner_dic["folder_url"] + f"/{f}"
self.dic[folder] = inner_dic


def write_json(self, data):
self.data = data
self.add_link()
with open("DOC_DATA.json", "w") as outfile:
json.dump(self.dic, outfile, indent=4)


class CreateDocumentation:
def writedoc(self, folder_file: dict):

with open("DOCUMENTATION.md", "w") as doc:
doc.write("# Code Park Documentation\n\
This documentation provides a front view of the content presented in the repository. Here, you can see the folders and the files with a tree-view structure.\n\n")

doc.write("## Content\n")

# sorting the folders before adding to doc
folder_file = dict(sorted(folder_file.items()))

# getting folder name and file list
for folder, file in folder_file.items():
# writing folder name to doc
doc.write(f"- [{folder}](https://github.com/mursalatul/code-park/tree/master/{folder})\n")
# sorting the files for organized view in doc
#file.sort()
# adding the file names
for files in file:
doc.write(f" - [{files}](https://github.com/mursalatul/code-park/tree/master/{folder}/{files})\n")


class Files:
# this char will not accepted inside a class
RESTRICTED_CHAR = [".", "-", "!", "@", "#", "$", "%", "^", "&", "*",
Expand Down Expand Up @@ -113,4 +168,25 @@ def goodfolderformat(self, folder_name: str) -> dict:
return {"status" : "ignore_folder"}
else:
return self.isgoodname(folder_name)




def main():
# getting repository location
cwd = os.getcwd()

# getting file data
ff = Files()
data = (ff.get_all_valid_folder_files_dict(cwd))
print(data)

# writing to Documentation.md
doc = CreateDocumentation()
doc.writedoc(data) # documentation will be written in the repo home

# updating the json file
mjson = HandleJson()
mjson.write_json(data)

if __name__ == '__main__':
main()
File renamed without changes.

0 comments on commit 4e9f746

Please sign in to comment.