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
from django.template.response import TemplateResponse | |
from django.views.generic import View | |
class MyClassBasedView(View): | |
def __init__(self, foo='bar'): | |
self._foo = foo | |
def get(self, request): | |
context = {'foo': self._foo} |
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
#!/usr/bin/env python | |
from meinheld import server | |
from saleor.wsgi import application | |
server.listen(('0.0.0.0', 8000)) | |
server.run(application) |
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
#!/usr/bin/env python | |
from cherrypy import wsgiserver | |
from saleor.wsgi import application | |
server = wsgiserver.CherryPyWSGIServer( | |
('0.0.0.0', 8000), application, numthreads=10) | |
try: | |
server.start() | |
except KeyboardInterrupt: |
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
#!/usr/bin/env python | |
from tornado import httpserver, ioloop, wsgi | |
from saleor.wsgi import application | |
container = wsgi.WSGIContainer(application) | |
server = httpserver.HTTPServer(container) | |
server.bind(8000) | |
server.start(0) | |
ioloop.IOLoop.current().start() |
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
#!/usr/bin/env python | |
from tornado import httpserver, ioloop, wsgi | |
from saleor.wsgi import application | |
container = wsgi.WSGIContainer(application) | |
server = httpserver.HTTPServer(container) | |
server.listen(8000) | |
ioloop.IOLoop.current().start() |
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
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<match target="font"> | |
<edit name="autohint" mode="assign"><bool>true</bool></edit> | |
<edit name="antialias" mode="assign"><bool>true</bool></edit> | |
<edit name="hinting" mode="assign"><bool>true</bool></edit> | |
<edit name="hintstyle" mode="assign"><const>hintfull</const></edit> | |
<edit name="rgba" mode="assign"><const>rgb</const></edit> | |
</match> | |
</fontconfig> |
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
from example import ( | |
f401_unused) | |
@f821_undefined_name | |
def c901_too_complex(x): | |
if x > 1: | |
if x > 2: | |
if x > 3: | |
if x > 4: | |
if x > 5: |
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
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py | |
index 4306193..bf965c1 100644 | |
--- a/django/db/models/expressions.py | |
+++ b/django/db/models/expressions.py | |
@@ -340,11 +340,27 @@ def reverse_ordering(self): | |
return self | |
+class ExpressionFilter(object): | |
+ def __init__(self, expression, value, lookup): |
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
def query_db(ids): | |
print('Querying the database:', ids) | |
# fake some data | |
results = [] | |
for id_ in ids: | |
results.extend(range(id_ + 2, id_ + 5)) | |
# simulate DISTINCT() | |
return set(results) | |
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
import glob | |
import os | |
from xml.etree import ElementTree | |
TEMP = './tmp.svg' | |
def rebrand(fname, brand): | |
svg = ElementTree.parse(fname) | |
for e in svg.iterfind(".//{http://www.w3.org/2000/svg}rect[@id='background']"): | |
e.set('style', 'fill:url(#%s);' % (brand,)) |