Skip to content

Commit

Permalink
Merge pull request #12 from yashksaini-coder/yash/fix-4
Browse files Browse the repository at this point in the history
Add Update structure workflow
  • Loading branch information
UTSAVS26 authored Oct 2, 2024
2 parents 9ecc2bc + 8e7d81e commit 908d0f7
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 21 deletions.
67 changes: 67 additions & 0 deletions .github/scripts/update_dir_structure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import os
import github
from github import Github

def get_repo_structure(path='.', prefix=''):
structure = []
items = sorted(os.listdir(path))
for i, item in enumerate(items):
if item.startswith('.'):
continue
item_path = os.path.join(path, item)
is_last = i == len(items) - 1
current_prefix = '└── ' if is_last else '├── '
structure.append(f"{prefix}{current_prefix}{item}")
if os.path.isdir(item_path):
next_prefix = prefix + (' ' if is_last else '│ ')
structure.extend(get_repo_structure(item_path, next_prefix))
return structure

def update_structure_file(structure):
with open('repo_structure.txt', 'w') as f:
f.write('\n'.join(structure))

def update_readme(structure):
with open('README.md', 'r') as f:
content = f.read()

start_marker = '<!-- START_STRUCTURE -->'
end_marker = '<!-- END_STRUCTURE -->'

start_index = content.find(start_marker)
end_index = content.find(end_marker)

if start_index != -1 and end_index != -1:
new_content = (
content[:start_index + len(start_marker)] +
'\n```\n' + '\n'.join(structure) + '\n```\n' +
content[end_index:]
)

with open('README.md', 'w') as f:
f.write(new_content)
print("README.md updated with new structure.")
else:
print("Markers not found in README.md. Structure not updated.")

def main():
g = Github(os.environ['GH_TOKEN'])
repo = g.get_repo(os.environ['GITHUB_REPOSITORY'])

current_structure = get_repo_structure()

try:
contents = repo.get_contents("repo_structure.txt")
existing_structure = contents.decoded_content.decode().split('\n')
except github.GithubException:
existing_structure = None

if current_structure != existing_structure:
update_structure_file(current_structure)
update_readme(current_structure)
print("Repository structure updated.")
else:
print("No changes in repository structure.")

if __name__ == "__main__":
main()
39 changes: 39 additions & 0 deletions .github/workflows/update-structure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Detect and Update Repo Structure

on:
schedule:
- cron: '0 * * * *' # Run every hour
workflow_dispatch: # Allow manual triggering
push:
branches:
- main
- yash/fix-4

jobs:
detect-and-update-structure:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: Run update script
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/scripts/update_dir_structure.py

- name: Commit and push if changed
run: |
git config --local user.email "115717039+yashksaini-coder@users.noreply.github.com"
git config --local user.name "yashksaini-coder"
git add .
git diff --quiet && git diff --staged --quiet || (git commit -m "Update repo structure" && git push)
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ venv/
etc/
Include/
Lib/
Scripts/

share/
pyvenv.cfg
__pycache__\
Expand Down
42 changes: 42 additions & 0 deletions Data_Science/Data-science.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Beginner's Guide to Data Science

## Introduction

Data Science is an interdisciplinary field that uses scientific methods, processes, algorithms, and systems to extract knowledge and insights from structured and unstructured data. It combines aspects of statistics, computer science, and domain expertise to analyze and interpret complex data.

### Why Data Science?

1. **Decision Making**: Helps in making informed decisions based on data analysis.
2. **Predictive Analysis**: Forecasts future trends and behaviors.
3. **Automation**: Automates repetitive tasks and processes.
4. **Innovation**: Drives innovation by uncovering hidden patterns and insights.

### Key Components

1. **Data Collection**: Gathering data from various sources.
2. **Data Cleaning**: Removing inconsistencies and errors from the data.
3. **Data Analysis**: Applying statistical and computational techniques to analyze data.
4. **Data Visualization**: Representing data in graphical formats for better understanding.
5. **Machine Learning**: Building models that can learn from data and make predictions.

### Tools and Technologies

- **Programming Languages**: Python, R
- **Libraries**: Pandas, NumPy, Scikit-Learn, TensorFlow
- **Visualization Tools**: Matplotlib, Seaborn, Tableau
- **Databases**: SQL, NoSQL

### Getting Started

1. **Learn Programming**: Start with Python or R.
2. **Understand Statistics**: Basic statistical concepts are crucial.
3. **Practice with Data Sets**: Use platforms like Kaggle to practice.
4. **Build Projects**: Apply your skills to real-world problems.

### Resources

- **Books**: "Python for Data Analysis" by Wes McKinney
- **Online Courses**: Coursera, edX, Udacity
- **Communities**: Stack Overflow, Reddit, Data Science Meetups

Data Science is a rapidly evolving field with vast opportunities. Start your journey today and explore the endless possibilities that data has to offer!
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,29 @@ The purpose of PyVerse is to provide a structured and accessible way for develop

The PyVerse repository is organized as follows:

<!-- START_STRUCTURE -->
```
PyVerse/
├── Web_Development/
├── Machine_Learning/
├── Data_Science/
├── Automation_Tools/
├── Game_Development/
├── Deep_Learning/
│ ├── NLP/
│ ├── Computer_Vision/
├── Cybersecurity_Tools/
├── Algorithms_and_Data_Structures/
│ ├── Sorting_Algorithms/
│ ├── Search_Algorithms/
│ ├── Data_Structures/
├── Beginner_Projects/
├── Advanced_Projects/
├── Tutorials/
├── CONTRIBUTING.md
├── README.md
├── Advanced_Projects
├── Algorithms_and_Data_Structures
├── Automation_Tools
├── Beginner_Projects
├── Blockchain_Development
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cybersecurity_Tools
├── Data_Science
│ └── Data-science.md
├── Deep_Learning
├── Game_Development
├── LICENSE
├── Machine_Learning
├── PROJECT-README-TEMPLATE.md
├── README.md
├── Tutorials
├── Web_Development
└── repo_structure.txt
```
<!-- END_STRUCTURE -->

---

Expand Down
19 changes: 19 additions & 0 deletions repo_structure.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
├── Advanced_Projects
├── Algorithms_and_Data_Structures
├── Automation_Tools
├── Beginner_Projects
├── Blockchain_Development
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cybersecurity_Tools
├── Data_Science
│ └── Data-science.md
├── Deep_Learning
├── Game_Development
├── LICENSE
├── Machine_Learning
├── PROJECT-README-TEMPLATE.md
├── README.md
├── Tutorials
├── Web_Development
└── repo_structure.txt

0 comments on commit 908d0f7

Please sign in to comment.