Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahau committed Feb 28, 2025
1 parent e29cf99 commit 8fa822b
Show file tree
Hide file tree
Showing 11 changed files with 6,399 additions and 434 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ venv.bak/
.Rproj.user
.Rhistory
/.Rhistory
.RData
.RData
/.quarto/
907 changes: 498 additions & 409 deletions 01 - The Garden of Forking Data.qmd

Large diffs are not rendered by default.

1,964 changes: 1,964 additions & 0 deletions 01 - The Garden of Forking Data.quarto_ipynb

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
project:
output-dir: notebook_output
type: website

author: "Abdullah Mahmood"

format:
html:
toc: true
toc-depth: 3
html-math-method:
method: mathjax
url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
editor: source
jupyter: main
Binary file added images/marble-conjecture-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/marble-tree-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/marble-tree-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/marble-tree-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 31 additions & 24 deletions init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import pandas as pd
import arviz as az
import utils as utils

from scipy import stats as stats
from matplotlib import pyplot as plt
import scipy.stats as stats
import matplotlib.pyplot as plt
import seaborn as sns
# ---

Expand All @@ -16,40 +15,48 @@
lines = f.readlines()

from colorama import Fore
import re

def print_import(import_line):
if len(import_line.strip()) > 1:
parts = [p for p in import_line.split(" ") if p]
if parts[0] == 'import':
module = parts[1]
alias = parts[3]
msg = Fore.GREEN + 'import' \
+ Fore.BLUE + f" {module} " \
+ Fore.GREEN + "as" \
+ Fore.BLUE + f" {alias}"
elif parts[0] == 'from':
module = parts[1]
submodule = parts[3]
alias = parts[5]
msg = Fore.GREEN + 'from' \
+ Fore.BLUE + f" {module} "\
+ Fore.GREEN + 'import' \
+ Fore.BLUE + f" {submodule} " \
+ Fore.GREEN + "as" \
+ Fore.BLUE + f" {alias}"
import_line = import_line.strip()
if not import_line or not (import_line.startswith("import") or import_line.startswith("from")):
return # Skip non-import lines

# Regular expressions for parsing imports
import_regex = re.compile(r"import\s+([\w.]+)(?:\s+as\s+(\w+))?")
from_import_regex = re.compile(r"from\s+([\w.]+)\s+import\s+([\w.*]+)(?:\s+as\s+(\w+))?")

# Match `import` statements
match_import = import_regex.match(import_line)
if match_import:
module, alias = match_import.groups()
msg = Fore.GREEN + "import " + Fore.BLUE + module
if alias:
msg += Fore.GREEN + " as " + Fore.BLUE + alias
print(msg)
return

print(Fore.RED + f"Module aliases imported by init_notebook.py:\n{'-'* 44}")
# Match `from ... import` statements
match_from_import = from_import_regex.match(import_line)
if match_from_import:
module, submodule, alias = match_from_import.groups()
msg = Fore.GREEN + "from " + Fore.BLUE + module + Fore.GREEN + " import " + Fore.BLUE + submodule
if alias:
msg += Fore.GREEN + " as " + Fore.BLUE + alias
print(msg)

print(Fore.RED + f"Module aliases imported by init_notebook.py:\n{'-'*44}")
for l in lines:
if "# ---" in l:
break
print_import(l)

from watermark import watermark # noqa: E402
print()
print(Fore.RED + f"Watermark:\n{'-'* 10}")
print(Fore.BLUE + watermark())
print(Fore.BLUE + watermark(iversions=True, globals_=globals()))


import warnings # noqa: E402
warnings.filterwarnings("ignore")

Expand Down
Loading

0 comments on commit 8fa822b

Please sign in to comment.