Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,7 @@ package-lock.json
geckodriver.log

# bundler
vendor
vendor

# dotenv files
*.env
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"python.linting.pylintEnabled": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": false,
"python.linting.enabled": true,
"python.linting.pylamaEnabled": true,
}
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ development life-cycle: planning, development, testing, implementation and maint

Lectures will contain a mixture of content form this site and others.

1. [Week 01](lectures/lectures.md) - Language basics, Generating Data, Storing Data
1. [Week 02](lectures/lectures.md) - Processing files, Making Web Requests
1. [Week 03](lectures/lectures.md) - Functions, Loops, Comprehensions and Generators
1. [Week 04](lectures/lectures.md) - Data Processing and Visualization Part 1
1. [Week 05](lectures/lectures.md) - Data Processing and Visualization Part 2
1. [Week 06](lectures/lectures.md) - Web Scraping

## Quizzes

Expand Down
12 changes: 6 additions & 6 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
remote_theme: "pmarsceill/just-the-docs"
search_enabled: true
search_enabled: false
locale: "en-US"
title: "Data Focused Python"
repository: "BrianKolowitz/data-focused-python"
ga_tracking: UA-139655036-1
aux_links:
"Code":
- "//github.com/BrianKolowitz/data-focused-python"
"About":
- "/data-focused-python/about.html"
# aux_links:
# "Code":
# - "//github.com/BrianKolowitz/data-focused-python"
# "About":
# - "/data-focused-python/about.html"
6 changes: 0 additions & 6 deletions _exclude/02-lectures.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,3 @@

Lectures will contain a mixture of content form this site and others.

1. [Week 01](lectures/lectures.md) - Language basics, Generating Data, Storing Data
1. [Week 02](lectures/lectures.md) - Processing files, Making Web Requests
1. [Week 03](lectures/lectures.md) - Functions, Loops, Comprehensions and Generators
1. [Week 04](lectures/lectures.md) - Data Processing and Visualization Part 1
1. [Week 05](lectures/lectures.md) - Data Processing and Visualization Part 2
1. [Week 06](lectures/lectures.md) - Web Scraping
34 changes: 17 additions & 17 deletions _exclude/build-lecture-toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

lecture_toc_md = []
lecture_root = "../lectures"
weeks = [week for week in os.listdir(lecture_root) if week.lower().startswith('week') and not week.lower().endswith('.md')]
weeks.sort()
topics = [topic for topic in os.listdir(lecture_root) if topic.lower().startswith('topic') and not topic.lower().endswith('.md')]
topics.sort()
lecture_toc_title = "Lectures"
lecture_toc_md.append("---")
lecture_toc_md.append("layout: default")
Expand All @@ -21,40 +21,40 @@
lecture_toc_md.append("---")
# lecture_toc_md.append("")

week_nav_order = 1
topic_nav_order = 1
# todo : delete all md files
for week_title in weeks:
week_path = os.path.join(lecture_root, week_title)
for topic_title in topics:
topic_path = os.path.join(lecture_root, topic_title)
lecture_toc_md.append("")
lecture_toc_md.append(f"## {week_title}")
lecture_toc_md.append(f"## {topic_title}")
lecture_toc_md.append("")
with open(week_path + '.md', 'w') as week_file:
week_md = [
with open(topic_path + '.md', 'w') as topic_file:
topic_md = [
f"---",
f"layout: default",
f"title: {week_title}",
f"title: {topic_title}",
f"parent: {lecture_toc_title}",
f"has_children: true",
f"nav_order: {week_nav_order}",
f"nav_order: {topic_nav_order}",
f"---",
f"",
]
week_file.write('\n'.join(week_md))
week_nav_order += 1
topic_file.write('\n'.join(topic_md))
topic_nav_order += 1

files = os.listdir(week_path)
files = os.listdir(topic_path)
files = [file for file in files if file.endswith('.md')]
files.sort()
file_nav_order = 1
for file in files:
lecture_md_path = os.path.join(week_title, file)
lecture_md_path = os.path.join(topic_title, file)

# todo : figure out why this broke
ipynb_root = "https://github.com/BrianKolowitz/data-focused-python/blob/master/lectures"
ipynb_route = os.path.join(week_title, file[:-3] + ".ipynb")
ipynb_route = os.path.join(topic_title, file[:-3] + ".ipynb")
ipynb_route = urllib.parse.quote(ipynb_route)
lecture_ipynb_path = os.path.join(ipynb_root, ipynb_route)
# lecture_ipynb_path = os.path.join(week_path, file[:-3] + ".ipynb")
# lecture_ipynb_path = os.path.join(topic_path, file[:-3] + ".ipynb")
# lecture_md_path = urllib.parse.quote(md_path)
# lecture_ipynb_path = urllib.parse.quote(lecture_ipynb_path)
lecture_toc_md.append(f"* [{Path(file).resolve().stem.title()}]({lecture_md_path}) \([ipynb]({lecture_ipynb_path})\)")
Expand All @@ -65,7 +65,7 @@
f"---",
f"layout: default",
f"title: {file[:-3]}",
f"parent: {week_title}",
f"parent: {topic_title}",
f"grand_parent: {lecture_toc_title}",
f"nav_order: {file_nav_order}",
f"---",
Expand Down
2 changes: 1 addition & 1 deletion _site/about.html

Large diffs are not rendered by default.

205 changes: 51 additions & 154 deletions _site/assets/js/just-the-docs.js
Original file line number Diff line number Diff line change
@@ -1,176 +1,73 @@
(function (jtd, undefined) {

// Event handling

function addEvent(el, type, handler) {
if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
jtd.addEvent = function(el, type, handler) {
if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
}
function removeEvent(el, type, handler) {
if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
jtd.removeEvent = function(el, type, handler) {
if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
}

// Show/hide mobile menu

function toggleNav(){
const nav = document.querySelector('.js-main-nav');
const auxNav = document.querySelector('.js-aux-nav');
const navTrigger = document.querySelector('.js-main-nav-trigger');
const search = document.querySelector('.js-search');

addEvent(navTrigger, 'click', function(){
var text = navTrigger.innerText;
var textToggle = navTrigger.getAttribute('data-text-toggle');

nav.classList.toggle('nav-open');
auxNav.classList.toggle('nav-open');
navTrigger.classList.toggle('nav-open');
search.classList.toggle('nav-open');
navTrigger.innerText = textToggle;
navTrigger.setAttribute('data-text-toggle', text);
textToggle = text;
})
jtd.onReady = function(ready) {
// in case the document is already rendered
if (document.readyState!='loading') ready();
// modern browsers
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
// IE <= 8
else document.attachEvent('onreadystatechange', function(){
if (document.readyState=='complete') ready();
});
}

// Site search
// Show/hide mobile menu

function initSearch() {
var index = lunr(function () {
this.ref('id');
this.field('title', { boost: 20 });
this.field('content', { boost: 10 });
this.field('url');
function initNav() {
jtd.addEvent(document, 'click', function(e){
var target = e.target;
while (target && !(target.classList && target.classList.contains('nav-list-expander'))) {
target = target.parentNode;
}
if (target) {
e.preventDefault();
target.parentNode.classList.toggle('active');
}
});

// Get the generated search_data.json file so lunr.js can search it locally.

sc = document.getElementsByTagName("script");
source = '';

for(idx = 0; idx < sc.length; idx++)
{
s = sc.item(idx);

if(s.src && s.src.match(/just-the-docs\.js$/))
{ source = s.src; }
}

jsPath = source.replace('just-the-docs.js', '');
const siteNav = document.getElementById('site-nav');
const mainHeader = document.getElementById('main-header');
const menuButton = document.getElementById('menu-button');

jsonPath = jsPath + 'search-data.json';
jtd.addEvent(menuButton, 'click', function(e){
e.preventDefault();

var request = new XMLHttpRequest();
request.open('GET', jsonPath, true);

request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
var data = JSON.parse(request.responseText);
var keys = Object.keys(data);

for(var i in data) {
index.add({
id: data[i].id,
title: data[i].title,
content: data[i].content,
url: data[i].url
});
}
searchResults(data);
if (menuButton.classList.toggle('nav-open')) {
siteNav.classList.add('nav-open');
mainHeader.classList.add('nav-open');
} else {
// We reached our target server, but it returned an error
console.log('Error loading ajax request. Request status:' + request.status);
siteNav.classList.remove('nav-open');
mainHeader.classList.remove('nav-open');
}
};

request.onerror = function() {
// There was a connection error of some sort
console.log('There was a connection error');
};

request.send();

function searchResults(dataStore) {
var searchInput = document.querySelector('.js-search-input');
var searchResults = document.querySelector('.js-search-results');
var store = dataStore;

function hideResults() {
searchResults.innerHTML = '';
searchResults.classList.remove('active');
}

addEvent(searchInput, 'keyup', function(e){
var query = this.value;

searchResults.innerHTML = '';
searchResults.classList.remove('active');

if (query === '') {
hideResults();
} else {
var results = index.search(query);

if (results.length > 0) {
searchResults.classList.add('active');
var resultsList = document.createElement('ul');
searchResults.appendChild(resultsList);

for (var i in results) {
var resultsListItem = document.createElement('li');
var resultsLink = document.createElement('a');
var resultsUrlDesc = document.createElement('span');
var resultsUrl = store[results[i].ref].url;
var resultsRelUrl = store[results[i].ref].relUrl;
var resultsTitle = store[results[i].ref].title;

resultsLink.setAttribute('href', resultsUrl);
resultsLink.innerText = resultsTitle;
resultsUrlDesc.innerText = resultsRelUrl;

resultsList.classList.add('search-results-list');
resultsListItem.classList.add('search-results-list-item');
resultsLink.classList.add('search-results-link');
resultsUrlDesc.classList.add('fs-2','text-grey-dk-000','d-block');

resultsList.appendChild(resultsListItem);
resultsListItem.appendChild(resultsLink);
resultsLink.appendChild(resultsUrlDesc);
}
}
});
}

// When esc key is pressed, hide the results and clear the field
if (e.keyCode == 27) {
hideResults();
searchInput.value = '';
}
}
});
// Switch theme

addEvent(searchInput, 'blur', function(){
setTimeout(function(){ hideResults() }, 300);
});
}
jtd.getTheme = function() {
var cssFileHref = document.querySelector('[rel="stylesheet"]').getAttribute('href');
return cssFileHref.substring(cssFileHref.lastIndexOf('-') + 1, cssFileHref.length - 4);
}

function pageFocus() {
var mainContent = document.querySelector('.js-main-content');
mainContent.focus();
jtd.setTheme = function(theme) {
var cssFile = document.querySelector('[rel="stylesheet"]');
cssFile.setAttribute('href', 'http://localhost:4000/assets/css/just-the-docs-' + theme + '.css');
}


// Document ready

function ready(){
toggleNav();
pageFocus();
if (typeof lunr !== 'undefined') {
initSearch();
}
}
jtd.onReady(function(){
initNav();
});

})(window.jtd = window.jtd || {});


// in case the document is already rendered
if (document.readyState!='loading') ready();
// modern browsers
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
// IE <= 8
else document.attachEvent('onreadystatechange', function(){
if (document.readyState=='complete') ready();
});
Loading