code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
from django import template
from django import forms
from django.http import HttpResponseRedirect
import datetime
from django.contrib.auth.models import User
from pirate_badges.models import Badge, BadgeDimension, test_badge, BadgeType
from pirate_core import HttpRedirectException, namespace_get, FormMixin
from pirate_... | Python |
# Create your views here.
| Python |
# -*- coding: latin-1 -*-
"""
========
Fake-PIL
========
By: `UYSRC <http://www.uysrc.com/>`_
Date: Fri, Jan 14, 2011
PIL interface overtop Google Imaging API to enable
Django-nonrel model.ImageField work with
django-filetransfers. Validates whether the file
uploaded is indeed an image.
Released into the public ... | Python |
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
import datetime
import django.dispatch
from django.contrib import admin
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.core... | 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 |
from django import template
from django import forms
from django.http import HttpResponseRedirect
from pirate_social.models import Subscription,RelationshipEvent
from pirate_core.views import HttpRedirectException, namespace_get
from customtags.decorators import block_decorator
register = template.Library()
block = ... | Python |
from django import template
from django import forms
from django.http import HttpResponseRedirect
import datetime
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from pirate_core import HttpRedirectException, namespace_get, FormMixin
from pirate_social.models impor... | Python |
from django import template
from django import forms
from django.http import HttpResponseRedirect
import datetime
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from pirate_core import HttpRedirectException, namespace_get, FormMixin
from pirate_social.models impor... | Python |
# Create your views here.
| Python |
from django.db import models
from django import template
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
#from ModuleDeliberation.models import Comment
from django.utils.translation im... | Python |
from django import forms
from pirate_actions.models import Action
from pirate_topics.models import Topic
from pirate_core.forms import FormMixin
from markitup.widgets import MarkItUpWidget
from pirate_core.widgets import SelectTimeWidget, HorizRadioRenderer
from django.forms.extras import SelectDateWidget
import dateti... | 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.
| Python |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.template.loader import render_to_string
from django.shortcuts import render_to_response
from google.appengine.api import memcache
from pirate_ranking.models import get_ranked_list
from pirate_comments.models import get_c... | 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 google.appengine.api import memcache
from django.http import HttpResponse, HttpResponseRedirect, QueryDict
import simplejson
from django.template.loader import render_to_string
from django.contrib.contenttypes.models import ContentType
from google.appengine.ext import deferred
from oa_cache.models import ListCache... | Python |
import dselector
from django.views.generic.simple import direct_to_template
from django.views.generic.create_update import delete_object
from django.views.decorators.csrf import csrf_protect
from django.conf.urls.defaults import *
from django.contrib import admin
from pirate_core import redirectable, home_page, welcom... | Python |
from django.contrib.comments import Comment
from pirate_forum.models import ForumBlob
#from pirate_actions.models import Action
#from pirate_issues.models import Problem, Solution, Policy
FIELD_INDEXES = {
Comment: {'indexed': ['object_pk']},
ForumBlob: {'unindexed': ['description']},
}
| Python |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | Python |
from django.db import models
from pirate_consensus.models import Consensus, UpDownVote
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
import datetime
from django.utils.translation import ugettext as _
from django.contrib import admin
from pirate_signals.models... | 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 |
#List of ranking tags. These aren't necessarily tags in the classic sense, but shouldn
#be executed when a object's consensus is udpated i.e. when a vote object is created
| Python |
# Create your views here.
| Python |
from django.db import models
from django import template
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.comments.signals import comment_was_posted
from pirate_perm... | Python |
from django import forms
import datetime
class BlobForm(forms.Form):
'''
This form is used to allow creation and modification of issue objects.
It extends FormMixin in order to provide a create() class method, which
is used to process POST, path, and object variables in a consistant way,
and in o... | 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 |
from django import template
from django import forms
from django.http import HttpResponseRedirect
from pirate_forum.models import ForumDimension
from search.core import search
from oa_cache.models import ListCache
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
fro... | Python |
# Create your views here.
| Python |
from django.db import models
from django import template
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
#from ModuleDeliberation.models import Comment
from django.utils.translation im... | Python |
from django import forms
from django.forms.extras import SelectDateWidget
from pirate_issues.models import Problem, Solution, Policy
from pirate_topics.models import Topic
from pirate_forum.forms import BlobForm
from pirate_core.forms import FormMixin
from pirate_core.widgets import HorizRadioRenderer
from django.contr... | 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.
| Python |
import search
from search.core import startswith, porter_stemmer
from oa_filmgenome.models import Film, FilmIdea, Scene
search.register(FilmIdea, ('summary','description'), search_index='autocomplete_index',indexer=startswith)
search.register(FilmIdea, ('summary','description'), search_index='search_index',indexer=por... | Python |
from django.db import models
from django import template
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.comments.signals import comment_was_posted
from pirate_perm... | 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 import forms
from django.http import HttpResponseRedirect
import datetime
from django.contrib.contenttypes.models import ContentType
from oa_verification.models import ActionTaken
from pirate_core import HttpRedirectException, namespace_get, FormMixin
from pirate_signals.model... | Python |
# Create your views here.
| Python |
#!/usr/bin/env python
#
# Copyright 2010 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Python |
from django.db import models
from django.contrib.auth.models import User
from django.core.exceptions import SuspiciousOperation
from pirate_reputation.models import ReputationDimension
class PermissionsGroup(models.Model):
name = models.CharField(max_length=70)
description = models.TextField()
#users = m... | Python |
import testlib, pirate_permissions
__test__ = testlib.get_test_dict(pirate_permissions, locals())
| Python |
from django import template
from pirate_permissions import facade
from customtags.decorators import block
@block
def canI(context, nodelist, *args, **kwargs):
user = template.Variable(kwargs['user']).resolve(context)
permission_str = kwargs['permission_str']
component = kwargs['component']
generic_o... | Python |
from django import forms
from customtags.decorators import block
from pirate_core.views import namespace_get
from pirate_core.forms import FormMixin
from pirate_permissions.models import PermissionsGroup
get_namespace = namespace_get("pp_permissions")
@block
def pp_permgroup_list(context, nodelist, *args, **kwargs):
... | Python |
from pirate_permissions.models import PermissionsGroup, Permission
from pirate_reputation.models import Reputation
def canI(user, permission_str, component, generic_obj=None):
'''
This method is used to test whether a particular has permission to undertake a particular
action within a particular system c... | Python |
# Create your views here.
| Python |
import datetime
try:
import cPickle as pickle
except ImportError:
import pickle
from django.db import models
from django.db.models.query import QuerySet
from django.conf import settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.template import Context
from... | Python |
"""
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = FileLock('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'somefile', 'is locked alread... | Python |
from django.conf.urls.defaults import *
from notification.views import notices, mark_all_seen, feed_for_user, single, notice_settings
urlpatterns = patterns('',
url(r'^$', notices, name="notification_notices"),
url(r'^settings/$', notice_settings, name="notification_notice_settings"),
url(r'^(\d+)/$', sin... | Python |
from notification.models import Notice
def notification(request):
if request.user.is_authenticated():
return {
'notice_unseen_count': Notice.objects.unseen_count_for(request.user, on_site=True),
}
else:
return {}
| Python |
from datetime import datetime
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.template.defaultfilters import linebreaks, escape, striptags
fr... | Python |
from django.utils.translation import ugettext as _
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
from django.conf import settings
def simple_basic_auth_callback(request, user, *args, **kwargs):
"""
Simple callback to automatically login the given user after a successf... | Python |
import logging
from django.core.management.base import NoArgsCommand
from notification.engine import send_all
class Command(NoArgsCommand):
help = "Emit queued notices."
def handle_noargs(self, **options):
logging.basicConfig(level=logging.DEBUG, format="%(message)s")
logging.info("-" *... | Python |
#
# django-atompub by James Tauber <http://jtauber.com/>
# http://code.google.com/p/django-atompub/
# An implementation of the Atom format and protocol for Django
#
# For instructions on how to use this module to generate Atom feeds,
# see http://code.google.com/p/django-atompub/wiki/UserGuide
#
#
# Copyright (c) 2... | Python |
VERSION = (0, 2, 0, "a", 1) # following PEP 386
DEV_N = 4
def get_version():
version = "%s.%s" % (VERSION[0], VERSION[1])
if VERSION[2]:
version = "%s.%s" % (version, VERSION[2])
if VERSION[3] != "f":
version = "%s%s%s" % (version, VERSION[3], VERSION[4])
if DEV_N:
vers... | Python |
import sys
import time
import logging
import traceback
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.mail import mail_admins
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from lockfile import FileL... | Python |
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, Http404
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.contrib.syndication.views import feed
fr... | Python |
from django.contrib import admin
from notification.models import NoticeType, NoticeSetting, Notice, ObservedItem, NoticeQueueBatch
class NoticeTypeAdmin(admin.ModelAdmin):
list_display = ('label', 'display', 'description', 'default')
class NoticeSettingAdmin(admin.ModelAdmin):
list_display = ('id', 'user', 'n... | Python |
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from tagging.models import Tag
from django.utils.translation import ugettext as _
from pirate_forum.models ... | Python |
from django import forms
from django.forms.extras import SelectDateWidget
from pirate_deliberation.models import Argument, Stance
from pirate_topics.models import Topic
from pirate_forum.forms import BlobForm
from pirate_core.forms import FormMixin
from pirate_core.widgets import HorizRadioRenderer
from django.contrib.... | 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 |
from django import template
from django import forms
from django.http import HttpResponseRedirect
import datetime
from django.contrib.contenttypes.models import ContentType
from pirate_deliberation.models import Argument, Stance, get_argument_list
from pirate_consensus.models import Consensus, UpDownVote
from pirate_re... | Python |
ARG_TYPES_DICT = {'y':'yea','n':'nay'}
| Python |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
import datetime
import django.dispatch
from django.contrib import admin
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from pirate_signa... | Python |
from django import forms
FLAG_CHOICES = (
('Ad Hominem','Ad Hominem'),
('Straw Man','Straw Man'),
('False Dilemma','False Dilemma'),
('Appeal to Authority','Appeal to Authority'),
('Bandwagon','Bandwagon'),
('Cherry Picking','Cherry Picking'),
('Slippery Slope','Slippery Slope'),
('Red ... | 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 pirate_flags.forms import FlagForm
from pirate_flags.models import Flag,UserFlag
from django import template
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import simplejson
from pirate_consensus.models import Consensus
from django.shortcuts import get_object... | Python |
# Create your views here.
| Python |
"""Integrates django-notification into the OpenAssembly system.
pirate_messages.models.create_notification users signals to create
flexible notifications from django-notifications
"""
from django.db.models import signals
from django.conf import settings
from django.utils.translation import ugettext_noop as _
... | Python |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
import datetime
import django.dispatch
from django.contrib import admin
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from pirate_profi... | 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 |
from django import template
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import simplejson
from pirate_messages.models import Notification, Message
from django.db import transaction
from django.middleware import csrf
from django.contrib.contenttypes.models import... | Python |
from django import template
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import simplejson
from pirate_messages.models import Message, MessageForm, Notification
from django.db import transaction
from django.middleware import csrf
from django.contrib.contenttypes.... | Python |
# Create your views here.
| Python |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
import datetime
import django.dispatch
from django.contrib import admin
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from pirate_signa... | 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 |
from django import template
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import simplejson
from django.shortcuts import get_object_or_404
from django.contrib.contenttypes.models import ContentType
from pirate_core.views import HttpRedirectException, namespace_g... | Python |
# Create your views here.
| Python |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from djangotoolbox.fields import ListField
from django.utils.translation import ugettext as _
from django.contrib import admin
from pirate_signals.models import update_agent
from google.ap... | 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 oa_platform.models import Platform, PlatformDimension
from pirate_core import namespace_get
from django.contrib.contenttypes.models import ContentType
from pirate_consensus.models import Consensus
from customtags.decorators import block_decorator
register = template.Library()
block = ... | Python |
# Create your views here.
| 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 |
# Create your views here.
from pirate_consensus.models import Consensus, RatingVote, UpDownVote, VideoVote
from django.utils import simplejson
from django.http import HttpResponse, HttpResponseRedirect
from pirate_sources.models import URLSource
from tagging.models import Tag
import datetime
from django.shortcuts impor... | Python |
# AUTOLOAD_SITECONF module
| Python |
import os, sys, pdb, imp, re, inspect
from django.contrib.admin import site
from django.template import add_to_builtins
def get_module_list(start):
all_files = os.walk(start)
file_list = [(i[0], (i[1], i[2])) for i in all_files]
file_dict = dict(file_list)
curr = start
modules = []
pathlist =... | Python |
import django.dispatch
aso_rep_change = django.dispatch.Signal(providing_args=["event_score", "user"])
aso_rep_event = django.dispatch.Signal(providing_args=["event_score", "user"])
aso_rep_delete = django.dispatch.Signal(providing_args=["event_score", "user"])
notification_send = django.dispatch.Signal(providing_args... | 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 |
# Create your views here.
| Python |
from django.db import models
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django import forms
###TODO: Need to make Source... | 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 |
from django import template
from django import forms
from django.http import HttpResponseRedirect
from django.contrib.contenttypes.models import ContentType
from pirate_sources.models import IMGSource, URLSource
from pirate_core.views import HttpRedirectException, namespace_get
from django.template import Library
from ... | Python |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.views.generic.simple import direct_to_template
from django.contrib.contenttypes.models import ContentType
import datetime
from django.contrib.auth.models import User
from ... | Python |
import urllib2,uuid,simplejson,thread,base64,random
class _Method(object):
# from jsonrpclib
def __init__(self, send, name):
self.__send = send
self.__name = name
def __getattr__(self, name):
return _Method(self.__send, "%s.%s" % (self.__name, name))
def __call__(self, *args):
... | Python |
import search
search.autodiscover()
| Python |
from django.db import models
from django import template
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
#from ModuleDeliberation.models import Comment
from django.utils.translation i... | 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 |
from django import template
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import simplejson
from pirate_comments.models import Comment
from django.db import transaction
from django.middleware import csrf
from django.contrib.contenttypes.models import ContentType
f... | Python |
# Create your views here.
| Python |
from django.db import models
from django import template
from django.contrib import admin
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.contrib.contenttypes.models import ContentType
# First, define the Manager subclass.
class TopicManager(models.Manager):
... | Python |
from django import forms
from pirate_core.forms import FormMixin
from pirate_core.widgets import HorizRadioRenderer
from pirate_topics.models import Topic
class TopicForm(forms.Form, FormMixin):
def save(self, commit=True):
return None
parent = forms.ModelChoiceField(queryset=Topic.clean_objects.... | 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.