repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ultrabug/py3status | py3status/modules/mail.py | 2 | 13567 | r"""
Display number of messages in various mailbox formats.
This module supports Maildir, mbox, MH, Babyl, MMDF, and IMAP.
Configuration parameters:
accounts: specify a dict consisting of mailbox types and a list of dicts
consisting of mailbox settings and/or paths to use (default {})
cache_timeout: re... | bsd-3-clause | 5eb341b9dce20808e60280492b5116f7 | 41.278481 | 84 | 0.423278 | 4.134943 | false | false | false | false |
ultrabug/py3status | py3status/constants.py | 2 | 7247 | # This file contains various useful constants for py3status
GENERAL_DEFAULTS = {
"color_bad": "#FF0000",
"color_degraded": "#FFFF00",
"color_good": "#00FF00",
"color_separator": "#333333",
"colors": True,
"interval": 5,
"output_format": "i3bar",
}
MAX_NESTING_LEVELS = 4
TIME_FORMAT = "%Y-... | bsd-3-clause | e77ed097d53b03d76748f86a52cb7e21 | 26.873077 | 152 | 0.557058 | 2.722389 | false | false | false | false |
devilry/devilry-django | devilry/project/develop/testhelpers/datebuilder.py | 1 | 1191 | from datetime import datetime
from datetime import timedelta
DJANGO_ISODATETIMEFORMAT = 'Y-m-d H:i'
def isoformat_datetime(datetimeobj):
return datetimeobj.strftime('%Y-%m-%d %H:%M')
class DateTimeBuilder(datetime):
"""
Extends the builtin python :class:`datetime.datetime` with extra utility methods.
... | bsd-3-clause | a8605eab1987181c6049b5a9d6f5d8c1 | 28.775 | 96 | 0.632242 | 3.620061 | false | false | false | false |
devilry/devilry-django | devilry/devilry_import_v2database/modelimporters/delivery_feedback_importers.py | 1 | 13855 | import os
import pprint
import sys
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core import files
from devilry.apps.core.models import AssignmentGroup
from devilry.apps.core.models import Candidate
from devilry.devilry_comment.models import Comment, CommentFile
from devi... | bsd-3-clause | 6bb88cabd685d48cd5b84c35ece5b4f6 | 41.894737 | 121 | 0.626416 | 3.974469 | false | false | false | false |
devilry/devilry-django | devilry/devilry_superadmin/management/commands/devilry_periodadd.py | 1 | 3417 | from datetime import datetime
from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand, CommandError
class RecordSaveModCommand(BaseCommand):
def save_record(self, record, verbosity):
try:
record.full_clean()
except ValidationError as e:
... | bsd-3-clause | 11ed6baa02476740e2d77d4338b35e5c | 41.185185 | 152 | 0.599649 | 4.223733 | false | false | false | false |
devilry/devilry-django | devilry/devilry_gradeform/urls.py | 1 | 1110 | from django.urls import re_path
from devilry.devilry_gradeform.views.setup_create_gradeform import CreateGradeForm
urlpatterns = [
re_path(r'^create/(?P<assignment_id>[0-9]+)', CreateGradeForm.as_view(), name='create-setup-gradeform'),
# url(r'^$',
# grade_form.AdvancedGradeForm.render_setup(AdvancedG... | bsd-3-clause | ff14c6fa68693183ce74d16a90d2cc53 | 40.111111 | 108 | 0.673874 | 2.991914 | false | false | true | false |
devilry/devilry-django | devilry/utils/delivery_collection.py | 1 | 8118 | from django.utils.formats import date_format
from django.http import HttpResponse
from django.conf import settings
from .stream_archives import StreamableZip, StreamableTar
class ArchiveException(Exception):
"Archive exceptions"
def create_archive_from_assignmentgroups(assignmentgroups, file_name, archive_typ... | bsd-3-clause | 2d8c5751b4b9493ac964fa3eb8b2bd84 | 40 | 88 | 0.598916 | 4.279389 | false | false | false | false |
devilry/devilry-django | devilry/devilry_import_v2database/tests/test_modelimporters/test_periodimporter.py | 1 | 9128 | import unittest
from django import test
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from model_bakery import baker
from devilry.apps.core.models import Period
from devilry.devilry_account import models as account_models
from devilry.devilry_account.models import Subject... | bsd-3-clause | 9847f1e32c6b76f71fa41ef952813b91 | 49.994413 | 112 | 0.656661 | 3.528411 | false | true | false | false |
devilry/devilry-django | devilry/utils/anonymize_database.py | 1 | 6282 | # -*- coding: utf-8 -*-
import random
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
from django.db.models import CharField
from django.db.models.functions import Concat
from devilry.devilry_account.models import UserEmail, UserName
from devilry.devilry_... | bsd-3-clause | f192efa1eea88b435c584eeaaf2315ff | 36.171598 | 111 | 0.630054 | 3.730404 | false | false | false | false |
devilry/devilry-django | devilry/devilry_dbcache/tests/test_groupcomment_triggers.py | 1 | 5750 | # -*- coding: utf-8 -*-
from django import test
from django.conf import settings
from django.core.files.base import ContentFile
from model_bakery import baker
from devilry.devilry_dbcache.customsql import AssignmentGroupDbCacheCustomSql
from devilry.devilry_comment.models import Comment, CommentEditHistory
from devi... | bsd-3-clause | 582fb11ad4158343f1793465a85b9290 | 52.738318 | 109 | 0.704522 | 3.869448 | false | true | false | false |
devilry/devilry-django | devilry/devilry_email/feedback_email/feedback_email.py | 1 | 6466 | from django.utils.translation import gettext_lazy
import django_rq
from cradmin_legacy.crinstance import reverse_cradmin_url
from devilry.devilry_message.models import Message
from devilry.devilry_message.utils.subject_generator import SubjectTextGenerator
from devilry.devilry_email.utils import get_student_users_in_... | bsd-3-clause | 723e82b2a87434de250eeb5de7f42d69 | 39.4125 | 104 | 0.657903 | 3.95716 | false | false | false | false |
devilry/devilry-django | devilry/devilry_admin/views/subject/crinstance_subject.py | 1 | 2615 | from devilry.apps.core.models import Subject
from devilry.devilry_account.models import SubjectPermissionGroup
from devilry.devilry_cradmin import devilry_crinstance
from devilry.devilry_admin.cradminextensions import devilry_crmenu_admin
from devilry.devilry_admin.views.subject import admins
from devilry.devilry_admin... | bsd-3-clause | 13590d0e866331afb1f92274295e747d | 36.898551 | 114 | 0.68413 | 3.688293 | false | false | false | false |
devilry/devilry-django | devilry/devilry_group/migrations/0032_auto_20180214_1654.py | 1 | 4638 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-14 15:54
import devilry.apps.core.models.custom_db_fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies =... | bsd-3-clause | cb6f4323ed56057ed7f3191f0fdda404 | 47.3125 | 292 | 0.646615 | 4.239488 | false | false | false | false |
devilry/devilry-django | devilry/devilry_group/admin.py | 1 | 3612 | from django.contrib import admin
from devilry.devilry_group import models
class FeedbackSetAdmin(admin.ModelAdmin):
list_display = [
'id',
'group_id',
'get_students',
'deadline_datetime',
'feedbackset_type',
'grading_published_datetime',
'grading_points'
... | bsd-3-clause | 4c24f0a416ceb71dea0ffe039f3d5360 | 23.405405 | 97 | 0.611296 | 3.786164 | false | false | false | false |
devilry/devilry-django | devilry/utils/tests/test_groups_groupedby_relatedstudent_and_assignment.py | 1 | 4771 | import unittest
from django.test import TestCase
from devilry.apps.core.testhelper import TestHelper
from devilry.utils.groups_groupedby_relatedstudent_and_assignment import GroupsGroupedByRelatedStudentAndAssignment
@unittest.skip('Tests must be rewritten with baker.')
class GroupsGroupedByRelatedStudentAndAssignmen... | bsd-3-clause | 24f8f86cbd457900b558be83dc001cbf | 55.809524 | 115 | 0.69608 | 3.571108 | false | true | false | false |
devilry/devilry-django | devilry/devilry_admin/views/period/students.py | 1 | 12467 |
from cradmin_legacy import crapp
from cradmin_legacy.crispylayouts import DangerSubmit
from django.contrib import messages
from django.http import Http404
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy
from devilry.apps.core.models import RelatedStudent, Assignm... | bsd-3-clause | 96f36157af2a336b58276c67654db575 | 39.346278 | 119 | 0.652523 | 3.882591 | false | false | false | false |
devilry/devilry-django | devilry/apps/core/tests/test_candidate.py | 1 | 8276 | from datetime import timedelta
import mock
from django import test
from django.utils import timezone
from model_bakery import baker
from devilry.apps.core.models import Candidate
class TestCandidateQuerySet(test.TestCase):
def test_filter_has_passing_grade(self):
testassignment = baker.make('core.Assign... | bsd-3-clause | d59a03d754ab26c159c145b1435a875b | 52.051282 | 101 | 0.610077 | 4.454252 | false | true | false | false |
devilry/devilry-django | devilry/devilry_admin/views/assignment/deadline_handling.py | 1 | 4829 |
from crispy_forms import layout
from django import forms
from django.http import Http404
from django.utils.translation import pgettext_lazy
from cradmin_legacy.viewhelpers.crudbase import OnlySaveButtonMixin
from cradmin_legacy.viewhelpers.update import UpdateView
from devilry.apps.core import models as coremodels
f... | bsd-3-clause | 2c50d8c0d095d020335c0768b8cf11fa | 47.29 | 119 | 0.663698 | 4.258377 | false | false | false | false |
devilry/devilry-django | devilry/devilry_admin/views/assignment/students/manage_deadlines.py | 1 | 1329 | # -*- coding: utf-8 -*-
from cradmin_legacy import crapp
from cradmin_legacy.crinstance import reverse_cradmin_url
from devilry.devilry_deadlinemanagement.cradmin_app import AdminDeadlineManagementApp
from devilry.devilry_deadlinemanagement.views import deadline_listview
from devilry.devilry_deadlinemanagement.views... | bsd-3-clause | 06e58195f5a5aab5a9eefa8f0178fb4e | 33.076923 | 95 | 0.734387 | 3.808023 | false | false | false | false |
devilry/devilry-django | devilry/devilry_student/views/period/overview.py | 1 | 3973 |
from django.utils.translation import gettext_lazy, pgettext_lazy
from cradmin_legacy import crapp
from cradmin_legacy.crinstance import reverse_cradmin_url
from cradmin_legacy.viewhelpers import listbuilderview
from cradmin_legacy.viewhelpers import listfilter
from devilry.apps.core import models as coremodels
from ... | bsd-3-clause | 3cf3214136987515b0fad39a64f29841 | 37.201923 | 92 | 0.639064 | 3.961117 | false | false | false | false |
devilry/devilry-django | devilry/django_decoupled_docs/registry.py | 1 | 2123 | from django.conf import settings
class DocProxy(object):
def __init__(self, **languages):
self.urls = {}
self.addmany(**languages)
def addmany(self, **languages):
for languagecode, url in languages.items():
self.add_for_language(languagecode, url)
def add_for_languag... | bsd-3-clause | 75866506100d69416314c3200c096c7e | 30.235294 | 100 | 0.637306 | 4.20396 | false | false | false | false |
devilry/devilry-django | devilry/devilry_i18n/middleware.py | 1 | 1322 | from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils import translation
from django.utils.deprecation import MiddlewareMixin
class LocaleMiddleware(MiddlewareMixin):
"""
Locale selecting middleware that will look at the languagecode in the
DevilryUserProfile... | bsd-3-clause | 839873f435656f62eed12ae85e0a05ab | 35.722222 | 73 | 0.686082 | 4.914498 | false | false | false | false |
devilry/devilry-django | devilry/devilry_superadmin/management/commands/devilry_anonymize_database.py | 1 | 2214 | from allauth.socialaccount.models import SocialAccount, SocialToken, SocialApp
from django.contrib.auth import get_user_model
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import transaction
from devilry.devilry_comment.models import Comment
from dev... | bsd-3-clause | 61b9a86debc7f6d2baf3555613decaa6 | 41.576923 | 111 | 0.644986 | 4.209125 | false | false | false | false |
devilry/devilry-django | not_for_deploy/sysadmin_example_scripts/student_statistics.py | 1 | 6093 | #!/usr/bin/env python
import os
import django
import argparse
import arrow
from django.db import models
from django.utils import timezone
def get_arguments():
parser = argparse.ArgumentParser(description='Fetch delivery statistics for Devilry users.')
parser.add_argument(
'--username-list',
... | bsd-3-clause | 8d88417a2d8202c4956d4ca210d2b62a | 35.48503 | 107 | 0.567044 | 4.473568 | false | false | false | false |
devilry/devilry-django | devilry/devilry_message/migrations/0001_initial.py | 1 | 3597 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-01-09 15:28
from django.conf import settings
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migratio... | bsd-3-clause | d5155b667716e9172b0dc91e3bf98d49 | 63.232143 | 296 | 0.631359 | 4.059819 | false | false | false | false |
devilry/devilry-django | devilry/devilry_group/models.py | 1 | 34983 | # -*- coding: utf-8 -*-
import warnings
import json
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import OuterRef
from django.db.models.functions import Coalesce
from django.utils import timezone
from django.utils.translation im... | bsd-3-clause | b1443be429528debf906c04edd824012 | 37.698009 | 121 | 0.641912 | 4.189581 | false | false | false | false |
devilry/devilry-django | devilry/devilry_admin/views/assignment/gradingconfiguration.py | 1 | 8605 |
import json
from crispy_forms import layout
from django import forms
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import pgettext_lazy, gettext_lazy, pgettext
... | bsd-3-clause | f5d0e1f6e997f95c188e70b65ab0438f | 40.771845 | 111 | 0.626496 | 3.94363 | false | true | false | false |
devilry/devilry-django | devilry/devilry_import_v2database/modelimporters/modelimporter_utils.py | 1 | 2335 | import mimetypes
import sys
from django.conf import settings
class BulkCreator(object):
def __init__(self, model_class):
self.model_class = model_class
self.max_bulk_create = getattr(settings,
'DEVILRY_V2_DATABASE_MAX_BULK_CREATE_OVERRIDE',
... | bsd-3-clause | e48760422f018f5b4f7c53754f069d3b | 28.935897 | 90 | 0.591863 | 4.025862 | false | false | false | false |
devilry/devilry-django | devilry/utils/management.py | 1 | 3008 | import sys
from optparse import make_option
DEFAULT_ENCODING = 'utf-8'
def get_input_encoding():
""" Get the input encoding used for input to management commands.
:return: ``sys.stdin.encoding``
"""
return sys.stdin.encoding or sys.getdefaultencoding() or DEFAULT_ENCODING
def make_input_encoding_opt... | bsd-3-clause | 64cb768c8eee92a33caa459b2e3bf0c1 | 36.6 | 104 | 0.607048 | 4.378457 | false | false | false | false |
devilry/devilry-django | devilry/devilry_cradmin/devilry_listbuilder/period.py | 1 | 1861 |
from cradmin_legacy.viewhelpers import listbuilder
class AdminItemValueMixin(object):
"""
Item value for a Period in the admin UI.
"""
valuealias = 'period'
template_name = 'devilry_cradmin/devilry_listbuilder/period/admin-itemvalue.django.html'
def get_title(self):
return self.perio... | bsd-3-clause | 34173530bc9f471d0c6c15fa8a0e39e6 | 32.836364 | 106 | 0.718431 | 3.722 | false | false | false | false |
devilry/devilry-django | devilry/utils/passed_in_previous_period.py | 1 | 11545 | import math
from django.core.exceptions import ValidationError
from django.db import models, transaction
from devilry.apps.core.models import Assignment
from devilry.apps.core.models import AssignmentGroup
from devilry.apps.core.models import Candidate
from devilry.devilry_group.models import FeedbackSet, Feedbackset... | bsd-3-clause | 80187b9527028c10c5005d824c59558b | 45.930894 | 119 | 0.680381 | 4.340226 | false | false | false | false |
devilry/devilry-django | devilry/devilry_examiner/views/assignment/bulkoperations/bulk_operations_grouplist.py | 1 | 11298 | # -*- coding: utf-8 -*-
from cradmin_legacy.viewhelpers import multiselect2, multiselect2view
from django import forms
from django.db import models
from django.db.models.functions import Concat, Lower
from django.utils.translation import gettext_lazy, pgettext_lazy
from devilry.apps.core import models as core_models... | bsd-3-clause | 7be15b916017e1b1312328fb4b2e4ed9 | 38.642105 | 120 | 0.638874 | 4.271456 | false | false | false | false |
devilry/devilry-django | devilry/devilry_deadlinemanagement/views/multiselect_groups_view.py | 1 | 8626 | # -*- coding: utf-8 -*-
from crispy_forms import layout
from django import forms
from django.utils.translation import gettext_lazy, pgettext_lazy
from cradmin_legacy.viewhelpers import multiselect2
from cradmin_legacy.viewhelpers import multiselect2view
from devilry.apps.core import models as core_models
from devilr... | bsd-3-clause | 0bdd6b4f0ed3245cafaaeb30c3b4057b | 41.284314 | 122 | 0.692326 | 4.123327 | false | false | false | false |
devilry/devilry-django | devilry/devilry_admin/views/assignment/passed_previous_period/__init__.py | 1 | 1276 | from cradmin_legacy import crapp
from devilry.devilry_admin.views.assignment.passed_previous_period import overview
from devilry.devilry_admin.views.assignment.passed_previous_period import passed_previous_period
from devilry.devilry_admin.views.assignment.passed_previous_period import passed_previous_semester_manual
... | bsd-3-clause | 05af5ee6ec6cced57dbbf0028e57d176 | 36.558824 | 105 | 0.623041 | 3.820359 | false | false | false | false |
devilry/devilry-django | devilry/apps/core/models/delivery.py | 1 | 13166 | from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q, Max
from django.utils import timezone
from django.utils.translation import gettext_lazy
from . import deliverytypes
from .deadline import Deadline
from .filemeta import FileMeta
from . import AbstractIsAdmin... | bsd-3-clause | 54bbe676f3d19a132b0c050939a03134 | 37.609971 | 119 | 0.623728 | 4.362492 | false | false | false | false |
devilry/devilry-django | devilry/apps/core/models/candidate.py | 1 | 4220 | from django.conf import settings
from django.db import models
from devilry.apps.core.models import RelatedStudent
from devilry.devilry_account.models import User
class CandidateQuerySet(models.QuerySet):
def filter_has_passing_grade(self, assignment):
"""
Filter only :class:`.Candidate` objects w... | bsd-3-clause | 7de417880fcb4bddf0c3cd15fe0133b9 | 39.970874 | 125 | 0.620616 | 4.446786 | false | false | false | false |
devilry/devilry-django | devilry/utils/GroupNodes.py | 1 | 3336 | from . import OrderedDict
def group_assignmentgroups(assignment_group_list):
"""
Groups a list of assignment_groups.
"""
return group_nodes(assignment_group_list, 2)
def group_assignments(assignment_list):
"""
Groups a list of assignments.
"""
return group_nodes(assignment_list, 1)
de... | bsd-3-clause | 77478b8f6c5c135cc607bdfa34bc3194 | 30.17757 | 104 | 0.579736 | 4.01444 | false | false | false | false |
devilry/devilry-django | devilry/devilry_rest/testclient.py | 1 | 1493 | from django.test import Client
import json
class RestClient(Client):
"""
Extends the ``django.test.Client`` with methods for the REST verbs and
application/json.
"""
def _load_json(self, content):
if content.strip() == '':
return None
try:
return json.loads... | bsd-3-clause | e69e8d6fa4c5079282d04227eda92be4 | 33.72093 | 74 | 0.519759 | 4.680251 | false | false | false | false |
devilry/devilry-django | devilry/apps/core/models/custom_db_fields.py | 1 | 1523 | import re
from django.utils.translation import gettext_lazy
from django.core.exceptions import ValidationError
from django.db import models
class ShortNameField(models.SlugField):
""" Short name field used by several of the core models.
We have a hierarchy of objects with a short name, but they are not
... | bsd-3-clause | 45f0409348a1dd5baf87c4811683d79c | 34.418605 | 90 | 0.594222 | 4.061333 | false | false | false | false |
devilry/devilry-django | devilry/devilry_superadmin/management/commands/devilry_subjectsearch.py | 1 | 2015 | from django.core.management.base import BaseCommand
from devilry.apps.core.models import Subject
from devilry.utils.management import add_output_encoding_argument
class NodeSearchBase(BaseCommand):
nodecls = None
args = '[search|empty for all]'
attrs = ['short_name', 'long_name']
def add_arguments(s... | bsd-3-clause | 13213774e7e5077da68c037b9bcfd0c4 | 32.583333 | 84 | 0.57469 | 3.966535 | false | false | false | false |
devilry/devilry-django | devilry/devilry_qualifiesforexam/admin.py | 1 | 1670 | from django.contrib import admin
from devilry.devilry_qualifiesforexam.models import Status, QualifiesForFinalExam
class QualifiesForFinalExamInline(admin.TabularInline):
model = QualifiesForFinalExam
raw_id_fields = [
'relatedstudent'
]
fields = ['relatedstudent', 'qualifies']
readonly_fi... | bsd-3-clause | bd74d23974b1f7f690e4f5202929a1bd | 22.194444 | 81 | 0.590419 | 3.711111 | false | false | false | false |
devilry/devilry-django | devilry/devilry_admin/tests/subject_for_period_admin/test_subject_redirect.py | 1 | 2259 |
import mock
from django.conf import settings
from django.http import Http404
from django.test import TestCase
from cradmin_legacy import cradmin_testhelpers
from model_bakery import baker
from devilry.devilry_admin.views.subject_for_period_admin import subject_redirect
class TestSubjectRedirect(TestCase, cradmin_t... | bsd-3-clause | 98825fecec806836de79de5da2ce8ffe | 46.0625 | 113 | 0.729969 | 3.777592 | false | true | false | false |
devilry/devilry-django | devilry/devilry_gradingsystem/tests/views/admin/test_setmaxpoints.py | 1 | 5365 | import unittest
from mock import patch
from django.urls import reverse
from django.test import TestCase
from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder
from devilry.project.develop.testhelpers.corebuilder import UserBuilder
from devilry.project.develop.testhelpers.soupselect import cssGet
fro... | bsd-3-clause | 3f7f5419412d74b7fe87052cdef66186 | 48.675926 | 98 | 0.695806 | 4.033835 | false | true | false | false |
devilry/devilry-django | devilry/devilry_frontpage/tests/test_frontpage.py | 1 | 5918 | from django.conf import settings
from django.test import TestCase
from cradmin_legacy import cradmin_testhelpers
from model_bakery import baker
from devilry.devilry_account.models import PermissionGroup
from devilry.devilry_frontpage.views import frontpage
class TestFrontpage(TestCase, cradmin_testhelpers.TestCaseMi... | bsd-3-clause | 7778b539c255f73052ca4be9f753bd6c | 56.456311 | 117 | 0.710206 | 3.97448 | false | true | false | false |
devilry/devilry-django | devilry/devilry_statistics/tests/test_api_examiner_average_grading_points.py | 1 | 11199 | from django import test
from model_bakery import baker
from devilry.apps.core.models import Assignment
from devilry.devilry_account.models import PermissionGroup
from devilry.devilry_dbcache.customsql import AssignmentGroupDbCacheCustomSql
from devilry.utils.api import api_test_mixin
from devilry.devilry_statistics.ap... | bsd-3-clause | 738e9c7462669b2e1ed95c068432f149 | 56.137755 | 120 | 0.664791 | 3.944699 | false | true | false | false |
devilry/devilry-django | devilry/devilry_gradingsystem/views/admin/base.py | 1 | 3550 | from django.urls import reverse
from django.views.generic.detail import SingleObjectMixin
from django.http import Http404
from django.utils.translation import gettext_lazy
from devilry.apps.core.models import Assignment
from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginNotInRegistryError
cl... | bsd-3-clause | 013ed70362e37a88f964448f8555aee4 | 34.858586 | 123 | 0.661127 | 3.914002 | false | false | false | false |
devilry/devilry-django | devilry/devilry_dbcache/tests/test_bulk_create_queryset_mixin.py | 1 | 2501 |
from django import test
from devilry.devilry_dbcache.devilry_dbcache_testapp.models import Person
class TestBulkCreateQuerySetMixin(test.TestCase):
def test_sanity(self):
bulk_operation = Person.objects.postgres_bulk_create([
Person(name='test1'),
Person(name='test2'),
... | bsd-3-clause | a0ef878b5a9ff0fec0baa91094201e70 | 39.33871 | 74 | 0.62615 | 3.847692 | false | true | false | false |
devilry/devilry-django | devilry/devilry_admin/views/common/bulkimport_users_common.py | 1 | 5904 | import re
from crispy_forms import layout
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.http import HttpResponseRedirect, Http404
from django.utils.translation import gettext_lazy
from cradmin_l... | bsd-3-clause | c5a4a8a8909a67d12249bf6f5dd753b0 | 39.163265 | 125 | 0.592988 | 4.163611 | false | false | false | false |
devilry/devilry-django | devilry/devilry_compressionutil/backend_registry.py | 1 | 2209 | from ievv_opensource.utils.singleton import Singleton
class DuplicateBackendTypeError(Exception):
"""
Exception raised when trying to add multiple :class:`.~devilry.devilry_ziputil.backends.PythonZipFileBackend`
with same ID.
"""
class Registry(Singleton):
"""
Registry for subclasses of
... | bsd-3-clause | b80fc54f0638646de601af448bcff22e | 25.939024 | 113 | 0.583522 | 4.47166 | false | false | false | false |
devilry/devilry-django | devilry/devilry_group/feedbackfeed_builder/feedbackfeed_timelinebuilder.py | 1 | 10659 | # -*- coding: utf-8 -*-
import collections
import datetime
# Django imports
import functools
from django.utils import timezone
# Devilry/cradmin imports
from devilry.devilry_group.models import GroupComment
from devilry.devilry_group.feedbackfeed_builder import builder_base
class AbstractTimelineBuilder(object):... | bsd-3-clause | ced0bc4c0b1c32cc880ba09934c92cf3 | 37.76 | 120 | 0.597992 | 4.291063 | false | false | false | false |
devilry/devilry-django | devilry/devilry_admin/views/period/manage_tags/manage_tags.py | 1 | 24353 | # -*- coding: utf-8 -*-
import re
from django import forms
from django.db import models
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db import transaction
from django.http import Http404
from django.http import HttpResponseRedirect
from django.utils import timezo... | bsd-3-clause | c870d67fd9f357383c9c8d0f4fe80901 | 36.523883 | 111 | 0.628834 | 3.837535 | false | false | false | false |
mozilla/zamboni | mkt/site/tests/test_storage_utils.py | 7 | 5118 | from functools import partial
import os
import tempfile
import unittest
from django.core.files.base import ContentFile
from django.test.utils import override_settings
import mock
from nose.tools import eq_
from mkt.site.storage_utils import (copy_stored_file, get_private_storage,
... | bsd-3-clause | 47b80e47f0e3b9e258e17c15d63fed53 | 36.357664 | 77 | 0.579523 | 3.622081 | false | true | false | false |
mozilla/zamboni | mkt/reviewers/migrations/0001_initial.py | 13 | 4165 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AdditionalReview',
fields=[
('id', models.AutoF... | bsd-3-clause | beb8c91c4dc063de776973c75937ea93 | 42.842105 | 459 | 0.527251 | 4.507576 | false | false | false | false |
mozilla/zamboni | mkt/ratings/helpers.py | 6 | 1160 | import jingo
from django.utils.translation import ugettext as _
from mkt.access import acl
@jingo.register.filter
def stars(num, large=False):
# check for 0.0 incase None was cast to a float. Should
# be safe since lowest rating you can give is 1.0
if num is None or num == 0.0:
return _('Not yet ... | bsd-3-clause | cf764bcf42ea445b2a68799771febe64 | 32.142857 | 77 | 0.64569 | 3.625 | false | false | false | false |
mozilla/zamboni | mkt/zadmin/management/commands/removeuserfromgroup.py | 5 | 1468 | from django.core.management.base import BaseCommand, CommandError
import commonware.log
from mkt.access.models import Group, GroupUser
from mkt.users.models import UserProfile
class Command(BaseCommand):
help = ('Remove a user from a group. Syntax: \n'
' ./manage.py removeuserfromgroup <user_id|e... | bsd-3-clause | 04a8f7646f4e3b89b08331b1e22b6b98 | 30.234043 | 77 | 0.616485 | 4.021918 | false | false | false | false |
mozilla/zamboni | mkt/constants/ratingsbodies.py | 4 | 9472 | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _lazy
NAME_GENERAL = _lazy('For all ages')
# L10n: %d is the age in years. For ages %d and higher.
NAME_LAZY = _lazy('For ages %d+') # Fill this in after accessing.
NAME_REJECTED = _lazy(u'Rating Rejected')
NAME_PENDING = _lazy(u'Rating Pe... | bsd-3-clause | 74e8b2c128be5c903de2863beba3dd86 | 20.625571 | 79 | 0.561339 | 2.994625 | false | false | false | false |
mozilla/zamboni | mkt/account/serializers.py | 6 | 5566 | from functools import partial
from rest_framework import fields, serializers
import mkt
from mkt.access import acl
from mkt.access.models import Group
from mkt.api.serializers import PotatoCaptchaSerializer
from mkt.users.models import UserProfile
class AccountSerializer(serializers.ModelSerializer):
display_n... | bsd-3-clause | f4a8a96d3ae72c167ad0903950e97141 | 33.7875 | 79 | 0.642831 | 4.334891 | false | false | false | false |
mozilla/zamboni | mkt/comm/filters.py | 6 | 1440 | from django.db.models import Q
from rest_framework.filters import BaseFilterBackend
from mkt.users.models import UserProfile
class NoteContentFilter(BaseFilterBackend):
"""
Filter that searches note content based on `q`.
Query must be at least two characters.
"""
def filter_queryset(self, request... | bsd-3-clause | 3d9c63a6a8048b24ffaa39163fecd159 | 35 | 74 | 0.623611 | 4.149856 | false | false | false | false |
mozilla/zamboni | mkt/site/management/commands/resave_purified_translations.py | 6 | 1651 | from django.core.management.base import BaseCommand
from mkt.feed.models import (FeedApp, FeedCollection, FeedCollectionMembership,
FeedShelf, FeedShelfMembership)
from mkt.versions.models import Version
from mkt.webapps.models import Webapp
from mkt.site.tasks import update_translations
f... | bsd-3-clause | e0957bc62a53df739fc5c874e226e538 | 35.688889 | 79 | 0.642035 | 4.148241 | false | false | false | false |
mozilla/zamboni | mkt/feed/indexers.py | 17 | 12728 | """
Indexers for FeedApp, FeedBrand, FeedCollection, FeedShelf, FeedItem for
feed homepage and curation tool search.
"""
import mkt.carriers
import mkt.feed.constants as feed
import mkt.regions
from mkt.search.indexers import BaseIndexer
from mkt.translations.models import attach_trans_dict
from mkt.webapps.models impo... | bsd-3-clause | 29a594a40791083d53e1576fe8eec47a | 35.574713 | 78 | 0.494107 | 4.256856 | false | false | false | false |
mozilla/zamboni | mkt/developers/utils.py | 6 | 6499 | import os
import uuid
from datetime import datetime
from django.conf import settings
from django.template.defaultfilters import filesizeformat
from appvalidator.constants import PRERELEASE_PERMISSIONS
import commonware.log
from PIL import Image
from django.utils.translation import ugettext as _
import mkt
from lib.v... | bsd-3-clause | f35f10acaa76a640436ef41f5402afd9 | 35.105556 | 79 | 0.58809 | 3.809496 | false | false | false | false |
mozilla/zamboni | mkt/submit/forms.py | 3 | 14839 | import datetime
import os
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
import basket
import happyforms
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
import mkt
from mkt.comm.utils import create_comm_note
from mkt.constants import... | bsd-3-clause | ab96e75fcfa1e9d190a2c0583eb6f622 | 40.105263 | 79 | 0.598827 | 4.11737 | false | false | false | false |
gitpython-developers/gitpython | git/objects/commit.py | 1 | 27232 | # commit.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import datetime
import re
from subprocess import Popen, PIPE
from gitdb import IStream
from git.util i... | bsd-3-clause | 5729a23615d51f7cc899b303a7b0212c | 34.737533 | 113 | 0.567935 | 4.336996 | false | false | false | false |
cqlengine/cqlengine | cqlengine/management.py | 1 | 11044 | import json
import warnings
import six
from cqlengine import SizeTieredCompactionStrategy, LeveledCompactionStrategy
from cqlengine import ONE
from cqlengine.named import NamedTable
from cqlengine.connection import execute, get_cluster
from cqlengine.exceptions import CQLEngineException
import logging
from collection... | bsd-3-clause | 91e7ef014164d7313581bd48161aadf0 | 33.404984 | 118 | 0.650308 | 3.91215 | false | false | false | false |
altair-viz/altair | altair/examples/diverging_stacked_bar_chart.py | 2 | 8736 | """
Diverging Stacked Bar Chart
---------------------------
This example shows a diverging stacked bar chart for sentiments towards a set of eight questions, displayed as percentages with neutral responses straddling the 0% mark.
"""
# category: bar charts
import altair as alt
source = alt.pd.DataFrame([
{
... | bsd-3-clause | 07f1e2b185d661aca35e556209d83bda | 22.803815 | 169 | 0.45158 | 3.590629 | false | false | false | false |
altair-viz/altair | altair/examples/normed_parallel_coordinates.py | 1 | 1293 | """
Normalized Parallel Coordinates
-------------------------------
A `Parallel Coordinates <https://en.wikipedia.org/wiki/Parallel_coordinates>`_
chart is a chart that lets you visualize the individual data points by drawing
a single line for each of them.
Such a chart can be created in Altair by first transforming t... | bsd-3-clause | be78504c8932440dd3564a6f244df740 | 30.536585 | 121 | 0.71075 | 3.561983 | false | false | false | false |
altair-viz/altair | altair/expr/tests/test_expr.py | 2 | 2880 | import operator
import pytest
from ... import expr
from .. import datum
def test_unary_operations():
OP_MAP = {"-": operator.neg, "+": operator.pos}
for op, func in OP_MAP.items():
z = func(datum.xxx)
assert repr(z) == "({}datum.xxx)".format(op)
def test_binary_operations():
OP_MAP = {... | bsd-3-clause | af83204272c080cdad5bf0f4d623e4b8 | 26.169811 | 87 | 0.532986 | 3.283922 | false | true | false | false |
alphacsc/alphacsc | alphacsc/learn_d_z_multi.py | 1 | 17185 | # Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>
# Tom Dupre La Tour <tom.duprelatour@telecom-paristech.fr>
# Umut Simsekli <umut.simsekli@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Thomas Moreau <thomas.moreau@inria.fr>
from __future__ import ... | bsd-3-clause | 9e336332007c19965cb7ac5731bfa34a | 37.359375 | 89 | 0.557288 | 3.813804 | false | false | false | false |
django-nonrel/django-nonrel | tests/modeltests/many_to_many/tests.py | 92 | 17756 | from django.test import TestCase
from models import Article, Publication
class ManyToManyTests(TestCase):
def setUp(self):
# Create a couple of Publications.
self.p1 = Publication.objects.create(id=None, title='The Python Journal')
self.p2 = Publication.objects.create(id=None, title='Scien... | bsd-3-clause | af5960c635ad819c08633ea313ff9503 | 45.239583 | 113 | 0.566625 | 4.595238 | false | false | false | false |
batiste/django-page-cms | pages/views.py | 1 | 8526 | """Default example views"""
from pages import settings
from pages.models import Page, PageAlias
from pages.phttp import get_language_from_request, remove_slug
from pages.urlconf_registry import get_urlconf
from pages.utils import get_placeholders
from django.http import Http404, HttpResponsePermanentRedirect
from djan... | bsd-3-clause | d2f4a2bffba458d944f765b35aac23da | 33.518219 | 78 | 0.612714 | 4.358896 | false | false | false | false |
django-nonrel/django-nonrel | django/utils/version.py | 320 | 1361 | import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path is provided, it should be a dir... | bsd-3-clause | 73c6944b52dd1320aa5e09161e6cddb3 | 31.404762 | 81 | 0.606907 | 4.07485 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/admin/widgets.py | 156 | 12061 | """
Form Widget classes specific to the Django admin site.
"""
import django.utils.copycompat as copy
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.html import escape
from django.utils.text import truncate_words
from django.utils.t... | bsd-3-clause | 0cdcdfcfdff0024fe46575d0f797506d | 39.746622 | 157 | 0.620595 | 3.807134 | false | false | false | false |
django-nonrel/django-nonrel | django/db/models/fields/related.py | 20 | 54904 | from django.conf import settings
from django.db import connection, router, transaction, connections
from django.db.backends import util
from django.db.models import signals, get_model
from django.db.models.fields import (AutoField, Field, IntegerField,
PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotEx... | bsd-3-clause | 0538fba385c60894ba19579e4ca134b5 | 45.926496 | 222 | 0.60236 | 4.152787 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/forms/localflavor/cl.py | 86 | 2290 | from django.contrib.localflavor.cl.forms import CLRutField, CLRegionSelect
from django.core.exceptions import ValidationError
from utils import LocalFlavorTestCase
class CLLocalFlavorTests(LocalFlavorTestCase):
def test_CLRegionSelect(self):
f = CLRegionSelect()
out = u'''<select name="foo">
<opt... | bsd-3-clause | 299e2f60826a5ddbf9fe92a749e734f9 | 39.175439 | 91 | 0.627074 | 2.858926 | false | true | false | false |
django-nonrel/django-nonrel | django/contrib/comments/forms.py | 245 | 8730 | import time
import datetime
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from models import Comment
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.encoding import force_... | bsd-3-clause | f39a6a2c4c7294e841260bcee9764005 | 41.378641 | 106 | 0.609393 | 4.225557 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/admin/filterspecs.py | 5 | 12482 | """
FilterSpec encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
from django.db import models
from djan... | bsd-3-clause | d30b438449abbd4972dfda25835ff9f4 | 43.262411 | 79 | 0.532046 | 4.184378 | false | false | false | false |
django-nonrel/django-nonrel | django/views/generic/base.py | 56 | 6110 | from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template import RequestContext, loader
from django.template.response import TemplateResponse
from django.utils.functional import update_wrapper
from django.utils.log import getLogger
from django.utils.decorators import classonly... | bsd-3-clause | c7ae8407caaf7bc95e8445289344373d | 33.325843 | 89 | 0.584452 | 4.472914 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/modeladmin/tests.py | 49 | 41260 | from datetime import date
from django import forms
from django.conf import settings
from django.contrib.admin.options import ModelAdmin, TabularInline, \
HORIZONTAL, VERTICAL
from django.contrib.admin.sites import AdminSite
from django.contrib.admin.validation import validate
from django.contrib.admin.widgets impo... | bsd-3-clause | 7ced025350d63c734c94c90d26921ef7 | 32.57201 | 188 | 0.604823 | 5.178863 | false | true | false | false |
django-nonrel/django-nonrel | django/middleware/common.py | 157 | 6658 | import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.hashcompat import md5_constructor
from django.utils.log import getLogger
logger = getLogger('django.request')
cl... | bsd-3-clause | 4a2a42105ab8d58eb2439e81d4ce647f | 41.139241 | 125 | 0.579303 | 4.295484 | false | false | false | false |
django-nonrel/django-nonrel | django/views/generic/date_based.py | 246 | 14025 | import datetime
import time
from django.template import loader, RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.core.xheaders import populate_xheaders
from django.db.models.fields import DateTimeField
from django.http import Http404, HttpResponse
import warnings
warnings.warn(
'Fu... | bsd-3-clause | 2cf51060bef57f0912f99bb1e2534df0 | 36.4 | 156 | 0.624171 | 3.772189 | false | false | false | false |
django-nonrel/django-nonrel | tests/modeltests/delete/models.py | 51 | 3216 | from django.db import models, IntegrityError
class R(models.Model):
is_default = models.BooleanField(default=False)
def __str__(self):
return "%s" % self.pk
get_default_r = lambda: R.objects.get_or_create(is_default=True)[0]
class S(models.Model):
r = models.ForeignKey(R)
class T(models.Mod... | bsd-3-clause | 84f57c6eec2f6a94210d0b69b15d07ea | 29.339623 | 83 | 0.672886 | 3.332642 | false | false | false | false |
django-nonrel/django-nonrel | django/core/serializers/pyyaml.py | 204 | 1948 | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as... | bsd-3-clause | bc8800443751803de321771607a2ee26 | 33.785714 | 88 | 0.698152 | 4.041494 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/utils/http.py | 1 | 2647 | from django.utils import http
from django.utils import unittest
from django.http import HttpResponse, utils
from django.test import RequestFactory
class TestUtilsHttp(unittest.TestCase):
def test_same_origin_true(self):
# Identical
self.assertTrue(http.same_origin('http://foo.com/', 'http://foo.co... | bsd-3-clause | d6ac8924abff01db10d0dfdc1049cc63 | 36.28169 | 90 | 0.615791 | 3.765292 | false | true | false | false |
django-nonrel/django-nonrel | tests/modeltests/one_to_one/tests.py | 92 | 5714 | from django.test import TestCase
from django.db import transaction, IntegrityError
from models import Place, Restaurant, Waiter, ManualPrimaryKey, RelatedModel, MultiModel
class OneToOneTests(TestCase):
def setUp(self):
self.p1 = Place(name='Demon Dogs', address='944 W. Fullerton')
self.p1.save()
... | bsd-3-clause | ddd6eaaa1a27ea71b4fe829175ee209b | 47.016807 | 95 | 0.644207 | 3.533704 | false | true | false | false |
django-nonrel/django-nonrel | django/core/management/commands/loaddata.py | 250 | 11042 | import sys
import os
import gzip
import zipfile
from optparse import make_option
from django.conf import settings
from django.core import serializers
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.db import connections, router, transaction, DEFAULT_DB_... | bsd-3-clause | 844e9250485b541c9d5d36ade418b6b5 | 44.440329 | 120 | 0.494747 | 5.112037 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/forms/tests/error_messages.py | 50 | 10684 | # -*- coding: utf-8 -*-
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import *
from django.test import TestCase
from django.utils.safestring import mark_safe
from django.utils import unittest
class AssertFormErrorsMixin(object):
def assertFormErrors(self, expected, the_callable, *... | bsd-3-clause | 2cd30a1a1940b4e6b2335883f0fd94fc | 41.229249 | 119 | 0.576376 | 3.707148 | false | true | false | false |
django-nonrel/django-nonrel | django/contrib/sites/models.py | 387 | 2867 | from django.db import models
from django.utils.translation import ugettext_lazy as _
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
project's settings. The ``Site`` object is cached the first
... | bsd-3-clause | 00419150de256afd476779458285a10e | 29.178947 | 203 | 0.62016 | 4.298351 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/sitemaps/views.py | 232 | 2084 | from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.utils.encoding import smart_str
from django.core.paginator import EmptyPage, PageNotAnInteger
def index(request, sitemaps, template_... | bsd-3-clause | 63206ef53591de72647b4f170d95b86c | 43.340426 | 112 | 0.644434 | 3.873606 | false | false | false | false |
django-nonrel/django-nonrel | django/http/__init__.py | 1 | 27956 | import datetime
import os
import re
import time
from pprint import pformat
from urllib import urlencode, quote
from urlparse import urljoin, urlparse
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
# The mod_python version is more efficient, so try importing it fir... | bsd-3-clause | fe6f525fc68a6374f73ac6a736567903 | 36.274667 | 134 | 0.587352 | 4.237042 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/admin_filterspecs/tests.py | 1 | 13279 | from django.contrib.auth.admin import UserAdmin
from django.test import TestCase
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.utils.encoding import force_unicode
from models ... | bsd-3-clause | cbcd6d0b957f3309729b462ffbb70570 | 47.290909 | 107 | 0.669779 | 4.023939 | false | true | false | false |
django-nonrel/django-nonrel | django/core/management/commands/flush.py | 249 | 3437 | from optparse import make_option
from django.conf import settings
from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS
from django.core.management import call_command
from django.core.management.base import NoArgsCommand, CommandError
from django.core.management.color import no_style
from d... | bsd-3-clause | f7fcc193eadf829ee0fcc5af5ed8402d | 40.914634 | 103 | 0.627 | 4.32327 | false | false | false | false |
django-nonrel/django-nonrel | django/conf/locale/sv/formats.py | 232 | 1365 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j F Y H:i'
YEAR_MONTH_FORMA... | bsd-3-clause | 39bdeb3c6931c11a6f615f4ae8e5f818 | 33.125 | 77 | 0.516484 | 2.55618 | false | false | true | false |
django-nonrel/django-nonrel | django/forms/fields.py | 5 | 37739 | """
Field classes.
"""
import datetime
import os
import re
import time
import urlparse
import warnings
from decimal import Decimal, DecimalException
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.core.exceptions import ValidationError
from django.core import ... | bsd-3-clause | 55273290521a7dad32c42c20233348db | 38.93545 | 134 | 0.608469 | 4.428421 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/utils/datastructures.py | 1 | 9928 | """
Tests for stuff in django.utils.datastructures.
"""
import pickle
import unittest
from django.utils.copycompat import copy
from django.utils.datastructures import *
class DatastructuresTestCase(unittest.TestCase):
def assertRaisesErrorWithMessage(self, error, message, callable,
*args, **kwargs):
... | bsd-3-clause | 26571b59fd2e1a01f47b6f15d3eeb2a7 | 34.081272 | 82 | 0.539988 | 3.597101 | false | true | false | false |
django-nonrel/django-nonrel | django/utils/timesince.py | 319 | 2698 | import datetime
import time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
... | bsd-3-clause | ee8dc73bdb1f7920b3ff4b7f0260ed91 | 38.101449 | 94 | 0.604151 | 3.631225 | false | false | false | false |
django-nonrel/django-nonrel | django/utils/datastructures.py | 4 | 15570 | from types import GeneratorType
from django.utils.copycompat import copy, deepcopy
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given d... | bsd-3-clause | 395442c361a330e4acc96547cc51ff6c | 30.202405 | 131 | 0.547206 | 4.243663 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/null_fk_ordering/tests.py | 92 | 2012 | from django.test import TestCase
from regressiontests.null_fk_ordering.models import *
class NullFkOrderingTests(TestCase):
def test_ordering_across_null_fk(self):
"""
Regression test for #7512
ordering across nullable Foreign Keys shouldn't exclude results
"""
author_1 =... | bsd-3-clause | abe2ee712ef02f3b31e16bc27fdd87ed | 50.589744 | 102 | 0.678926 | 3.96063 | false | true | false | false |
django-nonrel/django-nonrel | django/shortcuts/__init__.py | 254 | 4642 | """
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from django.http import HttpRespon... | bsd-3-clause | 9ade70de8891035ac652d8da5f8b4580 | 34.707692 | 90 | 0.67277 | 4.227687 | false | false | false | false |
django-nonrel/django-nonrel | django/core/files/storage.py | 158 | 9878 | import os
import errno
import urlparse
import itertools
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
from django.core.files import locks, File
from django.core.files.move import file_move_safe
from django.utils.encoding impo... | bsd-3-clause | 8bba6e99c51917efae11f48c4840bcd4 | 34.92 | 110 | 0.608828 | 4.475759 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/gis/geos/prototypes/predicates.py | 624 | 1777 | """
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis... | bsd-3-clause | b567108986cfb1c778c5d6ce8b50ccd1 | 39.386364 | 78 | 0.760833 | 3.725367 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.