Skip to content

Commit

Permalink
ran black on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
johnzastrow committed Oct 2, 2018
1 parent 21ece89 commit fd396ba
Show file tree
Hide file tree
Showing 15 changed files with 1,299 additions and 1,398 deletions.
141 changes: 61 additions & 80 deletions Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -1,82 +1,63 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"https://www.dataquest.io/blog/python-pandas-databases/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hi\n"
]
}
],
"source": [
"print(\"Hi\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": ["https://www.dataquest.io/blog/python-pandas-databases/"],
},
{"cell_type": "markdown", "metadata": {}, "source": []},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [],
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [{"name": "stdout", "output_type": "stream", "text": ["Hi\n"]}],
"source": ['print("Hi")'],
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [],
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [],
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [],
},
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.4",
},
},
"nbformat": 4,
"nbformat_minor": 2,
}
133 changes: 65 additions & 68 deletions Untitled1.ipynb
Original file line number Diff line number Diff line change
@@ -1,70 +1,67 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already up-to-date: pip in /home/jcz/anaconda3/lib/python3.6/site-packages\n",
"Requirement already satisfied: selenium in /home/jcz/anaconda3/lib/python3.6/site-packages\n",
"Requirement already satisfied: pylint in /home/jcz/anaconda3/lib/python3.6/site-packages\n",
"Requirement already satisfied: astroid<2.0,>=1.6 in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: six in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: isort>=4.2.5 in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: mccabe in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: lazy_object_proxy in /home/jcz/anaconda3/lib/python3.6/site-packages (from astroid<2.0,>=1.6->pylint)\n",
"Requirement already satisfied: wrapt in /home/jcz/anaconda3/lib/python3.6/site-packages (from astroid<2.0,>=1.6->pylint)\n",
"Collecting flake8\n",
" Downloading flake8-3.5.0-py2.py3-none-any.whl (69kB)\n",
"\u001b[K 100% |████████████████████████████████| 71kB 693kB/s \n",
"\u001b[?25hRequirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/jcz/anaconda3/lib/python3.6/site-packages (from flake8)\n",
"Requirement already satisfied: pyflakes<1.7.0,>=1.5.0 in /home/jcz/anaconda3/lib/python3.6/site-packages (from flake8)\n",
"Requirement already satisfied: pycodestyle<2.4.0,>=2.0.0 in /home/jcz/anaconda3/lib/python3.6/site-packages (from flake8)\n",
"Installing collected packages: flake8\n",
"Successfully installed flake8-3.5.0\n"
]
}
],
"source": [
"# Install a pip package in the current Jupyter kernel\n",
"import sys\n",
"!{sys.executable} -m pip install --upgrade pip\n",
"!{sys.executable} -m pip install selenium\n",
"!{sys.executable} -m pip install pylint\n",
"!{sys.executable} -m pip install flake8"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already up-to-date: pip in /home/jcz/anaconda3/lib/python3.6/site-packages\n",
"Requirement already satisfied: selenium in /home/jcz/anaconda3/lib/python3.6/site-packages\n",
"Requirement already satisfied: pylint in /home/jcz/anaconda3/lib/python3.6/site-packages\n",
"Requirement already satisfied: astroid<2.0,>=1.6 in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: six in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: isort>=4.2.5 in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: mccabe in /home/jcz/anaconda3/lib/python3.6/site-packages (from pylint)\n",
"Requirement already satisfied: lazy_object_proxy in /home/jcz/anaconda3/lib/python3.6/site-packages (from astroid<2.0,>=1.6->pylint)\n",
"Requirement already satisfied: wrapt in /home/jcz/anaconda3/lib/python3.6/site-packages (from astroid<2.0,>=1.6->pylint)\n",
"Collecting flake8\n",
" Downloading flake8-3.5.0-py2.py3-none-any.whl (69kB)\n",
"\u001b[K 100% |████████████████████████████████| 71kB 693kB/s \n",
"\u001b[?25hRequirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/jcz/anaconda3/lib/python3.6/site-packages (from flake8)\n",
"Requirement already satisfied: pyflakes<1.7.0,>=1.5.0 in /home/jcz/anaconda3/lib/python3.6/site-packages (from flake8)\n",
"Requirement already satisfied: pycodestyle<2.4.0,>=2.0.0 in /home/jcz/anaconda3/lib/python3.6/site-packages (from flake8)\n",
"Installing collected packages: flake8\n",
"Successfully installed flake8-3.5.0\n",
],
}
],
"source": [
"# Install a pip package in the current Jupyter kernel\n",
"import sys\n",
"!{sys.executable} -m pip install --upgrade pip\n",
"!{sys.executable} -m pip install selenium\n",
"!{sys.executable} -m pip install pylint\n",
"!{sys.executable} -m pip install flake8",
],
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [],
},
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.4",
},
},
"nbformat": 4,
"nbformat_minor": 2,
}
8 changes: 4 additions & 4 deletions age.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import datetime

print('Tell us when you were born: ')
year = int(input('Year [YYYY]: '))
month = int(input('Month [MM]: '))
day = int(input('Day [DD]: '))
print("Tell us when you were born: ")
year = int(input("Year [YYYY]: "))
month = int(input("Month [MM]: "))
day = int(input("Day [DD]: "))

# birthday = datetime.datetime(year, month, day)

Expand Down
27 changes: 14 additions & 13 deletions bday.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@


def print_header():
print('-----------------------------------')
print(' BIRTHDAY APP')
print('-----------------------------------')
print("-----------------------------------")
print(" BIRTHDAY APP")
print("-----------------------------------")
print()


def get_birthday_from_user():
print('Tell us when you were born: ')
year = int(input('Year [YYYY]: '))
month = int(input('Month [MM]: '))
day = int(input('Day [DD]: '))
print("Tell us when you were born: ")
year = int(input("Year [YYYY]: "))
month = int(input("Month [MM]: "))
day = int(input("Day [DD]: "))

birthday = datetime.datetime(year, month, day)
return birthday
Expand All @@ -28,21 +28,21 @@ def compute_days_between_dates(bday, now):

def print_birthday_information(days):
if days < 0:
print('Your birthday is in {} days!'.format(-days))
print("Your birthday is in {} days!".format(-days))
elif days > 0:
print('You had your birthday already this year! {} days ago'.format(days))
print("You had your birthday already this year! {} days ago".format(days))
else:
print('Happy birthday!!!')
print("Happy birthday!!!")


def print_age(bday, now):
date1 = now
date2 = datetime.datetime(bday.year, bday.month, bday.day)
tdt = date1 - date2
tdays = int(tdt.total_seconds() / 60 / 60 / 24)
tyears = tdays/365
print('Your are', tdays, 'days old')
print('Your are', tyears, 'years old')
tyears = tdays / 365
print("Your are", tdays, "days old")
print("Your are", tyears, "years old")


def main():
Expand All @@ -53,4 +53,5 @@ def main():
print_birthday_information(number_of_days)
print_age(bday, now)


main()
12 changes: 8 additions & 4 deletions beautiful_soup/beautiful.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from bs4 import BeautifulSoup
import urllib.request

# import csv
# from datetime import datetime

url = ['https://www.bloomberg.com/quote/CCMP:IND', 'https://www.bloomberg.com/quote/SPX:IND']
url = [
"https://www.bloomberg.com/quote/CCMP:IND",
"https://www.bloomberg.com/quote/SPX:IND",
]
data = []
for pg in url:
# page = urllib.request.urlopen(pg)
Expand All @@ -14,10 +18,10 @@
# BeautifulSoup to work on it.

# parse the html using beautiful soup and store in variable `soup`
soup = BeautifulSoup(page, 'html.parser')
soup = BeautifulSoup(page, "html.parser")

# Take out the <div> of name and get its value
name_box = soup.find('h1', attrs={'class': 'name'})
name_box = soup.find("h1", attrs={"class": "name"})

# After we have the tag, we can get the data by getting its text.

Expand All @@ -27,7 +31,7 @@

# Similarly, we can get the price too.

price_box = soup.find('div', attrs={'class': 'price'})
price_box = soup.find("div", attrs={"class": "price"})
price = price_box.text
print(price)

Expand Down
Loading

0 comments on commit fd396ba

Please sign in to comment.