Skip to content

Commit

Permalink
Sphinx Folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mail4umar committed Nov 8, 2023
1 parent 1e76533 commit d8a9796
Show file tree
Hide file tree
Showing 278 changed files with 235,587 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
118 changes: 118 additions & 0 deletions docs/Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "b0c2ea98-0dd8-4bea-8374-239d052b468d",
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'verticapy.vDataFrame'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn [3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mverticapy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvDataFrame\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mvdf\u001b[39;00m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'verticapy.vDataFrame'"
]
}
],
"source": [
"import verticapy as vp"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "0137cfbf-c6da-4567-b1b6-adb2d05b2f52",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function verticapy.core.vdataframe._plotting.vDFPlot.bar(self, columns: Annotated[Union[str, list[str]], 'STRING representing one column or a list of columns'], method: Union[Literal['density', 'count', 'avg', 'min', 'max', 'sum'], str] = 'density', of: Optional[str] = None, max_cardinality: tuple[int, int] = (6, 6), h: tuple[typing.Annotated[typing.Union[int, float, decimal.Decimal], 'Python Numbers'], typing.Annotated[typing.Union[int, float, decimal.Decimal], 'Python Numbers']] = (None, None), kind: Literal['auto', 'drilldown', 'stacked'] = 'auto', chart: Union[ForwardRef('PlottingBase'), ForwardRef('TableSample'), ForwardRef('Axes'), ForwardRef('mFigure'), ForwardRef('Highchart'), ForwardRef('Highstock'), ForwardRef('Figure'), NoneType] = None, **style_kwargs) -> Union[ForwardRef('PlottingBase'), ForwardRef('TableSample'), ForwardRef('Axes'), ForwardRef('mFigure'), ForwardRef('Highchart'), ForwardRef('Highstock'), ForwardRef('Figure')]>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vp.vDataFrame.bar"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "52ea5850-b1b8-4252-b3a0-8f7327a1a0b9",
"metadata": {},
"outputs": [
{
"ename": "AttributeError",
"evalue": "module 'verticapy' has no attribute 'vDataColumn'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn [5], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mvp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvDataColumn\u001b[49m\u001b[38;5;241m.\u001b[39mbar\n",
"\u001b[0;31mAttributeError\u001b[0m: module 'verticapy' has no attribute 'vDataColumn'"
]
}
],
"source": [
"vp.vDataColumn.bar"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "865dcddb-1f60-4fdc-9959-f558e209a90c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0m\u001b[01;32mMakefile\u001b[0m* \u001b[34;42mbuild\u001b[0m/ \u001b[34;42mouts\u001b[0m/ replace_sphinx_dir.py\n",
"Untitled.ipynb \u001b[34;42mfigures\u001b[0m/ \u001b[01;32mrefresh.sh\u001b[0m* \u001b[01;32mrequirements.txt\u001b[0m*\n",
"\u001b[34;42m_templates\u001b[0m/ \u001b[01;32mmake.bat\u001b[0m* remove_pattern.py \u001b[34;42msource\u001b[0m/\n"
]
}
],
"source": [
"ls"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "68525c56-af78-4288-8f46-d374b10e58c4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
43 changes: 43 additions & 0 deletions docs/fix_logo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import re

# Function to find and store logo_loc value
def find_logo_loc(content):
img_pattern = re.compile(r'<img class="sidebar-logo" src=[\'"]([^\'"]+)[\'"][^>]*>')
match = img_pattern.search(content)
if match:
logo_loc = match.group(1)
return logo_loc
return None

# Function to replace src in img tag
def replace_src(img_tag, new_src):
img_pattern = re.compile(r'<img[^>]*src=[\'"][^\'"]+[\'"][^>]*alt=[\'"]Clickable Image[\'"][^>]*style=[\'"]width:[^\'"]+; min-width:[^\'"]+[\'"][^>]*>')
modified_img_tag = img_pattern.sub(f'<img src="{new_src}" alt="Clickable Image" style="width:200px; min-width:200px">', img_tag)
return modified_img_tag


# Directory to search HTML files in
search_directory = 'build/'

# Iterate through all HTML files in the directory and its subdirectories
for root, _, files in os.walk(search_directory):
for filename in files:
if filename.endswith('.html'):
file_path = os.path.join(root, filename)
with open(file_path, 'r') as f:
content = f.read()

# Find the logo_loc value
logo_loc = find_logo_loc(content)
if logo_loc:
# Find and replace the src attribute
modified_content = replace_src(content, logo_loc)

# Write the modified content back to the same file
with open(file_path, 'w') as f:
f.write(modified_content)

print(f"Fixed logo src in {file_path}")

print("Logo src fix complete.")
37 changes: 37 additions & 0 deletions docs/fix_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os

# Function to modify HTML content
def modify_html_content(html_content, search_loc):
action_start = "class='sidebar-search-container sidebar-search-container_top' method='get' action='"
action_end = "'"
action_index_start = html_content.find(action_start)
action_index_end = html_content.find(action_end, action_index_start + len(action_start))
new_action_value = action_start + search_loc + action_end
modified_html_content = html_content[:action_index_start] + new_action_value + html_content[action_index_end+len(action_end):]
return modified_html_content

# Search pattern for extracting URL value
search_title_start = 'title="Search" href="'
search_title_end = '"'

# Iterate through all HTML files in 'build/' directory and its subdirectories
for root, _, files in os.walk('build/'):
for filename in files:
if filename.endswith('.html'):
file_path = os.path.join(root, filename)
with open(file_path, 'r') as f:
html_content = f.read()

search_title_index_start = html_content.find(search_title_start)
if search_title_index_start != -1:
search_title_index_end = html_content.find(search_title_end, search_title_index_start + len(search_title_start))
search_loc = html_content[search_title_index_start + len(search_title_start):search_title_index_end]
modified_content = modify_html_content(html_content, search_loc)

# Write the modified content back to the file
with open(file_path, 'w') as f:
f.write(modified_content)

print(f"Modified HTML content in {file_path}")
else:
print(f"No modification needed in {file_path}")
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
31 changes: 31 additions & 0 deletions docs/refresh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Uninstall verticapy
echo y | pip uninstall verticapy

# Execute replace_sphinx_dir.py script
python3 replace_sphinx_dir.py

# Install the package
pip install ../.

# Clean the build directory
make clean

# Build HTML documentation
make html

# Execute remove_pattern.py script
python3 remove_pattern.py

# Fix search directory for top nav bar
python3 fix_search.py

# Fix logo for top nav bar
python3 fix_logo.py

# Reverse replace_sphinx_dir.py script
python3 reverse_replace_sphinx_dir.py

# Run Blck
black ../.
32 changes: 32 additions & 0 deletions docs/remove_pattern.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3

import os
import re

# Get the directory where the script is located
script_dir = os.path.dirname(__file__)

# Define the directory path to start the search
start_dir = os.path.join(script_dir,'build', 'html')

# Regular expression pattern to find occurrences
pattern_to_find = r'html">verticapy\.'

# Walk through the directory and subdirectories
for root, _, files in os.walk(start_dir):
for filename in files:
if filename.endswith('.html'):
file_path = os.path.join(root, filename)

# Read the content of the HTML file
with open(file_path, 'r') as file:
content = file.read()

# Use regular expression to remove occurrences
modified_content = re.sub(pattern_to_find, 'html">', content)

# Write the modified content back to the file
with open(file_path, 'w') as file:
file.write(modified_content)

print(f"Modified: {file_path}")
28 changes: 28 additions & 0 deletions docs/replace_sphinx_dir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os

# Define the directory to search in
search_directory = "../"

# Define the word to search for and the replacement
search_word = "SPHINX_DIRECTORY"
replacement_word = "/project/data/VerticaPy/docs"

# Function to search and replace within a file
def search_replace_in_file(file_path):
with open(file_path, "r") as file:
content = file.read()
updated_content = content.replace(search_word, replacement_word)

with open(file_path, "w") as file:
file.write(updated_content)

# Recursively search for Python files and perform the search and replace
for root, dirs, files in os.walk(search_directory):
for file in files:
if file.endswith(".py"):
file_path = os.path.join(root, file)
search_replace_in_file(file_path)
print(f"Updated: {file_path}")

print("Search and replace complete.")

15 changes: 15 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
numpy
pandas
matplotlib
sphinx
ipython
furo
nbsphinx
plotly
sphinx_inline_tabs
sphinx-plotly-directive
sphinx_design
geopandas
graphviz
pandoc
black
27 changes: 27 additions & 0 deletions docs/reverse_replace_sphinx_dir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

# Define the directory to search in
search_directory = "../"

# Define the word to search for and the replacement
search_word = "/project/data/VerticaPy/docs"
replacement_word = "SPHINX_DIRECTORY"

# Function to search and replace within a file
def search_replace_in_file(file_path):
with open(file_path, "r") as file:
content = file.read()
updated_content = content.replace(search_word, replacement_word)

with open(file_path, "w") as file:
file.write(updated_content)

# Recursively search for Python files and perform the search and replace
for root, dirs, files in os.walk(search_directory):
for file in files:
if file.endswith(".py"):
file_path = os.path.join(root, file)
search_replace_in_file(file_path)
print(f"Updated: {file_path}")

print("Search and replace complete.")
Loading

0 comments on commit d8a9796

Please sign in to comment.