-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean code. Rename zen.py to zen_lines.py because it rises ImportError.
- Loading branch information
Showing
9 changed files
with
78 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
from settings import PROJECT_PATH | ||
# -*- coding: utf-8 -*- | ||
|
||
from django.conf import settings | ||
from emergent.base import render | ||
import os | ||
|
||
|
||
__all__ = ( | ||
'index', | ||
'status', | ||
) | ||
|
||
|
||
@render("emergent/index") | ||
def index(request): | ||
import random | ||
price = random.randint(0, 99) | ||
return {"price": price} | ||
|
||
|
||
@render("emergent/status") | ||
def status(request): | ||
with open(os.path.join(PROJECT_PATH, "status.txt")) as f: | ||
status = f.read(); | ||
with open(os.path.join(settings.PROJECT_PATH, "status.txt")) as f: | ||
status = f.read() | ||
return {"status": status} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
from .settings import MASHAPE_API_KEY, MASHAPE_API_URL | ||
# -*- coding: utf-8 -*- | ||
|
||
import requests | ||
|
||
headers = { | ||
from zen.settings import MASHAPE_API_KEY, MASHAPE_API_URL | ||
|
||
|
||
__all__ = ( | ||
'yodaize', | ||
) | ||
|
||
|
||
HEADERS = { | ||
'X-Mashape-Authorization': MASHAPE_API_KEY, | ||
} | ||
|
||
|
||
def yodaize(message): | ||
data = { | ||
'sentence': message, | ||
} | ||
message = requests.get(MASHAPE_API_URL, params=data, headers=headers) | ||
message = requests.get(MASHAPE_API_URL, params=data, headers=HEADERS) | ||
return message.content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__all__ = ( | ||
'MESSAGE', | ||
) | ||
|
||
|
||
MESSAGE = ( | ||
u"Beautiful is better than ugly.", | ||
u"Explicit is better than implicit.", | ||
u"Simple is better than complex.", | ||
u"Complex is better than complicated.", | ||
u"Flat is better than nested.", | ||
u"Sparse is better than dense.", | ||
u"Readability counts.", | ||
u"Special cases aren't special enough to break the rules.", | ||
u"Although practicality beats purity.", | ||
u"Errors should never pass silently.", | ||
u"Unless explicitly silenced.", | ||
u"In the face of ambiguity, refuse the temptation to guess.", | ||
u"There should be one-- and preferably only one --obvious way to do it.", | ||
u"Although that way may not be obvious at first unless you're Dutch.", | ||
u"Now is better than never.", | ||
u"Although never is often better than *right* now.", | ||
u"If the implementation is hard to explain, it's a bad idea.", | ||
u"If the implementation is easy to explain, it may be a good idea.", | ||
u"Namespaces are one honking great idea -- let's do more of those!", | ||
) |