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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jupyterhub/oauthenticator | oauthenticator/gitlab.py | 1 | 7764 | """
Custom Authenticator to use GitLab OAuth with JupyterHub
"""
import os
import warnings
from urllib.parse import quote
from jupyterhub.auth import LocalAuthenticator
from tornado.escape import url_escape
from tornado.httpclient import HTTPRequest
from traitlets import CUnicode, Set, Unicode, default
from .oauth2 i... | bsd-3-clause | 7d05d881fac97aac98d1d65b43d9bd7f | 33.202643 | 89 | 0.588614 | 3.983581 | false | false | false | false |
samuel/kokki | kokki/cookbooks/cloudkick/recipes/default.py | 1 | 2131 |
from kokki import Execute, Fail, File, Template, Package, Service
assert env.config.cloudkick.oauth_key and env.config.cloudkick.oauth_secret and env.config.cloudkick.hostname
apt_list_path = '/etc/apt/sources.list.d/cloudkick.list'
apt = None
if env.system.platform == "ubuntu":
ver = env.system.lsb['release']
... | bsd-3-clause | c998108a99c7d8ac224723d0b22845d0 | 34.516667 | 109 | 0.644768 | 3.194903 | false | false | false | false |
samuel/kokki | kokki/cookbooks/ssh/libraries/utils.py | 1 | 5290 |
import hashlib
import hmac
import os
from base64 import b64decode, b64encode
from kokki import Fail, Environment
class SSHKnownHostsFile(object):
def __init__(self, path=None):
self.hosts = []
self.parse(path)
def parse(self, path):
self.hosts = []
with open(path, "r") as fp:
... | bsd-3-clause | 86e9a329830079537e9b0948ea6231b9 | 30.117647 | 124 | 0.462571 | 3.956619 | false | false | false | false |
samuel/kokki | kokki/cookbooks/aws/libraries/volume.py | 1 | 1206 |
from kokki import Environment, Mount, Execute, Package
def setup_ebs_volume(name=None, availability_zone=None, volume_id=None, device=None, linux_device=None, snapshot_id=None, size=None, fstype=None, mount_point=None, fsoptions=None):
env = Environment.get_instance()
if linux_device is None:
linux_d... | bsd-3-clause | 408de29da1ddda0bdbe79ae9e7604d7d | 39.2 | 180 | 0.61194 | 3.526316 | false | false | false | false |
samuel/kokki | kokki/providers/package/emerge.py | 1 | 1953 |
from subprocess import Popen, STDOUT, PIPE, check_call
from kokki.base import Fail
from kokki.providers.package import PackageProvider
class GentooEmergeProvider(PackageProvider):
def get_current_status(self):
self.current_version = None
self.candidate_version = None
proc = Popen("qlist -... | bsd-3-clause | 20402337303c3667e89d5a0bbd33b76d | 41.456522 | 115 | 0.582693 | 4.077244 | false | false | false | false |
samuel/kokki | kokki/cookbooks/java/recipes/default.py | 2 | 1968 |
import os
from kokki import Package, Execute, File, Script
Package("debconf-utils")
Execute("apt-update-java",
command = "apt-get update",
action = "nothing")
if env.system.lsb['codename'] == 'karmic':
def enter_the_multiverse():
with open("/etc/apt/sources.list", "r") as fp:
source ... | bsd-3-clause | 3338be4fe88eefae0b131df16706a657 | 40 | 126 | 0.640244 | 2.995434 | false | false | false | false |
samuel/kokki | kokki/providers/package/__init__.py | 1 | 2458 |
from kokki.base import Fail
from kokki.providers import Provider
class PackageProvider(Provider):
def __init__(self, *args, **kwargs):
super(PackageProvider, self).__init__(*args, **kwargs)
self.get_current_status()
def get_current_status(self):
raise NotImplementedError()
... | bsd-3-clause | 1ce36f30dc8b7996c4885d2da7858b0b | 37.40625 | 127 | 0.643613 | 4.289703 | false | false | false | false |
hydroshare/hydroshare | hs_core/views/resource_rest_api.py | 1 | 37299 | import os
import mimetypes
import copy
import tempfile
import shutil
import logging
import json
from django.urls import reverse
from django.core.exceptions import ObjectDoesNotExist, SuspiciousFileOperation
from django.core.exceptions import ValidationError as CoreValidationError
from django.http import HttpResponseRe... | bsd-3-clause | 981703ed133fb25835e337ca465003e6 | 42.573598 | 111 | 0.617738 | 4.410951 | false | false | false | false |
hydroshare/hydroshare | hs_core/urls.py | 1 | 8536 | from django.conf.urls import url
from hs_core import views
from hs_core.views.autocomplete import autocomplete
urlpatterns = [
# internal API
url(r'^_internal/(?P<shortkey>[0-9a-f-]+)/add-files-to-resource/$',
views.add_files_to_resource, name='add_files_to_resource'),
url(r'^_internal/(?P<shortkey... | bsd-3-clause | cf722bc861e6c3c33b6eb176c4cfc17a | 70.731092 | 120 | 0.645619 | 2.966979 | false | false | true | false |
hydroshare/hydroshare | hs_core/views/autocomplete.py | 4 | 2796 | from django.contrib.auth.models import User
from hs_core.models import Contributor, Creator, Subject
from hs_core.hydroshare.utils import get_resource_types
from hs_core.views.utils import json_or_jsonp
def autocomplete(request):
term = request.GET.get('term')
resp = []
types = [t for t in get_resource_... | bsd-3-clause | 8c2e55225961e9bb8594f2eceb054665 | 34.392405 | 97 | 0.519313 | 4.099707 | false | false | false | false |
hydroshare/hydroshare | hs_core/management/commands/fix_missing_license_statement.py | 1 | 1255 | from django.core.management.base import BaseCommand
from hs_core.models import BaseResource
from hs_core.hydroshare import set_dirty_bag_flag
class Command(BaseCommand):
help = "Copies license URL as license statement if a value for license is missing in any resource"
def handle(self, *args, **options):
... | bsd-3-clause | 393beedf5cb2cd7aa3a79936344d1f9f | 40.833333 | 112 | 0.622311 | 4.498208 | false | false | false | false |
hydroshare/hydroshare | hs_core/views/resource_access_api.py | 1 | 7766 | from django.contrib.auth.models import Group
from rest_framework.response import Response
from rest_framework import generics, serializers
from rest_framework import status
from hs_core import hydroshare
from hs_core.hydroshare import utils
from hs_access_control.models import UserResourcePrivilege, GroupResourcePrivi... | bsd-3-clause | 29f3ff050562f61b4acb5a5c3d9bdd76 | 39.030928 | 98 | 0.589235 | 4.3507 | false | false | false | false |
hydroshare/hydroshare | hs_file_types/nc_functions/nc_dump.py | 1 | 5845 | """
Module used to get the header info of netcdf file
WORKFLOW:
There are two ways to get the netcdf header string.
1) method1 run ncdump -h by python subprocess module: get_nc_dump_string_by_ncdump()
2) method2 use the netCDF4 python lib to look into the netcdf to extract the the header info:
get_nc_dump_string()
... | bsd-3-clause | 37275416b57a8ae69d9605fb79e0b479 | 31.653631 | 108 | 0.616424 | 3.568376 | false | false | false | false |
hydroshare/hydroshare | hs_core/tests/api/views/test_group.py | 1 | 42071 | import os
import shutil
import json
from mock import patch
from django.test import Client
from django.urls import reverse
from django.contrib.auth.models import Group
from django.db import transaction
from django.utils.http import int_to_base36
from rest_framework import status
from hs_core import hydroshare
from hs... | bsd-3-clause | c340c1af246591242aa3901f48acab2a | 48.495294 | 120 | 0.656509 | 3.830556 | false | true | false | false |
hydroshare/hydroshare | hs_communities/management/commands/check_czo_groups.py | 1 | 13799 | """
Check that CZO groups are set up properly.
If a resource is owned by a CZO owner, and not part of the CZO group,
then add it to the group.
If a resource is in a CZO group and not owned by the corresponding group owner,
then make it owned by that owner.
If a resource owned by a CZO group owner is not owned by CZ... | bsd-3-clause | 3181b33da9b3874e40b821f465a35fc3 | 46.747405 | 104 | 0.558446 | 4.347511 | false | false | false | false |
hydroshare/hydroshare | hs_core/tests/api/rest/test_create_resource_version.py | 1 | 1071 | from rest_framework import status
from hs_core.hydroshare import resource
from .base import HSRESTTestCase
class TestCreateResourceVersion(HSRESTTestCase):
def setUp(self):
super(TestCreateResourceVersion, self).setUp()
self.rtype = 'GenericResource'
self.title = 'My Test resource'
... | bsd-3-clause | 6b96b38c25cd5c0828b9e4a67182a496 | 35.931034 | 73 | 0.637722 | 3.9375 | false | true | false | false |
hydroshare/hydroshare | hs_core/management/commands/check_bag.py | 1 | 12581 | # -*- coding: utf-8 -*-
"""
Generate metadata and bag for a resource from Django
"""
import os
import requests
from django.conf import settings
from django.core.management.base import BaseCommand
from hs_core.models import BaseResource
from hs_core.hydroshare import hs_requests
from hs_core.hydroshare.hs_bagit impor... | bsd-3-clause | 9333949270f038c91856deaf7b818632 | 42.382759 | 96 | 0.507193 | 4.678691 | false | false | false | false |
hydroshare/hydroshare | theme/management/commands/email_users.py | 1 | 1227 | from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.conf import settings
from django.contrib.auth.models import User
from theme.utils import get_quota_message
class Command(BaseCommand):
help = "Send users emails for reporting over-quota usages and warnings, etc... | bsd-3-clause | d8e763c99aa5fa9607346773b3e9b70f | 37.34375 | 81 | 0.568052 | 4.320423 | false | false | false | false |
hydroshare/hydroshare | hs_core/tests/api/rest/test_set_file_type.py | 1 | 7109 | import os
from django.core.files.uploadedfile import UploadedFile
from rest_framework import status
from hs_core.hydroshare import resource
from hs_core.hydroshare.utils import resource_file_add_process
from hs_core.views.utils import create_folder, move_or_rename_file_or_folder
from .base import HSRESTTestCase
c... | bsd-3-clause | ec564c292923c6ef438d7824121734e8 | 51.272059 | 98 | 0.604867 | 3.916804 | false | true | false | false |
hydroshare/hydroshare | theme/migrations/0017_phone_validation_message.py | 1 | 1384 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-05-10 21:40
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('theme', '0016_userprofile_phone_validations'),
]
ope... | bsd-3-clause | b359a4b6a1aedb5f060556396cc1e128 | 52.230769 | 414 | 0.690751 | 4.245399 | false | false | false | false |
hydroshare/hydroshare | hs_access_control/models/group.py | 1 | 17912 | from django.contrib.auth.models import User, Group
from django.db import models
from django.db.models import Q, F, Exists, OuterRef
from django.contrib.contenttypes.models import ContentType
from hs_core.models import BaseResource
from hs_access_control.models.privilege import PrivilegeCodes, UserGroupPrivilege
from h... | bsd-3-clause | a7c67395955711f1c0995d002207c0c8 | 40.752914 | 107 | 0.593904 | 4.662155 | false | false | false | false |
hydroshare/hydroshare | hs_tools_resource/utils.py | 1 | 1912 | import logging
from string import Template
from hs_collection_resource.models import CollectionResource
from hs_composite_resource.models import CompositeResource
logger = logging.getLogger(__name__)
def parse_app_url_template(url_template_string, term_dict_list=()):
"""
This func replaces pre-defined HS Te... | bsd-3-clause | 20ae771cda2e64ce4443cc7943d17c0c | 33.763636 | 101 | 0.664226 | 3.975052 | false | false | false | false |
hydroshare/hydroshare | hs_core/management/commands/modify_resource_id.py | 1 | 4041 | # -*- coding: utf-8 -*-
"""
Modify the resource id of an existing resource
"""
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ObjectDoesNotExist
from hs_core.models import BaseResource, short_id
from hs_core.hydroshare.utils import get_resource_by_shortkey
from h... | bsd-3-clause | d192f8f22f14d261d5387137fc610ddb | 38.23301 | 100 | 0.564712 | 4.540449 | false | false | false | false |
hydroshare/hydroshare | hs_core/management/commands/delete_hanging_logical_files.py | 1 | 2806 | """Removes hanging LogicalFiles in composite resources. Hanging LogicalFiles do not have a
Resource nor reference any files.
"""
from django.core.management.base import BaseCommand
from hs_file_types.models.generic import GenericLogicalFile
from hs_file_types.models.geofeature import GeoFeatureLogicalFile
from hs_f... | bsd-3-clause | dca77381cfc697f52ffd119d7099f7c9 | 48.22807 | 92 | 0.709195 | 4.163205 | false | false | false | false |
hydroshare/hydroshare | hs_access_control/management/commands/access_provenance.py | 1 | 1539 | """
This prints the provenance of an access control relationship between a user and a resource.
This is invaluable for access control debugging.
"""
from django.core.management.base import BaseCommand
from hs_core.models import BaseResource
from hs_access_control.models.utilities import access_provenance
from hs_core... | bsd-3-clause | 66054f592b2dcb9f6fce78a1d16e9aaf | 29.176471 | 91 | 0.647823 | 4.007813 | false | false | false | false |
hydroshare/hydroshare | theme/templatetags/ratings_tags.py | 1 | 1295 |
from mezzanine import template
from mezzanine.generic.models import Rating
from theme.forms import RatingForm
register = template.Library()
@register.inclusion_tag("generic/includes/rating.html", takes_context=True)
def rating_for(context, obj):
"""
Provides a generic context variable name for the object t... | bsd-3-clause | 725700f69da3d7ce28d84dc12fd31e04 | 34.027027 | 79 | 0.651737 | 3.710602 | false | false | false | false |
hydroshare/hydroshare | hs_access_control/migrations/0006_auto_add_new_fields.py | 1 | 3421 | # -*- coding: utf-8 -*-
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('hs_core', '0014_auto_20151123_1451'),
... | bsd-3-clause | 824a73a0db84ff0ad952ce872e2e6a52 | 46.513889 | 190 | 0.636656 | 4.005855 | false | false | false | false |
hydroshare/hydroshare | hs_dictionary/views.py | 1 | 1048 | from django.db.models import Q
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import University
from drf_yasg.utils import swagger_auto_schema
from functools import reduce
class ListUniversities(APIView):
"""
View to list all known universities in the syst... | bsd-3-clause | 875b523224eea53c26d4bb07030ff69c | 28.111111 | 91 | 0.621183 | 3.867159 | false | false | false | false |
hydroshare/hydroshare | hs_file_types/migrations/0005_reftimeseriesfilemetadata_reftimeserieslogicalfile.py | 1 | 1580 | # -*- coding: utf-8 -*-
from django.db import migrations, models
import django.contrib.postgres.fields
import django.contrib.postgres.fields.hstore
class Migration(migrations.Migration):
dependencies = [
('hs_file_types', '0004_geofeaturefilemetadata_geofeaturelogicalfile'),
]
operations = [
... | bsd-3-clause | 0716fcc130f630b42f8fe27ceb87684e | 38.5 | 163 | 0.590506 | 4.364641 | false | false | false | false |
hydroshare/hydroshare | hs_access_control/migrations/0003_auto_20150824_2215.py | 1 | 3190 | # -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hs_access_control', '0002_auto_20150817_1150'),
]
operations = [
migrations.AlterField(
model_name='groupresourceprivilege',
name='grantor'... | bsd-3-clause | 777da93ea5749263cc359c40cd39e45e | 45.911765 | 188 | 0.633542 | 4.153646 | false | false | false | false |
hydroshare/hydroshare | hs_access_control/tests/test_units.py | 1 | 24922 | from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import PrivilegeCodes
from hs_core import hydroshare
from hs_core.testing import MockIRODSTestCaseMixin
from hs_access_control.tests.utilities import global_reset, is_equal_to_as_set
class UnitTests(MockIROD... | bsd-3-clause | 8d1e7ea2b484d6b3a908dd0ec68f2872 | 34.910663 | 81 | 0.573389 | 3.501756 | false | true | false | false |
hydroshare/hydroshare | hs_core/management/commands/check_django_metadata.py | 1 | 4006 | # -*- coding: utf-8 -*-
"""
Check Django metadata
This checks that:
1. Every resource has a metadata entry.
2. Every metadata entry has a title.
More tests are left for later.
* By default, prints errors on stdout.
* Optional argument --log instead logs output to system log.
"""
from django.conf import settings
f... | bsd-3-clause | 679fb50a08b760cfeb47ea276838c42f | 32.663866 | 99 | 0.542936 | 4.441242 | false | false | false | false |
mitodl/micromasters | roles/migrations/0001_initial.py | 1 | 1187 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-18 15:55
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('courses... | bsd-3-clause | 85cc9be28687bd61819dd5525da9588c | 34.969697 | 135 | 0.613311 | 4.15035 | false | false | false | false |
mitodl/micromasters | exams/admin.py | 1 | 2875 |
"""
Admin for the grades app
"""
from django.contrib import admin
from exams import models
class ExamRunAdmin(admin.ModelAdmin):
"""Admin for ExamRun"""
model = models.ExamRun
list_display = (
'id',
'course',
'semester',
'exam_series_code',
'date_first_schedulable... | bsd-3-clause | 2ef1dcb0e31b5c9d89781af5d79281f3 | 26.122642 | 89 | 0.606957 | 3.797886 | false | false | false | false |
mitodl/micromasters | grades/tasks.py | 1 | 7724 | """
Tasks for the grades app
"""
import logging
from celery import group
from celery.result import GroupResult
from django.contrib.auth.models import User
from django.core.cache import caches
from django.db import IntegrityError
from django.db.models import OuterRef, Exists
from django_redis import get_redis_connectio... | bsd-3-clause | 8e7f5c12f3a58c7badf726f5298ce4a5 | 34.109091 | 115 | 0.651217 | 3.865866 | false | false | false | false |
mitodl/micromasters | ecommerce/migrations/0011_user_coupon.py | 1 | 1856 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-06 19:31
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | bsd-3-clause | f11f9d0d62044208f4bba92678702149 | 34.692308 | 246 | 0.595905 | 4.208617 | false | false | false | false |
mitodl/micromasters | search/indexing_api_test.py | 1 | 42701 | """
Tests for search API functions.
"""
import itertools
from unittest.mock import patch
from ddt import (
data,
ddt,
unpack,
)
from django.conf import settings
from django.db.models.signals import post_save
from django.test import override_settings
from opensearchpy.exceptions import NotFoundError
from fa... | bsd-3-clause | 3576877df3ab349b947a0b92c8c4e277 | 41.829488 | 119 | 0.556146 | 4.475527 | false | true | false | false |
mitodl/micromasters | mail/migrations/0001_initial.py | 1 | 1436 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-09-26 20:28
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | bsd-3-clause | b117968abe9e80f0f498e08a15b57fd6 | 37.810811 | 142 | 0.60376 | 4.067989 | false | false | false | false |
mitodl/micromasters | micromasters/sentry.py | 1 | 1710 | """Sentry setup and configuration"""
from celery.exceptions import WorkerLostError
import sentry_sdk
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations.logging i... | bsd-3-clause | 9056fccea075b1983aab2b312d116457 | 33.2 | 87 | 0.643275 | 4.511873 | false | false | false | false |
mitodl/micromasters | search/api.py | 1 | 15685 | """
Functions for executing ES searches
"""
import json
import logging
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.db import transaction
from django.db.models import Q as Query
from opensearchpy.exceptions import NotFo... | bsd-3-clause | 214296d8bfb12ee26ac7753aa8f04467 | 34.486425 | 116 | 0.684221 | 4.017674 | false | false | false | false |
mitodl/micromasters | search/migrations/0004_add_percolate_query_membership.py | 1 | 1420 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-10-24 13:55
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | bsd-3-clause | b2f4c1234550881db7fd9955ea174047 | 40.764706 | 156 | 0.632394 | 4.127907 | false | false | false | false |
mitodl/micromasters | backends/pipeline_api.py | 1 | 5802 | """
APIs for extending the python social auth pipeline
"""
import logging
from django.shortcuts import redirect
from django_redis import get_redis_connection
from rolepermissions.checkers import has_role
from social_core.exceptions import AuthException, AuthFailed
from backends.base import BaseEdxOAuth2
from backends... | bsd-3-clause | 0483f791ff2e70e09dcee06a583a9468 | 33.742515 | 118 | 0.684936 | 3.807087 | false | false | false | false |
mitodl/micromasters | roles/signals_test.py | 1 | 3476 | """
Tests for signals
"""
from django.db.models.signals import post_save
from factory.django import mute_signals
from rolepermissions.checkers import (
has_role,
has_permission,
has_object_permission,
)
from courses.factories import ProgramFactory
from roles.models import Role
from micromasters.factories i... | bsd-3-clause | 4dde3d37bb68d86b2f68834c73a3f253 | 32.104762 | 111 | 0.630035 | 4.291358 | false | true | false | false |
mitodl/micromasters | exams/management/commands/import_edx_exam_grades.py | 1 | 4367 | """
Import proctored exam grades from edx
"""
import csv
import argparse
from django.contrib.auth.models import User
from django.core.management import BaseCommand, CommandError
from courses.models import Course
from exams.models import ExamRun, ExamAuthorization
from exams.constants import EXAM_GRADE_PASS, BACKEND_M... | bsd-3-clause | 081e64cd404c0d13e2c088cb39fb6d1f | 37.646018 | 115 | 0.524387 | 4.710895 | false | false | false | false |
mitodl/micromasters | dashboard/api.py | 1 | 31974 | """
Apis for the dashboard
"""
import datetime
import logging
from urllib.parse import urljoin
import pytz
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.db import transaction
from django.db.models imp... | bsd-3-clause | a5e752326cda2b12861dbe049c16143a | 38.668734 | 117 | 0.659494 | 3.755344 | false | false | false | false |
mitodl/micromasters | courses/admin.py | 1 | 2797 | """
Admin views for Courses & Programs
"""
from django.contrib import admin
from courses.models import Course, CourseRun, Program, ElectivesSet, ElectiveCourse, Topic
class CourseInline(admin.StackedInline):
"""Admin Inline for Course objects"""
model = Course
extra = 1
show_change_link = True
cla... | bsd-3-clause | 7459a414f4edaf21b99ee31d0dd795c4 | 31.149425 | 138 | 0.673221 | 3.831507 | false | false | false | false |
mitodl/micromasters | ui/urls.py | 1 | 1996 | """
URLs for ui
"""
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from certificates.views import (
CourseCertificateView,
GradeRecordView,
ProgramCertificateView,
ProgramLetterView,
SharedGradeRecordView,
)
from profiles.constants import USERNAME_RE_PARTIAL
fr... | bsd-3-clause | 3c045be79976e1e64273339a2430e866 | 38.137255 | 128 | 0.66483 | 3.354622 | false | false | false | false |
mitodl/micromasters | seed_data/management/commands/seed_db.py | 1 | 12439 | """
Generates a set of realistic users/programs to help us test search functionality
"""
from decimal import Decimal
from django.core.management import BaseCommand
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from factory.django import mute_signals
from backends.edxorg imp... | bsd-3-clause | 9abbe0477dfe473986b409105e900e34 | 37.156442 | 117 | 0.659297 | 3.905495 | false | false | false | false |
mitodl/micromasters | ecommerce/factories.py | 1 | 2779 | """
Factories for ecommerce models
"""
from factory import (
LazyAttribute,
SelfAttribute,
SubFactory,
Trait,
)
from factory.django import DjangoModelFactory
from factory.fuzzy import (
FuzzyChoice,
FuzzyDecimal,
FuzzyText,
)
import faker
from courses.factories import (
CourseFactory,
... | bsd-3-clause | 15eeeeacb5d65864df4d0664087ed53b | 22.956897 | 94 | 0.649154 | 3.84903 | false | false | false | false |
mitodl/micromasters | micromasters/serializers.py | 1 | 2139 | """
Serializers for Django contrib models
"""
import logging
from rest_framework import serializers
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
log = logging.getLogger(__name__)
class UserSerializer(serializers.ModelSerializer):
"""
Serializer for User ob... | bsd-3-clause | f486fd55ec825c69803e16e0635dd424 | 26.423077 | 82 | 0.620851 | 4.639913 | false | false | false | false |
mitodl/micromasters | search/signals.py | 1 | 3359 | """
Signals used for indexing
"""
import logging
from django.db import transaction
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from profiles.models import (
Education,
Employment,
Profile,
)
from search.models import PercolateQuery
from search.tasks im... | bsd-3-clause | 105db2f4d60b09acd516e1cf4ef5e80c | 38.988095 | 103 | 0.751116 | 3.607948 | false | false | false | false |
mitodl/micromasters | cms/migrations/0015_add_home_page_and_email_to_program_page.py | 1 | 2360 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-09-14 19:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0014_html_in_faq_answers')... | bsd-3-clause | fdacae78287818f94565a2b8168b75b5 | 44.384615 | 277 | 0.636017 | 3.979764 | false | false | false | false |
mitodl/micromasters | seed_data/management/commands/unseed_db.py | 1 | 3499 | """
Deletes a set of realistic users/programs that were added to help us test search functionality
"""
from contextlib import contextmanager
from factory.django import mute_signals
from django.core.management import BaseCommand
from django.db import connection
from django.db.models import Q
from django.db.models.signal... | bsd-3-clause | fb2e38d46ef30afac280477237a7bd50 | 36.623656 | 117 | 0.685053 | 3.770474 | false | false | false | false |
mitodl/micromasters | profiles/migrations/0008_rename_edx_fields.py | 1 | 1688 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-13 15:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0007_city_and_birthplace'),
]
operations = [
migrations.RenameField(
... | bsd-3-clause | 6acfbcde30006e15ecc6748378aa31ff | 27.133333 | 53 | 0.51955 | 4.188586 | false | false | false | false |
mitodl/micromasters | ecommerce/permissions_test.py | 1 | 1437 | """
Tests for ecommerce permissions
"""
from unittest.mock import MagicMock
from django.test import (
override_settings,
TestCase,
)
from ecommerce.api import generate_cybersource_sa_signature
from ecommerce.permissions import IsSignedByCyberSource
@override_settings(CYBERSOURCE_SECURITY_KEY="fake")
class P... | bsd-3-clause | 23806274ee11af8b934bc3ac855501bc | 27.176471 | 84 | 0.600557 | 4.165217 | false | true | false | false |
mitodl/micromasters | grades/management/commands/adjust_exam_grades_from_csv.py | 1 | 4974 | """
Freezes final grades for a course
"""
import csv
import argparse
from collections import namedtuple
from django.core.management import BaseCommand, CommandError
from grades.models import ProctoredExamGrade
class ParsingError(CommandError):
"""Custom class for parsing exceptions"""
pass
class GradeRowPa... | bsd-3-clause | 1c302ed0c0462900c821a5288a1f0eaf | 40.798319 | 113 | 0.625251 | 3.941363 | false | false | false | false |
mitodl/micromasters | mail/utils.py | 1 | 4731 | """
Utils for mail
"""
import logging
from django.core.exceptions import ValidationError
from dashboard.models import ProgramEnrollment
from financialaid.api import get_formatted_course_price
from financialaid.constants import (
FINANCIAL_AID_APPROVAL_MESSAGE,
FINANCIAL_AID_APPROVAL_SUBJECT,
FINANCIAL_AID... | bsd-3-clause | 252420a2faffe95a8e2e6eca259795eb | 36.547619 | 119 | 0.682731 | 3.78783 | false | false | false | false |
pywinauto/pywinauto | pywinauto/windows/win32_element_info.py | 1 | 11270 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# ... | bsd-3-clause | ccaf46675da7b77c0fb53e408dd044ee | 35.830065 | 104 | 0.639397 | 4.232069 | false | false | false | false |
pywinauto/pywinauto | pywinauto/findbestmatch.py | 1 | 20676 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | bsd-3-clause | 873b08e89dd8cd5180e63c0c194f9468 | 34.210158 | 118 | 0.581399 | 4.032768 | false | false | false | false |
pywinauto/pywinauto | pywinauto/timings.py | 1 | 15638 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | bsd-3-clause | 2d01403ec0262e73497b75aaa60a9b15 | 31.55794 | 94 | 0.576992 | 4.194742 | false | false | false | false |
pywinauto/pywinauto | pywinauto/controlproperties.py | 1 | 9337 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | bsd-3-clause | 7a3cb08173418cea2f41bfa85ecf97d3 | 32.453875 | 80 | 0.554996 | 4.179499 | false | false | false | false |
pywinauto/pywinauto | pywinauto/windows/remote_memory_block.py | 1 | 12193 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# ... | bsd-3-clause | cccd8bb69a58d9302e66b216b4fd781a | 39.916107 | 117 | 0.565816 | 4.509246 | false | false | false | false |
pywinauto/pywinauto | pywinauto/unittests/test_xml_helpers.py | 4 | 5040 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | bsd-3-clause | 88ebc078f5db1346bd20f67880df2edf | 34.521739 | 80 | 0.653571 | 4.151565 | false | true | false | false |
pywinauto/pywinauto | examples/notepad_slow.py | 1 | 9097 | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | bsd-3-clause | 4700fc7cc66efaa16529437bc0c3f262 | 34.388 | 95 | 0.665714 | 3.713061 | false | false | false | false |
mozilla/addons-server | src/olympia/activity/admin.py | 3 | 2240 | from django.contrib import admin
from .models import ActivityLog, ReviewActionReasonLog
from olympia.reviewers.models import ReviewActionReason
class ActivityLogAdmin(admin.ModelAdmin):
list_display = (
'created',
'user',
'__str__',
)
raw_id_fields = ('user',)
readonly_fields ... | bsd-3-clause | 5942c8487a2880d485e7c2fa154719c0 | 25.987952 | 87 | 0.597321 | 3.916084 | false | false | false | false |
mozilla/addons-server | src/olympia/constants/scanners.py | 3 | 1784 | from django.utils.translation import gettext_lazy as _
CUSTOMS = 1
# We do not use the WAT scanner anymore but we keep this constant for the model
# definition. We shouldn't use this constant, though.
# See: https://github.com/mozilla/addons-server/issues/19152
_WAT = 2
YARA = 3
MAD = 4
SCANNERS = {CUSTOMS: 'customs... | bsd-3-clause | b30c0dda7d1ee9d3ed80af3e066a3e46 | 26.446154 | 83 | 0.689462 | 2.939044 | false | false | false | false |
mozilla/addons-server | src/olympia/addons/management/commands/fix_langpacks_with_max_version_star.py | 5 | 2510 | from django.core.management.base import BaseCommand
from olympia import amo
from olympia.core.logger import getLogger
from olympia.versions.compare import version_dict
from olympia.versions.models import AppVersion, Version
log = getLogger('z.fix_langpacks_with_max_version_star')
class Command(BaseCommand):
hel... | bsd-3-clause | fc371c7722a4c12c4bf9404c0d6f0e21 | 38.21875 | 88 | 0.553386 | 4.342561 | false | false | false | false |
mozilla/addons-server | src/olympia/addons/indexers.py | 3 | 29191 | from django.conf import settings
from olympia.constants.promoted import RECOMMENDED
import olympia.core.logger
from olympia import amo
from olympia.amo.utils import attach_trans_dict
from olympia.amo.celery import create_chunked_tasks_signatures
from olympia.amo.utils import to_language
from olympia.constants.search i... | bsd-3-clause | ca02831da9e668106e3512a374a35343 | 37.817819 | 88 | 0.450104 | 4.883071 | false | false | false | false |
mozilla/addons-server | src/olympia/versions/migrations/0025_auto_20220614_1653.py | 3 | 2146 | # Generated by Django 3.2.13 on 2022-06-14 16:53
from django.db import migrations
from olympia import amo
from olympia.addons.tasks import index_addons
from olympia.versions import compare
def update_dictionary_compat(apps, schema_editor):
Version = apps.get_model('versions', 'Version')
ApplicationsVersions... | bsd-3-clause | 3602104fddae3e0fdc3876e6fd619ceb | 36 | 89 | 0.660298 | 3.547107 | false | false | false | false |
mozilla/addons-server | src/olympia/bandwagon/serializers.py | 3 | 6264 | from django.utils.translation import gettext, gettext_lazy as _
from rest_framework import serializers
from rest_framework.validators import UniqueTogetherValidator
from olympia.accounts.serializers import BaseUserSerializer
from olympia.addons.models import Addon
from olympia.addons.serializers import AddonSerialize... | bsd-3-clause | 22e6058d464df49103001b6919356c92 | 34.191011 | 83 | 0.620211 | 4.605882 | false | false | false | false |
mozilla/addons-server | src/olympia/lib/akismet/migrations/0001_initial.py | 3 | 2810 | # Generated by Django 2.2.5 on 2019-09-12 15:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('bandwagon', '000... | bsd-3-clause | 32de5fdbf7652b774f7d9e0e381da4e6 | 52.018868 | 161 | 0.60427 | 4.002849 | false | false | false | false |
mozilla/addons-server | src/olympia/access/acl.py | 3 | 6844 | from olympia import amo
def match_rules(rules, app, action):
"""
This will match rules found in Group.
"""
for rule in rules.split(','):
rule_app, rule_action = rule.split(':')
if rule_app == '*' or rule_app == app:
if rule_action == '*' or rule_action == action or action =... | bsd-3-clause | 4e212b0f930b1150148e239eba372af8 | 33.049751 | 86 | 0.691262 | 3.81069 | false | false | false | false |
mozilla/addons-server | src/olympia/devhub/forms.py | 2 | 52093 | import os
import tarfile
import zipfile
from urllib.parse import urlsplit
from django import forms
from django.conf import settings
from django.core.validators import MinLengthValidator
from django.db.models import Q
from django.forms.formsets import BaseFormSet, formset_factory
from django.forms.models import BaseMo... | bsd-3-clause | 6d788ad5034837970082c4100ccc7226 | 35.709655 | 88 | 0.586358 | 4.277468 | false | false | false | false |
opencivicdata/pupa | pupa/ext/ansistrm.py | 5 | 4990 | # flake8: NOQA
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved.
# Licensed under the new BSD license.
#
import ctypes
import logging
import os
class ColorizingStreamHandler(logging.StreamHandler):
# color names to indices
color_map = {
'black': 0,
'red': 1,
'green': 2,
... | bsd-3-clause | f73b67347d7062683a8bf6092341068d | 31.614379 | 77 | 0.456914 | 4.168755 | false | false | false | false |
opencivicdata/pupa | pupa/migrations/0002_auto_20150906_1458.py | 2 | 1290 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.dev20150906080247 on 2015-09-06 14:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pupa', '0001_initial'),
]
operation... | bsd-3-clause | b4eef90a7eab2f4e4f01f837da236bfa | 34.833333 | 137 | 0.625581 | 3.932927 | false | false | false | false |
google/deepvariant | deepvariant/tf_utils.py | 1 | 14992 | # Copyright 2017 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#... | bsd-3-clause | 8116aa151278d53edf0fb0138dc4e9e9 | 37.539846 | 80 | 0.722319 | 3.82449 | false | false | false | false |
google/deepvariant | deepvariant/call_variants_keras.py | 1 | 15917 | # Copyright 2017 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#... | bsd-3-clause | 5ee9871f24f6e7ba786f892ebfcf6ddb | 37.44686 | 157 | 0.694289 | 3.787958 | false | false | false | false |
google/deepvariant | third_party/nucleus/util/sequence_utils.py | 1 | 4197 | # Copyright 2018 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#... | bsd-3-clause | a1094809beccdd7b4472235faedf363c | 33.68595 | 80 | 0.635692 | 3.235929 | false | false | false | false |
nipy/nireg | nireg/externals/transforms3d/taitbryan.py | 5 | 12510 | ''' Module implementing Euler angle rotations and their conversions
See:
* http://en.wikipedia.org/wiki/Rotation_matrix
* http://en.wikipedia.org/wiki/Euler_angles
* http://mathworld.wolfram.com/EulerAngles.html
See also: *Representing Attitude with Euler Angles and Quaternions: A
Reference* (2006) by James Diebel. ... | bsd-3-clause | ea6ae5973f1e566e079726493a5a849a | 30.432161 | 99 | 0.610232 | 3.321827 | false | false | false | false |
mozilla/inventory | core/keyvalue/base_option.py | 2 | 6961 | from django.db import models
from django.core.exceptions import ValidationError
from mozdns.validation import validate_name
from core.keyvalue.models import KeyValue
import ipaddr
class DHCPKeyValue(KeyValue):
is_option = models.BooleanField(default=False)
is_statement = models.BooleanField(default=False)
... | bsd-3-clause | 5fa37b04d4095234f03eac846257df89 | 32.791262 | 79 | 0.540152 | 4.570584 | false | false | false | false |
mozilla/inventory | vendor-local/src/django-tastypie/tests/gis/tests/views.py | 11 | 5062 | from django.http import HttpRequest
from django.test import TestCase
from django.utils import simplejson as json
class ViewsTestCase(TestCase):
def test_gets(self):
resp = self.client.get('/api/v1/', data={'format': 'json'})
self.assertEqual(resp.status_code, 200)
deserialized = json.loads... | bsd-3-clause | b17b35cec94b44c51e3e835c272c3660 | 48.627451 | 198 | 0.634927 | 3.547302 | false | true | false | false |
mozilla/inventory | mozdns/ptr/models.py | 2 | 5435 | from django.db import models
from django.core.exceptions import ValidationError
from mozdns.domain.models import name_to_domain
from mozdns.ip.utils import ip_to_domain_name, nibbilize
from mozdns.domain.models import Domain
from mozdns.ip.models import Ip
from mozdns.cname.models import CNAME
from mozdns.ip.utils im... | bsd-3-clause | f5820f2556245239f06e2d8b551c5e6b | 34.064516 | 79 | 0.616007 | 3.67478 | false | false | false | false |
mozilla/inventory | vendor-local/src/django-tastypie/tests/complex/api/resources.py | 30 | 1179 | from django.contrib.auth.models import User, Group
from django.contrib.comments.models import Comment
from tastypie.fields import CharField, ForeignKey, ManyToManyField, OneToOneField, OneToManyField
from tastypie.resources import ModelResource
from complex.models import Post, Profile
class ProfileResource(ModelResou... | bsd-3-clause | 52e8ae8018287986bc51b74747bb5872 | 27.756098 | 97 | 0.710772 | 4.366667 | false | false | false | false |
mozilla/inventory | migrate_dns/build_nics.py | 2 | 8517 | import re
from systems.models import System
from migrate_dns.utils import *
import pprint
pp = pprint.PrettyPrinter(indent=2)
nic_nums = re.compile("^nic\.(\d+)\..*\.(\d+)$")
is_mac_key = re.compile("^nic\.\d+\.mac_address\.\d+$")
is_hostname_key = re.compile("^nic\.\d+\.hostname\.\d+$")
is_ip_key = re.compile("^n... | bsd-3-clause | 68a51004658ed7f1cd13d1c5c15c1262 | 36.519824 | 85 | 0.544441 | 3.480588 | false | false | false | false |
mozilla/inventory | vendor-local/src/django-extensions/build/lib/django_extensions/jobs/daily/cache_cleanup.py | 16 | 1625 | """
Daily cleanup job.
Can be run as a cronjob to clean out old data from the database (only expired
sessions at the moment).
"""
from django_extensions.management.jobs import DailyJob
class Job(DailyJob):
help = "Cache (db) cleanup Job"
def execute(self):
from django.conf import settings
f... | bsd-3-clause | 4bbb752e52313e480eaa16ee64f936f2 | 39.625 | 81 | 0.574769 | 4.642857 | false | false | false | false |
mozilla/inventory | decorators/printqueries.py | 3 | 2156 | """
Print SQL Decorator found at http://pushingkarma.com/notebookdjango-decorator-print-sql-queries/
Usage:
@print_queries('metric')
Where 'metric' is a search filter in the query itself
"""
import os, time
COLORS = {'blue':34, 'cyan':36, 'green':32, 'grey':30, 'magenta':35, 'red':31, 'white':37, 'yel... | bsd-3-clause | 1667cb17c5daeec59930fbfa5d32f45a | 43 | 103 | 0.558905 | 3.884685 | false | false | false | false |
mozilla/inventory | mozdns/models.py | 2 | 9439 | from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
import mozdns
from mozdns.domain.models import Domain
from mozdns.view.models import View
from mozdns.mixins import ObjectUrlMixin, DisplayMixin
from mozdns.validation import validate_first_label, validate_name
from moz... | bsd-3-clause | 7c8950c41e6df5ed507541bb518b9478 | 34.220149 | 79 | 0.587562 | 4.30415 | false | false | false | false |
mozilla/inventory | core/site/migrations/0001_initial.py | 3 | 2859 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Site'
db.create_table('site', (
('id', self.gf('django.db.models.fields.AutoFiel... | bsd-3-clause | f385960e59551eedce9cfb50bb5367a5 | 43 | 133 | 0.566981 | 3.684278 | false | false | false | false |
mozilla/inventory | systems/views.py | 2 | 39831 | from django.views.decorators.csrf import csrf_exempt
import csv
from django.core.exceptions import ValidationError
from django.db import transaction, IntegrityError
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.db.models import Q
from django.http import HttpResponse, HttpResponseRedir... | bsd-3-clause | 658324273573a4f8c423160f0441fb88 | 34.217507 | 283 | 0.603475 | 3.722523 | false | false | false | false |
mozilla/inventory | mozdns/mozbind/views.py | 3 | 1245 | from gettext import gettext as _
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from mozdns.soa.models import SOA
from mozdns.view.models import View
from mozdns.mozbind.zone_builder import build_zone_data
import simplejson as json
def build_debug_soa(request, soa_pk):
... | bsd-3-clause | 34f84f52bde659005cf21264f2486023 | 31.763158 | 74 | 0.646586 | 3.355795 | false | false | false | false |
mozilla/inventory | mozdns/nameserver/migrations/0001_initial.py | 2 | 17586 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Nameserver'
db.create_table('static_interface', (
('domain', self.gf('django.db.... | bsd-3-clause | 6896d1d418b9127e3cd70733da3b77b2 | 83.143541 | 192 | 0.562663 | 3.580941 | false | false | false | false |
mozilla/inventory | core/search/views.py | 1 | 5906 | from django.shortcuts import render
from django.http import HttpResponse, Http404
from django.db.utils import DatabaseError
from django.core.exceptions import ValidationError
from mozdns.utils import get_zones
from core.search.compiler.django_compile import compile_to_django
from core.search.compiler.django_compile i... | bsd-3-clause | c43afd262fb2a4d3a408bd6aac3060a8 | 31.994413 | 79 | 0.601422 | 3.921647 | false | false | false | false |
mozilla/inventory | dhcp/models.py | 3 | 2217 | from django.db import models
class DHCPOverride(models.Model):
dhcp_scope = models.CharField(max_length=32)
override_text = models.TextField(blank=True, null=True)
class Meta:
db_table = u'dhcp_overrides'
class DHCPFile(models.Model):
dhcp_scope = models.CharField(max_length=32)
file_tex... | bsd-3-clause | 533e37d65e2818452bb469c86db77b1c | 38.589286 | 95 | 0.65945 | 3.06639 | false | false | false | false |
mozilla/inventory | api_v2/relengdistro_handler.py | 6 | 1741 | from piston.handler import BaseHandler, rc
from systems.models import System, RelengDistro, SystemRack,SystemStatus,NetworkAdapter,KeyValue
from truth.models import Truth, KeyValue as TruthKeyValue
from dhcp.DHCP import DHCP as DHCPInterface
from dhcp.models import DHCP
from MacroExpansion import MacroExpansion
from Ke... | bsd-3-clause | 4dae0033f5d10690af6be31840baf1d3 | 29.54386 | 96 | 0.627226 | 3.809628 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/tests/mocks.py | 13 | 3944 | from __future__ import absolute_import
from itertools import count
import anyjson
from kombu.transport import base
class Message(base.Message):
def __init__(self, *args, **kwargs):
self.throw_decode_error = kwargs.get("throw_decode_error", False)
super(Message, self).__init__(*args, **kwargs)
... | bsd-3-clause | 8dcba278e8b45044aa986f7a15b97560 | 27.374101 | 77 | 0.604716 | 4.03272 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/decorators.py | 14 | 1117 | # -*- coding: utf-8 -*-
"""
celery.decorators✞
==================
Deprecated decorators, use `celery.task.task`,
and `celery.task.periodic_task` instead.
The new decorators does not support magic keyword arguments.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __fut... | bsd-3-clause | 41a7f931f0d081a67a90abf1f3825977 | 24.25 | 77 | 0.714671 | 3.654605 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/south/db/mysql.py | 2 | 11330 | # MySQL-specific implementations for south
# Original author: Andrew Godwin
# Patches by: F. Gabriel Gosselin <gabrielNOSPAM@evidens.ca>
from django.db import connection
from django.conf import settings
from south.db import generic
from south.db.generic import DryRunError, INVALID
from south.logger import get_logger
... | bsd-3-clause | 450621ee070914d46a78abcff1d0c461 | 39.464286 | 103 | 0.59188 | 3.989437 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/concurrency/processes/_win.py | 14 | 3055 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
# psutil is painfully slow in win32. So to avoid adding big
# dependencies like pywin32 a ctypes based solution is preferred
# Code based on the winappdbg project http://winappdbg.sourceforge.net/
# (BSD License)
from ctypes import byref, sizeo... | bsd-3-clause | 06aa6104bfff8227d292e1f421826406 | 27.287037 | 71 | 0.614403 | 3.66307 | false | false | false | false |
mozilla/make.mozilla.org | make_mozilla/events/migrations/0009_auto__add_field_eventkind_additional.py | 1 | 4446 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'EventKind.additional'
db.add_column('events_eventkind', 'additional',
... | bsd-3-clause | 17abadf881019f30e1fd70a1c7354dd9 | 58.293333 | 142 | 0.539811 | 3.774194 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/routes.py | 14 | 3338 | # -*- coding: utf-8 -*-
"""
celery.routes
~~~~~~~~~~~~~
Contains utilities for working with task routes
(:setting:`CELERY_ROUTES`).
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from .exceptions import QueueN... | bsd-3-clause | db940e0562ad48cdaead4f447a3fc4e0 | 32.717172 | 77 | 0.583283 | 4.198742 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.