code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
from django.db import models
from apps.common.models import CommonItem
#from feedbag.apps.review.models import Review
class Brand(CommonItem):
name = models.CharField(max_length=90)
slug = models.SlugField(max_length=40)
logo = models.FileField(upload_to='uploads/brands/')
description = models.TextField()
def _... | Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
from django import template
from django.contrib.sites.models import Site
from feedbag.apps.product.models import Review, ProductType
register = template.Library()
@register.inclusion_tag('recent_reviews.html', takes_context=True)
def recent_reviews(context):
reviews = Review.objects.all().filter(active=True)
... | Python |
# Create your views here.
from django import template
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from feedbag.apps.product.models import Brand, Product, ProductType, \
ProductImage
template.add_to_builtins('feedbag.apps.product.templ... | Python |
from feedbag.apps.blog.models import Post
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
from feedbag.apps.product.models import Brand, Product, ProductType, \
ProductImage
def product_sitemap():
info_dict = {
'queryset': Product.objects.all().filter(active=True).filter(has_review=True... | Python |
from django.contrib import admin
from feedbag.apps.product.models import Brand, Product, ProductType, \
ProductImage, ProductNutrition, Review
class BrandAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
admin.site.register(Brand, BrandAdmin)
class ProductTypeAdmin(admin.ModelAdmin):
prepopu... | Python |
from django.db import models
# Create your models here.
class TwitterProfile(models.Model):
screen_name = models.CharField(max_length=200)
active = models.BooleanField(default=True)
def __unicode__(self):
return self.screen_name
class TwitterTweet(models.Model):
text = models.CharField(max_length=140)
... | Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
from django import template
from feedbag.apps.social.models import TwitterTweet
register = template.Library()
@register.inclusion_tag('twitter.html', takes_context=True)
def twitter(context, limit=10):
tweets = []
try:
tweets = TwitterTweet.objects.all().order_by('-created')[:limit]
except:
pass
return {
... | Python |
"""
setup_django.py - robustly handle setting up the Django environment for standalone Python scripts.
Author: Mike Kibbel, mkibbel@capstrat.com - November 6, 2007
Simply copy this file into the same folder as your standalone script.
To set up the Django environment, the first line of your script should read:
... | Python |
# Create your views here.
| Python |
import setup_django
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.utils import simplejson
from feedbag.apps.social.models import TwitterTweet, TwitterProfile
import datetime
import sys
import time
import u... | Python |
from django.contrib import admin
from django.db import models
from feedbag.apps.social.models import TwitterProfile, TwitterTweet
admin.site.register(TwitterProfile)
class TwitterTweetAdmin(admin.ModelAdmin):
list_display = ('screen_name', 'text', 'created')
ordering = ('-created', 'id')
pass
admin.site.reg... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
# Create your views here.
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from feedbag.apps.product.models import Review
def home(request):
reviews = []
try:
reviews = Review.objects.all().filter(active=True)
except:
pass
return r... | Python |
from django.db import models
# Create your models here.
class CommonItem(models.Model):
created_at = models.DateTimeField(auto_now = False)
updated_at = models.DateTimeField(auto_now = True)
active = models.BooleanField(default = True)
| Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
from django import template
from django.contrib.sites.models import Site
register = template.Library()
@register.inclusion_tag('navigation_primary.html', takes_context=True)
def navigation_primary(context, active = '', link = True):
return {
'active': active,
'link': link,
'request': conte... | Python |
# Create your views here.
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
def sitemap(request):
return render_to_response('sitemap.html', {},
context_instance=RequestContext(request))
def accessibility(re... | Python |
# Django settings for feedbag project.
import os
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
ROOT_PATH = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2'... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import admin
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
from feedbag.apps.blog.feeds import BlogFeed
from feedbag.apps.blog.sitemap import post_sitemap
from feedbag.apps.product.sitemap import product_s... | Python |
from django.conf import settings as settings_conf
from django import template
template.add_to_builtins('feedbag.apps.common.templatetags.common')
template.add_to_builtins('feedbag.apps.social.templatetags.social')
def settings(request):
return {
'settings': settings_conf
} | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
# setup.py
import os
from distutils.core import setup
from pyke import knowledge_engine
# Make sure that compiled_krb files are up to date:
knowledge_engine.engine(
os.path.join(os.path.dirname(__file__), 'naimath', 'engine'))
setup(
name = 'naimath',
version = '0.1',
packages = ['naimath', 'naimath... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | Python |
# urls.py
# These are the urlpatterns for the naimath_app.
#
# These need to be include()ed in the project's urls.py file.
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^naimath/', 'path.to.function' [, kw_args_dict [, name]]),
(r'^$', 'naimath_app.views.step1'),
... | Python |
# naimath_extras.py
from django import template
from naimath.engine import question
register = template.Library()
@register.filter
def get_question(full_q_name):
try:
category, q_name = full_q_name.split(':')
return question.lookup(category, q_name)
except Exception:
return full_q_na... | Python |
# Create your views here.
import itertools
import operator
from pprint import pprint
from django.shortcuts import render_to_response
from django.template import RequestContext
# Don't seem to need these anymore...
#from django.template import Context, loader
#from django.http import HttpResponse
# import the Django... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^naimath/', include('naimath_project.foo.urls')),
# Uncomment the admin/doc line below to enable admin documenta... | Python |
# Django settings for naimath_project project.
import os
import sys
PROJECT_DIR = os.path.realpath(os.path.dirname(__file__))
#print "settings.py: PROJECT_DIR:", PROJECT_DIR
SOURCE_DIR = os.path.dirname(
os.path.dirname(
os.path.dirname(PROJECT_DIR)))
#print "settings.py: SOURCE_DIR:", SOUR... | Python |
#!/usr/bin/python
# wx_gui.py
import sys
import os
from doctest_tools import setpath
setpath.setpath(__file__, remove_first = True)
from naimath.gui import gui
def usage():
sys.stderr.write("usage: wx_gui.py rule_base [canned_questions]\n")
sys.exit(2)
if __name__ == "__main__":
#print "sys.argv", sy... | Python |
# __init__.py for scripts
# This is only here to make the doctest_tools.setpath work.
| Python |
#!/usr/bin/python
# cli.py
import sys
import os.path
from doctest_tools import setpath
ROOT_DIR = setpath.setpath(__file__, remove_first = True)[0]
#print "ROOT_DIR", ROOT_DIR
from naimath.engine import engine, question
diagnosis_limit = 6
question_limit = 6
def run(rule_base, canned_questions = None, recorded_an... | Python |
#!/usr/bin/python
# make_kmap.py
import sys
import operator
import itertools
def kmap(file = sys.stdout, **questions):
r'''Prints a K-map for the questions to stdout.
The K-map looks like:
q1
|q2
YY YN Y? NY NN N? ?Y ?N ??
---+--+--+--+--+--+--+--+--+... | Python |
#!/usr/bin/env python
import wx
import wx.lib.buttons as buttons
data={'common_cold':{'runny_nose':'yes','nasal_blockage':'yes','sneezing':'yes'},'allergic_rhinitis':{'sneezing':'yes','nasal_blockage':'yes'}}
diseaselist=data.keys()
print diseaselist
class RefactorExample(wx.Frame):
def __init__(self, parent, ... | Python |
#!/usr/bin/python
# extract_questions.py
# .pot format:
#
# <whitespace>
# #: file:line ...
# msgid "unstranslated_string"
# msgstr "translated_string"
# We need:
#
# category, q_name (with file:line references)
# choices (with file:line references)
import sys
import os
import collections
imp... | Python |
#!/usr/bin/python
# makepot.py
# .pot format:
#
# <whitespace>
# #. extracted comments (choices)
# #: file:line
# msgid "unstranslated_string"
# msgstr "translated_string"
import sys
import os
import itertools
import operator
from doctest_tools import setpath
Root_dir = setpath.setpath(__file__,... | Python |
# web.py
# Possibly interesting values:
# CONTENT_LENGTH:
# CONTENT_TYPE: application/x-www-form-urlencoded
# PATH_INFO: /hello/mom/and/dad.html
# QUERY_STRING: this=value&that=too
# REMOTE_ADDR: 127.0.0.1
# REQUEST_METHOD: GET
# SCRIPT_NAME:
# wsgi.errors: <file>
# wsgi.file_wrappe... | Python |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | Python |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | Python |
# static.py
# Possibly interesting values:
# CONTENT_LENGTH:
# CONTENT_TYPE: application/x-www-form-urlencoded
# PATH_INFO: /hello/mom/and/dad.html
# QUERY_STRING: this=value&that=too
# REMOTE_ADDR: 127.0.0.1
# REQUEST_METHOD: GET
# SCRIPT_NAME:
# wsgi.errors: <file>
# wsgi.file_wra... | Python |
# stages.py
# Possibly interesting values:
# CONTENT_LENGTH:
# CONTENT_TYPE: application/x-www-form-urlencoded
# PATH_INFO: /hello/mom/and/dad.html
# QUERY_STRING: this=value&that=too
# REMOTE_ADDR: 127.0.0.1
# REQUEST_METHOD: GET
# SCRIPT_NAME:
# HTTP_ACCEPT_LANGUAGE: en-us,en;q=0.5
# ... | Python |
#!/usr/bin/python
# wsgi.py
import wsgiref.simple_server
from doctest_tools import setpath
setpath.setpath(__file__, remove_first = True)
from naimath.web import web
#web.init(__file__, 2)
httpd = wsgiref.simple_server.make_server('', 8000, web.wsgi_app)
print "Serving HTTP on port 8000..."
httpd.serve_forever(... | Python |
# score.py
r'''These all return a three-tuple:
- the score for this answer
- the max score
- the (category, question) that still needs to be asked, or None (if the
question has already been asked).
'''
from naimath.engine import engine
def got(category, question, **answers):
with engine.Engine... | Python |
# question.py
import os
import sys
import gettext
Root_dir = os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.abspath(__file__))))
#print "Root_dir", Root_dir
Locale_dir = os.path.join(Root_dir, 'translation', '0.1')
#print "Locale_dir", Locale_dir
from naimath.engine import ext... | Python |
# helpers.py
#cf_threshold = 0.2
cf_threshold = 0.0
def sum_cf(*scores):
r'''Sums the CF from each score and divides by the sum of the max
scores.
Also calculates the weight for each non None question as the max score
in the score containing the question divided by the sum of the max
scores.
... | Python |
# extracted_questions.py
Questions = [
['RAST', 'investigation', 'positive_negative',
['positive', 'pulmonary.krb:71 pulmonary.krb:182'],
],
['abg_pco2', 'investigation', 'multiple_choices',
['less_than_40'],
['more_than_40', 'pulmonary.krb:95'],
],
['accessorymuscles_re... | Python |
# engine.py
import sys
import operator
import itertools
from pyke import knowledge_engine, krb_traceback
def init():
global Engine
Engine = knowledge_engine.engine(__file__)
Debug = False
def calc_relevance(cf, relevance):
r'''Calculates the weighted relevance of a question.
The weighted relevence... | Python |
# headache_bc.py
from __future__ import with_statement
import itertools
from pyke import contexts, pattern, bc_rule
pyke_version = '1.1.1'
compiler_version = 1
def migraine(rule, arg_patterns, arg_context):
engine = rule.rule_base.engine
patterns = rule.goal_arg_patterns()
if len(arg_patterns) == len(patterns)... | Python |
# compiled_pyke_files.py
from pyke import target_pkg
pyke_version = '1.1.1'
compiler_version = 1
target_pkg_version = 1
try:
loader = __loader__
except NameError:
loader = None
def get_target_pkg():
return target_pkg.target_pkg(__name__, __file__, pyke_version, loader, {
('', '', 'pulmonary.krb... | Python |
# pulmonary_bc.py
from __future__ import with_statement
import itertools
from pyke import contexts, pattern, bc_rule
pyke_version = '1.1.1'
compiler_version = 1
def common_cold(rule, arg_patterns, arg_context):
engine = rule.rule_base.engine
patterns = rule.goal_arg_patterns()
if len(arg_patterns) == len(patte... | Python |
import wx
def hd_onset(self,pos,cf):
x=pos[0]
y=pos[1]
wx.StaticText(self.scroll21,-1," >>> Is the headache sudden in onset or gradual?"+ "\tCF: " +cf,pos=(x,y))
y=y+25
options = ['Unanswered','Gradual','Sudden over gradual','Sudden']
box=wx.RadioBox(self.scroll21,-1, "Select only one:", (x+55,... | Python |
#!/usr/bin/python
# gotoclass.py
import wx
class GoToClass(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(990, 850))
panel = wx.Panel(self, -1)
# STATUS Bar
self.CreateStatusBar()
self.SetStatusText("This is the statusbar")
#... | Python |
#!/usr/bin/env python
import wx
import wx.lib.buttons as buttons
import hd
import wx.html
class RefactorExample(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, 'NAIMATH : Medical Expert System',
size=(1200, 800))
# Splash Screen
image = wx.Image("sp... | Python |
# po_headers.py
import time
def write_header(f):
print >> f, r'''# Question translation for Naimath Expert System
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Naimath package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Proje... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para PyAfipWs (WSFEv1)"
__author__ = "Mariano Reingart (mariano@nsis.com.ar)"
__copyright__ = "Copyright (C) 2010 Mariano Reingart"
from distutils.core import setup
import py2exe
import glob, sys
# includes for py2ex... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"""
__version__ = "$Revision: 1.3 $"
__date__ = "$Date: 2005/04/05 18:44:54 $"
"""
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2008 Mariano Reingart"
from distutils.core import setup
import py2exe
import... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para PyAfipWs (WSAA)"
__author__ = "Mariano Reingart (mariano@nsis.com.ar)"
__copyright__ = "Copyright (C) 2011 Mariano Reingart"
from distutils.core import setup
import py2exe
import glob, sys
# includes for py2exe
... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para PyAfipWs"
__author__ = "Mariano Reingart (mariano@nsis.com.ar)"
__copyright__ = "Copyright (C) 2008 Mariano Reingart"
from distutils.core import setup
import py2exe
import sys
# includes for py2exe
includes=['e... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para PyAfipWs (WSFEXv1)"
__author__ = "Mariano Reingart (mariano@nsis.com.ar)"
__copyright__ = "Copyright (C) 2010 Mariano Reingart"
from distutils.core import setup
import py2exe
import glob, sys
# includes for py2e... | Python |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in ... | Python |
import wsaa
import os,sys
from subprocess import Popen, PIPE
from base64 import b64encode
def sign_tra(tra,cert,privatekey):
"Firmar PKCS#7 el TRA y devolver CMS (recortando los headers SMIME)"
# Firmar el texto (tra)
out = Popen(["openssl", "smime", "-sign",
"-signer", cert,... | Python |
#!usr/bin/python
# -*- coding: utf-8-*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in the hope tha... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para PyAfipWs (WSMTXCA)"
__author__ = "Mariano Reingart (mariano@nsis.com.ar)"
__copyright__ = "Copyright (C) 2010 Mariano Reingart"
from distutils.core import setup
import py2exe
import glob, sys
# includes for py2e... | Python |
#!/usr/bin/python
# -*- coding: utf_8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in the hope t... | Python |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in t... | Python |
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para COT"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2011 Mariano Reingart"
from distutils.core import setup
import py2exe
import glob, sys
# includes for py2exe
includes=['ema... | Python |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in t... | Python |
#!/usr/bin/python
"""muxer.py
Create a list of feeds and then mix them together into one super feed.
@author Philip Cadigan < phil@inkhorn.org >
@date 3/24/2009
"""
# ---------- CUSTOMIZE FOR YOUR SITE ----------
# for each feed you wish to add, simply put the URL in quotes followed by a comma below.
feed_list = ... | Python |
#!/usr/bin/python
"""muxer.py
Create a list of feeds and then mix them together into one super feed.
@author Philip Cadigan < phil@inkhorn.org >
@date 3/24/2009
"""
# ---------- CUSTOMIZE FOR YOUR SITE ----------
# for each feed you wish to add, simply put the URL in quotes followed by a comma below.
feed_list = ... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import forms
from django.utils.translation import ugettext as _
from feedjack.models import Tag, Subscriber, Post
SEARCH_CHOICES = (
("posts", _("Posts")),
("tags", _("Tags")),
("blogs", _("Blogs")),
("authors", _("Authors")),
)
class... | Python |
# -*- coding: utf-8 -*-
from django.conf import settings
from feedjack.models import Site, Link
from feedjack_extension.forms import SearchForm
def context(request):
if request.method == "GET" and request.GET.get("search"):
search_form = SearchForm(request.GET)
else:
search_form = SearchForm(... | Python |
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from django.http import HttpResponse
from django.utils import feedgenerator
from django.utils.cache import patch_vary_headers
from django.core.urlresolvers import reverse
from django.conf import settings
from django.shortcuts import get_object_or_404, Ht... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import forms
from django.utils.translation import ugettext as _
from feedjack.models import Tag, Subscriber, Post
SEARCH_CHOICES = (
("posts", _("Posts")),
("tags", _("Tags")),
("blogs", _("Blogs")),
("authors", _("Authors")),
)
class... | Python |
# -*- coding: utf-8 -*-
"""
Based on Feedjack urls.py by Gustavo Picón
urls.py
"""
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('feedjack_extension.views',
url(r'^subscribers/(?P<subscriber_id>\d+)/tags/(?P<tag>.*)/$', "subscriber_show", name="by_tag_subscriber_show"),
url(r'^sub... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import template
from django.db.models import Count, Max, F
from django.conf import settings
from feedjack.models import Tag, Subscriber, Feed
register = template.Library()
@register.simple_tag
def normalize_number(number, max_values, levels=16):
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import template
from django.db.models import Count, Max, F
from django.conf import settings
from feedjack.models import Tag, Subscriber, Feed
register = template.Library()
@register.simple_tag
def normalize_number(number, max_values, levels=16):
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import feedparser
from django.core.management.base import BaseCommand
from django.conf import settings
from feedjack.models import Feed, Subscriber
class Command(BaseCommand):
def handle(self, *args, **options):
if not len(args):
print "You must... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import feedparser
from django.core.management.base import BaseCommand
from django.conf import settings
from feedjack.models import Feed, Subscriber
class Command(BaseCommand):
def handle(self, *args, **options):
if not len(args):
print "You must... | Python |
# -*- coding: utf-8 -*-
from django.utils import feedgenerator
from django.utils.cache import patch_vary_headers
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import Context... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import forms
from django.utils.translation import ugettext as _
from feedjack.models import Tag, Subscriber, Post
SEARCH_CHOICES = (
("posts", _("Posts")),
("tags", _("Tags")),
("blogs", _("Blogs")),
("authors", _("Authors")),
)
class... | Python |
# -*- coding: utf-8 -*-
from django.conf import settings
from feedjack.models import Site, Link
from feedjack_extension.forms import SearchForm
def context(request):
if request.method == "GET" and request.GET.get("search"):
search_form = SearchForm(request.GET)
else:
search_form = SearchForm(... | Python |
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from django.http import HttpResponse
from django.utils import feedgenerator
from django.utils.cache import patch_vary_headers
from django.core.urlresolvers import reverse
from django.conf import settings
from django.shortcuts import get_object_or_404, Ht... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import forms
from django.utils.translation import ugettext as _
from feedjack.models import Tag, Subscriber, Post
SEARCH_CHOICES = (
("posts", _("Posts")),
("tags", _("Tags")),
("blogs", _("Blogs")),
("authors", _("Authors")),
)
class... | Python |
# -*- coding: utf-8 -*-
"""
Based on Feedjack urls.py by Gustavo Picón
urls.py
"""
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('feedjack_extension.views',
url(r'^subscribers/(?P<subscriber_id>\d+)/tags/(?P<tag>.*)/$', "subscriber_show", name="by_tag_subscriber_show"),
url(r'^sub... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import template
from django.db.models import Count, Max, F
from django.conf import settings
from feedjack.models import Tag, Subscriber, Feed
register = template.Library()
@register.simple_tag
def normalize_number(number, max_values, levels=16):
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from django import template
from django.db.models import Count, Max, F
from django.conf import settings
from feedjack.models import Tag, Subscriber, Feed
register = template.Library()
@register.simple_tag
def normalize_number(number, max_values, levels=16):
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import feedparser
from django.core.management.base import BaseCommand
from django.conf import settings
from feedjack.models import Feed, Subscriber
class Command(BaseCommand):
def handle(self, *args, **options):
if not len(args):
print "You must... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import feedparser
from django.core.management.base import BaseCommand
from django.conf import settings
from feedjack.models import Feed, Subscriber
class Command(BaseCommand):
def handle(self, *args, **options):
if not len(args):
print "You must... | Python |
# -*- coding: utf-8 -*-
from django.utils import feedgenerator
from django.utils.cache import patch_vary_headers
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import Context... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
# Django settings for djangoblogs project.
import deseb
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = 'sample.d... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.simple import redirect_to
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# fake in... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.simple import redirect_to
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# fake in... | Python |
# -*- coding: utf-8 -*-
"""
feedjack
Gustavo Picón
fjcache.py
"""
import md5
from django.core.cache import cache
from django.conf import settings
T_HOST = 1
T_ITEM = 2
T_META = 3
def str2md5(key):
""" Returns the md5 hash of a string.
"""
ctx = md5.new()
ctx.update(key.encode('utf-8'))
retur... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.