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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dimagi/commcare-hq | corehq/apps/smsbillables/management/commands/bootstrap_mach_gateway.py | 1 | 2737 | from itertools import islice
from django.core.management.base import BaseCommand
import openpyxl
from corehq.apps.accounting.models import Currency
from corehq.apps.sms.models import OUTGOING
from corehq.apps.smsbillables.models import (
SmsGatewayFee,
SmsGatewayFeeCriteria,
)
from corehq.apps.smsbillables.u... | bsd-3-clause | 3ce0facd0746aafe4fc37b7cacaf09fb | 35.013158 | 111 | 0.660212 | 3.688679 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/organizations/migrations/0003_auto_20170303_1057.py | 1 | 1846 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-03-03 09:57
from __future__ import unicode_literals
from django.db import migrations
def remove_duplicates(apps, schema_editor):
Organization = apps.get_model('organizations', 'Organization')
OrganizationMember = apps.get_model('organizations', 'Or... | bsd-3-clause | c2d3241b452279a01663780d891856a8 | 30.827586 | 88 | 0.646804 | 4.896552 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/smsforms/tasks.py | 1 | 7147 | from datetime import timedelta
from dimagi.utils.logging import notify_error, notify_exception
from corehq import toggles
from corehq.apps.celery import task
from corehq.apps.formplayer_api.smsforms.api import (
FormplayerInterface,
TouchformsError,
)
from corehq.apps.sms.api import (
MessageMetadata,
... | bsd-3-clause | d6a9e6ca47fda66b5eb7d9d8a797e9ff | 41.541667 | 112 | 0.636211 | 4.206592 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/dump_reload/tests/test_dump_models.py | 1 | 6855 | import itertools
from django.apps import apps
from corehq.apps.dump_reload.sql.dump import _get_app_list
from corehq.apps.dump_reload.util import get_model_label
IGNORE_MODELS = {
"accounting.BillingAccount",
"accounting.BillingContactInfo",
"accounting.BillingRecord",
"accounting.CreditAdjustment",
... | bsd-3-clause | 10cb4871b8de5a8bafc8d4c6ab46cf17 | 33.104478 | 88 | 0.717433 | 3.737732 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/members/migrations/0022_auto_20171207_0856.py | 1 | 2480 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-12-07 07:56
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 = [
('members', '0021_auto_20171... | bsd-3-clause | 0b3ff9fa183c14a31eba548e398264c8 | 39 | 158 | 0.584274 | 4.444444 | false | false | false | false |
dimagi/commcare-hq | corehq/form_processor/migrations/0011_add_fields_for_deprecation.py | 1 | 1471 | from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0010_add_auth_and_openrosa_fields'),
]
operations = [
migrations.AddField(
model_name='xforminstancesql',
name='deprecated_form_id',
fi... | bsd-3-clause | d7afcc11d0a220d787396ba3d3807764 | 34.878049 | 198 | 0.590075 | 4.143662 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/accounting/forms.py | 1 | 108963 | import datetime
import json
from decimal import Decimal
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import MinLengthValidator, validate_slug
from ... | bsd-3-clause | e344909a047c67d472912df86278db02 | 37.749289 | 114 | 0.545066 | 4.315025 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/toggle_ui/migrations/0002_toggleaudit.py | 1 | 1136 | # Generated by Django 2.2.16 on 2020-11-23 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('toggle_ui', '0001_reconcile_commtrack_flags'),
]
operations = [
migrations.CreateModel(
name='ToggleAudit',... | bsd-3-clause | 107e425fb8b21d1b747fd3e6dc5219ed | 39.571429 | 144 | 0.568662 | 4.191882 | false | false | false | false |
dimagi/commcare-hq | corehq/motech/repeaters/signals.py | 1 | 4310 | import time
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from corehq.form_processor.signals import sql_case_post_save
from corehq.util.metrics import metrics_counter
from couchforms.signals import successful_form_received
from corehq.apps.locati... | bsd-3-clause | 66848c17883bfa3242e7564dfc4c4a6d | 40.047619 | 102 | 0.741995 | 3.652542 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/users/views/mobile/users.py | 1 | 61968 | import io
import json
import re
import time
from braces.views import JsonRequestResponseMixin
from couchdbkit import ResourceNotFound
from django.contrib import messages
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.core.exceptions import ValidationError
from django.http import (
... | bsd-3-clause | 4ad67705915de694d3262dff8cd1d921 | 38.953578 | 158 | 0.641783 | 3.821411 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/reports/standard/deployments.py | 1 | 33431 | from collections import namedtuple
from datetime import date, datetime, timedelta
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.db.models import Q
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.html import format_html
from djang... | bsd-3-clause | 0f90104a7a1a13cd1cf3e785a371f1ed | 39.18149 | 111 | 0.549849 | 4.244128 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/data_interfaces/migrations/0017_alter_domaincaserulerun.py | 1 | 1475 | # Generated by Django 1.11.11 on 2018-03-20 16:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_interfaces', '0016_createscheduleinstanceactiondefinition_specific_start_date'),
]
operations = [
migrations.AddField(
mo... | bsd-3-clause | f0f91c9b82661677e4f23145a76ed727 | 29.729167 | 95 | 0.575593 | 4.483283 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/registry/helper.py | 1 | 4263 | import itertools
from operator import attrgetter
from corehq.apps.registry.exceptions import RegistryNotFound, RegistryAccessException
from corehq.apps.registry.models import DataRegistry
from corehq.apps.registry.utils import RegistryPermissionCheck
from corehq.form_processor.models import CommCareCase
class DataRe... | bsd-3-clause | 196e159488ab1be466019685b3e23fc5 | 41.207921 | 99 | 0.664086 | 4.126815 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/payouts/migrations/0003_auto_20160719_1315.py | 1 | 12373 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-19 11:15
from __future__ import unicode_literals
import bluebottle.utils.fields
from decimal import Decimal
from django.db import migrations
import djmoney.models.fields
class Migration(migrations.Migration):
dependencies = [
('payouts', '000... | bsd-3-clause | 4783ef96ccdb0574f973e6fc2130645e | 56.018433 | 139 | 0.497454 | 4.681423 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/ota/migrations/0004_mobilerecoverymeasure.py | 1 | 2420 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ota', '0003_add_serial_id_model'),
]
operations = [
migrations.CreateModel(
name='MobileRecoveryMeasure',
fields=[
('id', models.AutoField(auto_creat... | bsd-3-clause | b024ad43e0c3b39c2fee8ed0d68f042b | 82.448276 | 957 | 0.653719 | 3.973727 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/funding_stripe/states.py | 1 | 3546 | from django.utils.translation import gettext_lazy as _
from bluebottle.fsm.effects import RelatedTransitionEffect
from bluebottle.fsm.state import Transition, State, EmptyState
from bluebottle.fsm.state import register
from bluebottle.funding.states import BasePaymentStateMachine, PayoutAccountStateMachine, BankAccoun... | bsd-3-clause | 5925f0d873514a8684c17603f436116d | 27.142857 | 117 | 0.643824 | 4.798376 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/token_auth/management/commands/generate_auth_token.py | 1 | 1929 | from builtins import input
from optparse import make_option
from django.core.management.base import BaseCommand
from bluebottle.token_auth.auth.booking import generate_token
class Command(BaseCommand):
help = "Generate a authentication token"
def __init__(self):
self.option_list = self.option_list +... | bsd-3-clause | 45301ce44a10fa23d0903b2a09070318 | 36.823529 | 91 | 0.548471 | 4.325112 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/userreports/alembic_diffs.py | 1 | 4624 | from functools import partial
import attr
from alembic.migration import MigrationContext
def get_migration_context(connection, table_names=None):
opts = {'compare_type': True}
if table_names:
opts['include_name'] = partial(include_name, table_names)
opts['include_object'] = partial(include_ob... | bsd-3-clause | 50821bdfdc760c3612a415afb2312a8a | 31.111111 | 98 | 0.63192 | 3.598444 | false | false | false | false |
dimagi/commcare-hq | corehq/messaging/management/commands/export_conditional_alerts.py | 1 | 10853 | from corehq.apps.data_interfaces.models import (
AutomaticUpdateRule,
MatchPropertyDefinition,
CreateScheduleInstanceActionDefinition,
)
from corehq.messaging.scheduling.models import (
Schedule,
AlertSchedule,
TimedSchedule,
TimedEvent,
SMSContent,
)
from corehq.messaging.scheduling.sch... | bsd-3-clause | 186b395e4097c0ea50f61d45a9155e1e | 42.06746 | 115 | 0.653552 | 4.59289 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/utils/staticfiles_finders.py | 2 | 1192 | from django.utils._os import safe_join
import os
from django.conf import settings
from django.contrib.staticfiles.finders import FileSystemFinder
from bluebottle.clients.models import Client
class TenantStaticFilesFinder(FileSystemFinder):
def find(self, path, all=False):
"""
Looks for files in th... | bsd-3-clause | ce3499b3e2a0a979febdb8be6c652f86 | 35.121212 | 77 | 0.564597 | 4.382353 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/statistics/admin.py | 1 | 3331 | from builtins import object
from adminsortable.admin import SortableAdmin
from django.contrib import admin
from django import forms
from django.db import connection
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from parler.admin import TranslatableAdmin
from parler.fo... | bsd-3-clause | 0d6de12b8778e4e0df963c639244289c | 31.028846 | 85 | 0.715401 | 4.158552 | false | false | false | false |
dimagi/commcare-hq | corehq/ex-submodules/pillowtop/dao/django.py | 1 | 1684 | from django.core.exceptions import ObjectDoesNotExist
from pillowtop.dao.exceptions import DocumentNotFoundError
from pillowtop.dao.interface import DocumentStore
class DjangoDocumentStore(DocumentStore):
"""
An implementation of the DocumentStore that uses the Django ORM.
"""
def __init__(self, model... | bsd-3-clause | fd49bba15fadec21e5aca529ceb5fd21 | 39.095238 | 105 | 0.626485 | 4.147783 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/aggregate_ucrs/views.py | 1 | 3680 | from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy
from corehq import toggles
from corehq.apps.aggregate_uc... | bsd-3-clause | 0f29cf618ea9e55589ee93c11b44aee3 | 35.078431 | 105 | 0.729076 | 3.705942 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/domain/deletion.py | 1 | 21411 | import logging
from datetime import date
from django.apps import apps
from django.conf import settings
from django.contrib.auth.models import User
from django.db import transaction
from django.db.models import Q
from field_audit.models import AuditAction
from dimagi.utils.chunked import chunked
from corehq.apps.acco... | bsd-3-clause | 8680c28ff2e9b76a3ff14fc9bf45de6c | 46.369469 | 111 | 0.689365 | 3.832289 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/hqadmin/management/commands/cchq_prbac_grandfather_privs.py | 1 | 3867 | from django.core.management.base import BaseCommand
from corehq.apps.accounting.models import SoftwarePlanVersion
from corehq.apps.accounting.utils import ensure_grants
from corehq.privileges import MAX_PRIVILEGES
class Command(BaseCommand):
help = 'Grandfather privileges to all roles above a certain plan level ... | bsd-3-clause | ade984641cb1e667f7d4aa094a5b826b | 33.526786 | 109 | 0.582622 | 3.886432 | false | false | false | false |
dimagi/commcare-hq | custom/samveg/case_importer/operations.py | 1 | 1619 | from datetime import datetime
import pytz
class BaseRowOperation(object):
"""
Perform an operation on each row of case upload.
"""
def __init__(self, **kwargs):
"""
Possible values in kwargs
:param row_num: 1-based row number. Headers are in row zero.
:param raw_row: ... | bsd-3-clause | 401087bd38cc68a52721072ecb6db03b | 30.134615 | 92 | 0.609636 | 3.800469 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/export/tests/test_incremental.py | 1 | 9499 | import uuid
from datetime import datetime, timedelta
from django.test import TestCase
from couchexport.models import Format
from pillowtop.es_utils import initialize_index_and_mapping
import requests_mock
from corehq.apps.export.models import (
CaseExportInstance,
ExportColumn,
ExportItem,
PathNode,
... | bsd-3-clause | 485df924da605e1aee58ef18ab1e6f48 | 36.844622 | 114 | 0.594694 | 4.09087 | false | true | false | false |
onepercentclub/bluebottle | bluebottle/notifications/messages.py | 1 | 7333 | # -*- coding: utf-8 -*-
from builtins import object
from builtins import str
from operator import attrgetter
from functools import partial
import logging
from celery import shared_task
from django.db import connection
from django.core.cache import cache
from django.contrib.admin.options import get_content_type_for_m... | bsd-3-clause | 42822a44f48eb46b627f6c400a8c12e9 | 32.637615 | 86 | 0.597164 | 4.328808 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/time_based/migrations/0035_auto_20201120_1318.py | 1 | 1409 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-11-20 12:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('time_based', '0034_auto_20201120_1306'),
]
operations = [
migrations.RenameModel(
... | bsd-3-clause | 6a4920e9a3949fd6e7840429844797cd | 51.185185 | 732 | 0.669979 | 4.131965 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/deeds/admin.py | 1 | 2817 | from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from django_admin_inline_paginator.admin import TabularInlinePaginated
from django_summernote.widgets import SummernoteWidget
from bluebottle.activities.admi... | bsd-3-clause | ce91af20daf0b1a489c2029fbd3515c1 | 30.651685 | 79 | 0.642173 | 3.880165 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/test/factory_models/cms.py | 1 | 2384 | from builtins import object
from datetime import timedelta
import factory
from django.utils.timezone import now
from bluebottle.cms.models import (
ResultPage, HomePage, Stat, Quote,
SiteLinks, LinkGroup, Link, LinkPermission,
Step, ContentLink, Greeting
)
from bluebottle.slides.models import Slide
from b... | bsd-3-clause | 51d16eb8e159180a1ef0fafdfb6da1c6 | 24.361702 | 81 | 0.709312 | 4.027027 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/time_based/migrations/0027_auto_20201110_1613.py | 1 | 1711 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-05-24 09:59
from __future__ import unicode_literals
from django.db import migrations, connection
from bluebottle.utils.utils import update_group_permissions
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebo... | bsd-3-clause | eb77b23afc23d09c0cfda20d8fd53542 | 31.903846 | 142 | 0.58796 | 4.214286 | false | false | false | false |
dimagi/commcare-hq | corehq/messaging/pillow.py | 1 | 3336 | from datetime import datetime
import attr
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed, KafkaCheckpointEventHandler
from corehq.apps.change_feed.topics import CASE_TOPICS
from corehq.apps.data_interfaces.models import AutomaticUpdateRule
from corehq.form_processor.exceptions import CaseNotFound
f... | bsd-3-clause | c36439d11db809fb84629942c957c896 | 35.659341 | 105 | 0.686151 | 3.731544 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/news/serializers.py | 1 | 1250 | from builtins import object
from fluent_contents.rendering import render_placeholder
from django.utils.safestring import mark_safe
from rest_framework import serializers
from bluebottle.bluebottle_drf2.serializers import SorlImageField
from bluebottle.members.serializers import UserPreviewSerializer
from .models imp... | bsd-3-clause | 641dde6b9c70d91992df66d456da4de6 | 31.894737 | 72 | 0.7136 | 4.251701 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/mobile_auth/xml.py | 1 | 3016 | """
This file contains the spec for the XML for mobile auth
(from https://github.com/dimagi/commcare/wiki/CentralAuthAPI)
<!-- Exactly one. The block of auth key records.-->
<!-- @domain: Exactly one. The client should only accept keys from domains that match the request -->
<!-- @issued: Exactly o... | bsd-3-clause | 7cb01f650bba0fa07e7f6cb3753cabaa | 43.352941 | 238 | 0.665451 | 4.026702 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/events/migrations/0012_auto_20200217_1106.py | 1 | 1292 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-02-17 10:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0011_event_update_contribution_date'),
]
operations = [
migratio... | bsd-3-clause | 5125ce6daee08a14bb8e9af05172b272 | 31.3 | 100 | 0.582817 | 4.394558 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/funding/migrations/0057_auto_20201112_1519.py | 1 | 4069 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-11-12 14:19
from __future__ import unicode_literals
import bluebottle.files.fields
import bluebottle.utils.fields
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
class Migration(migrations.Migration):... | bsd-3-clause | 2be54cde5726409cf3933da84f352740 | 40.948454 | 169 | 0.596461 | 4.093561 | false | false | false | false |
dimagi/commcare-hq | corehq/motech/dhis2/tests/test_entities_helpers.py | 1 | 20922 | import doctest
import json
from unittest.mock import Mock, call, patch
from uuid import uuid4
from django.test import SimpleTestCase, TestCase
from fakecouch import FakeCouchDb
from casexml.apps.case.mock import CaseFactory, CaseIndex, CaseStructure
from corehq.apps.domain.shortcuts import create_domain
from corehq... | bsd-3-clause | 9d64701155174536e13f7fd8c4a2af16 | 33.074919 | 102 | 0.513479 | 3.994273 | false | true | false | false |
onepercentclub/bluebottle | bluebottle/assignments/migrations/0003_auto_20190909_1355.py | 1 | 1822 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-09-09 11:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('geo', '0013_auto_20190524_0958'),
('assignments', ... | bsd-3-clause | 670c0e8e9ea122089a87acadcfb602c8 | 34.72549 | 163 | 0.598793 | 4.307329 | false | false | false | false |
dimagi/commcare-hq | corehq/ex-submodules/couchforms/tests/test_archive.py | 1 | 19362 | import os
from unittest import mock
from datetime import datetime, timedelta
from django.test import TestCase
from corehq.form_processor.signals import sql_case_post_save
from corehq.form_processor.tasks import reprocess_archive_stubs
from corehq.apps.change_feed import topics
from corehq.apps.receiverwrapper.util imp... | bsd-3-clause | de87b0cc80e52465a00feae997039ec2 | 43.819444 | 108 | 0.666873 | 3.80767 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/app_manager/tests/test_suite_formats.py | 1 | 9879 | import hashlib
import commcare_translations
from django.test import SimpleTestCase
from corehq.apps.app_manager.models import (
Application,
DetailColumn,
MappingItem,
Module,
)
from corehq.apps.app_manager.tests.util import TestXmlMixin, patch_get_xform_resource_overrides
@patch_get_xform_resource... | bsd-3-clause | 0c0302a758c6ab2bc5b20456dfcc755b | 39.487705 | 261 | 0.520599 | 3.657534 | false | true | false | false |
onepercentclub/bluebottle | bluebottle/notifications/migrations/0001_initial.py | 1 | 1278 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-04-15 12:19
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 = [
('conte... | bsd-3-clause | 1e3e0934c0e4a5732dbeec34380c7f5f | 37.727273 | 128 | 0.621283 | 4.245847 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/funding/migrations/0049_auto_20200124_1032.py | 1 | 2772 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-01-24 09:32
from __future__ import unicode_literals
import bluebottle.utils.fields
from decimal import Decimal
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
class Migration(migrations.Migration):
... | bsd-3-clause | 1a59d6b3c0356a3a1c6b811f91a1ac2d | 40.373134 | 173 | 0.615079 | 4.137313 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/app_manager/suite_xml/contributors.py | 1 | 1085 | from abc import ABCMeta, abstractmethod, abstractproperty
class BaseSuiteContributor(metaclass=ABCMeta):
def __init__(self, suite, app, modules, build_profile_id=None):
from corehq.apps.app_manager.suite_xml.sections.entries import EntriesHelper
self.suite = suite
self.app = app
se... | bsd-3-clause | f5bc7254f750ad8c86d3e5190aaef6c2 | 26.820513 | 97 | 0.704147 | 4.048507 | false | false | false | false |
dimagi/commcare-hq | corehq/util/metrics/load_counters.py | 1 | 2796 | from functools import partial
def load_counter(load_type, source, domain_name, extra_tags=None):
"""Make a function to track load by counting touched items
:param load_type: Load type (`"case"`, `"form"`, `"sms"`). Use one
of the convenience functions below (e.g., `case_load_counter`)
rather than pas... | bsd-3-clause | 7fdb952a72cb2b21d170fcfdcf8377b8 | 31.511628 | 106 | 0.681688 | 3.723036 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/smsbillables/management/commands/bootstrap_yo_gateway.py | 1 | 1466 | from decimal import Decimal
from django.core.management.base import BaseCommand
from corehq.apps.accounting.models import Currency
from corehq.apps.sms.models import INCOMING, OUTGOING
from corehq.apps.smsbillables.models import (
SmsGatewayFee,
SmsGatewayFeeCriteria,
)
from corehq.apps.smsbillables.utils imp... | bsd-3-clause | bf7dd6f0e870ed48dad1e18380cf2ed5 | 31.577778 | 127 | 0.710778 | 3.393519 | false | false | false | false |
dimagi/commcare-hq | corehq/util/context_managers.py | 1 | 1676 | from contextlib import contextmanager
from django.core.cache import cache
from corehq.const import DEFAULT_PARALLEL_EXECUTION_TIMEOUT
from corehq.util.exceptions import ParallelExecutionError
from corehq.util.soft_assert import soft_assert
@contextmanager
def drop_connected_signals(signal):
"""
Use as a con... | bsd-3-clause | c22c2db09f66219a8d99a24b5bf73d9a | 27.896552 | 100 | 0.702864 | 4.019185 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/users/middleware.py | 1 | 1106 | from django.utils.deprecation import MiddlewareMixin
from corehq.apps.users.models import CouchUser, InvalidUser
from corehq.apps.users.util import username_to_user_id
SESSION_USER_KEY_PREFIX = "session_user_doc_%s"
class UsersMiddleware(MiddlewareMixin):
def process_view(self, request, view_func, view_args, v... | bsd-3-clause | c38804344db3b4105d4fb46296aa0dc2 | 38.5 | 71 | 0.638336 | 3.935943 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/api/resources/auth.py | 1 | 7323 | import json
from functools import wraps
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponse, HttpResponseForbidden
from attrs import define, field
from tastypie.authentication import Authentication
from corehq.apps.api.odata.views import odata_permissions_check
from core... | bsd-3-clause | 174b69a91c919756278b4640ff0af9a6 | 32.286364 | 108 | 0.639492 | 4.194158 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/enterprise/forms.py | 1 | 12977 | from django import forms
from django.core.exceptions import ValidationError
from django.urls import reverse
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from crispy_forms import layout as crispy
from crispy_forms.bootstrap import PrependedText, StrictButton
from c... | bsd-3-clause | aa0c70408eff1a2c4ac7f37a73a810ca | 40.460064 | 113 | 0.579795 | 4.451801 | false | false | false | false |
dimagi/commcare-hq | corehq/form_processor/management/commands/check_forms_have_xml.py | 1 | 1826 | import csv
from django.core.management.base import BaseCommand
from corehq.blobs import get_blob_db
from corehq.form_processor.models import XFormInstance
from corehq.util.log import with_progress_bar
from couchforms.const import ATTACHMENT_NAME
class Command(BaseCommand):
help = "Check if there is form.xml in al... | bsd-3-clause | 2ab9f49c36380609a50ba5b914643eb6 | 43.536585 | 108 | 0.624863 | 3.757202 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/case_importer/tracking/views.py | 1 | 5365 | from django.db import transaction
from django.http import (
HttpResponseBadRequest,
HttpResponseForbidden,
HttpResponseNotFound,
StreamingHttpResponse,
)
from dimagi.utils.web import json_response
from django.views.decorators.http import require_GET
from corehq.apps.case_importer.base import location_... | bsd-3-clause | 24d80b91d0dfa747e834cab074875d87 | 33.837662 | 95 | 0.705871 | 3.694904 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/cachehq/mixins.py | 1 | 2872 | import logging
from django.conf import settings
from couchdbkit import ResourceNotFound
from dimagi.utils.couch.cache import cache_core
from corehq.apps.cachehq.invalidate import invalidate_document
from corehq.util.quickcache import quickcache
class _InvalidateCacheMixin(object):
def clear_caches(self):
... | bsd-3-clause | a0ace071170a8354b047018022cd50f4 | 30.911111 | 107 | 0.647632 | 3.881081 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/translations/integrations/transifex/parser.py | 1 | 7080 | import re
from datetime import datetime
from tempfile import NamedTemporaryFile
from memoized import memoized
from openpyxl import Workbook
from corehq.apps.dump_reload.const import DATETIME_FORMAT
from corehq.apps.translations.const import MODULES_AND_FORMS_SHEET_NAME
CONTEXT_REGEXS = {
# Module or Form: sheet ... | bsd-3-clause | 3ac3505a37fd1a94e27234efcafc5afd | 42.170732 | 109 | 0.627684 | 3.588444 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/payouts_dorado/tests/test_adapter.py | 1 | 1743 | from datetime import timedelta
import requests
from django.test.utils import override_settings
from django.utils.timezone import now
from moneyed.classes import Money
from bluebottle.funding.tests.factories import FundingFactory, DonorFactory
from bluebottle.funding_pledge.tests.factories import PledgePaymentFactory
... | bsd-3-clause | 713ee1e45f1b4b1125da795168d94de1 | 35.3125 | 106 | 0.687321 | 3.847682 | false | true | false | false |
dimagi/commcare-hq | scripts/purge-platform-pkgs.py | 1 | 2040 | #!/usr/bin/env python
"""Strip unwanted packages out of pip-compiled requirements txt files.
TODO:
- support packages with multiple via's
- accept purge package details via --package argument instead of global dict
"""
import argparse
import sys
from collections import deque
PACKAGES_TO_PURGE = {
# package, via
... | bsd-3-clause | 34f2a9cc2a5fb72cce5de26c298c2256 | 31.380952 | 88 | 0.632353 | 3.953488 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/projects/migrations/0038_auto_20170915_1358.py | 1 | 1363 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-09-15 11:58
from __future__ import unicode_literals
import bluebottle.utils.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0037_auto_20170915_1350'),
]
operations = [
... | bsd-3-clause | a16904915fa1604b896e8e4dc91f375f | 53.52 | 716 | 0.684519 | 3.883191 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/impact/tests/test_api.py | 1 | 9883 | # coding=utf-8
from builtins import str
import json
from django.contrib.auth.models import Group, Permission
from django.urls import reverse
from rest_framework import status
from bluebottle.impact.models import ImpactGoal
from bluebottle.impact.tests.factories import (
ImpactTypeFactory, ImpactGoalFactory
)
from... | bsd-3-clause | 3d7b071bb96b80f6c6828c1e96145b83 | 32.276094 | 82 | 0.598199 | 4.083884 | false | true | false | false |
onepercentclub/bluebottle | bluebottle/activities/migrations/0015_auto_20200128_1045.py | 1 | 1320 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-01-28 09:45
from __future__ import unicode_literals
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 | ac40a895dc10077b6907a56f333c14f1 | 32.846154 | 154 | 0.627273 | 4.313725 | false | false | false | false |
dimagi/commcare-hq | corehq/messaging/smsbackends/turn/views.py | 1 | 1197 | import json
from corehq.apps.sms.api import incoming as incoming_sms
from corehq.apps.sms.views import IncomingBackendView
from corehq.messaging.smsbackends.turn.models import SQLTurnWhatsAppBackend
from django.http import HttpResponse
class TurnIncomingSMSView(IncomingBackendView):
urlname = 'turn_sms'
@pro... | bsd-3-clause | 1676d4a4f4201946d5d3353dd267c79e | 34.205882 | 95 | 0.596491 | 4.071429 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/reports/filters/devicelog.py | 1 | 3212 | from django.urls import reverse
from django.utils.translation import gettext_lazy
from phonelog.models import DeviceReportEntry
from corehq.apps.reports.filters.base import (
BaseMultipleOptionFilter,
BaseReportFilter,
BaseSingleOptionFilter,
BaseTagsFilter,
)
from corehq.util.queries import fast_dist... | bsd-3-clause | 59902eefae9edceba54e49cce447bf3f | 29.301887 | 82 | 0.650374 | 3.769953 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/projects/migrations/0046_auto_20171023_2047.py | 1 | 1344 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-10-23 18:47
from __future__ import unicode_literals
import bluebottle.utils.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0045_auto_201710... | bsd-3-clause | e928cc8596d615529adba77357e2f365 | 31 | 155 | 0.608631 | 4.37785 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/funding/base_serializers.py | 1 | 1473 | from builtins import object
from rest_framework.serializers import ModelSerializer
from rest_framework_json_api.relations import ResourceRelatedField
from bluebottle.funding.models import Donor, Payment, BankAccount, PayoutAccount
from bluebottle.transitions.serializers import AvailableTransitionsField
from bluebottle... | bsd-3-clause | a2eed87a7da1985114f76ef2954f4edb | 28.46 | 84 | 0.691785 | 4.307018 | false | false | false | false |
dimagi/commcare-hq | corehq/form_processor/interfaces/dbaccessors.py | 1 | 3360 | from abc import ABCMeta, abstractmethod
from memoized import memoized
class AbstractLedgerAccessor(metaclass=ABCMeta):
@staticmethod
@abstractmethod
def get_transactions_for_consumption(domain, case_id, product_id, section_id, window_start, window_end):
raise NotImplementedError
@staticmeth... | bsd-3-clause | 7ad7bd5d7f3a2ed33b06e41e45910600 | 33.639175 | 115 | 0.652381 | 3.779528 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/enterprise/views.py | 1 | 17321 | import json
from django.conf import settings
from django.contrib import messages
from django.core.files.base import ContentFile
from django.core.paginator import Paginator
from django.db.models import Sum
from django.http import (
HttpResponse,
HttpResponseNotFound,
HttpResponseRedirect,
JsonResponse,
... | bsd-3-clause | 3a04c9c0a4e2631ccee7d838ededa059 | 37.068132 | 110 | 0.656024 | 4.287376 | false | true | false | false |
dimagi/commcare-hq | corehq/motech/openmrs/const.py | 1 | 3921 | import logging
from itertools import chain
LOG_LEVEL_CHOICES = (
(99, 'Disable logging'),
(logging.ERROR, 'Error'),
(logging.INFO, 'Info'),
)
# device_id for cases added/updated by an OpenmrsImporter.
# OpenmrsImporter ID is appended to this.
OPENMRS_IMPORTER_DEVICE_ID_PREFIX = 'openmrs-importer-'
# XMLN... | bsd-3-clause | e6087ac82134636d9753d64ca847fe40 | 31.94958 | 72 | 0.69166 | 2.893727 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/change_feed/topics.py | 1 | 4684 | from kafka.common import OffsetRequestPayload
from corehq.apps.app_manager.util import app_doc_types
from corehq.apps.change_feed.connection import get_simple_kafka_client
from corehq.apps.change_feed.exceptions import UnavailableKafkaOffset
from corehq.form_processor.models import XFormInstance
DOMAIN = 'domain'
MET... | bsd-3-clause | 54dd73ab8f01abcfe7dbbd2bcce54f6c | 32.697842 | 124 | 0.66567 | 3.688189 | false | true | false | false |
dimagi/commcare-hq | corehq/sql_proxy_standby_accessors/migrations/0001_initial.py | 1 | 1391 | from django.conf import settings
from django.db import migrations
from corehq.sql_db.config import plproxy_standby_config
from corehq.sql_db.management.commands.configure_pl_proxy_cluster import (
get_drop_server_sql,
get_sql_to_create_pl_proxy_cluster,
)
from corehq.sql_db.operations import RawSQLMigration
fr... | bsd-3-clause | 503e6d55a3956441333860de6f837576 | 32.119048 | 103 | 0.701653 | 3.650919 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/reports/management/commands/rollout_ecd_preview.py | 1 | 4170 | from django.core.management import BaseCommand
from django.db.models import Q
from corehq.apps.accounting.models import SoftwarePlanEdition, Subscription
from corehq.feature_previews import EXPLORE_CASE_DATA_PREVIEW
from corehq.toggles import (
ECD_MIGRATED_DOMAINS,
ECD_PREVIEW_ENTERPRISE_DOMAINS,
NAMESPAC... | bsd-3-clause | 39a5e374fd3cc8b9b839f6588ebaa6d8 | 35.26087 | 86 | 0.590887 | 4.080235 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/members/migrations/0058_auto_20220607_0934.py | 1 | 1163 | # Generated by Django 2.2.24 on 2022-06-07 07:34
import bluebottle.bb_accounts.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('members', '0057_auto_20220516_1412'),
]
operations = [
migrations.Add... | bsd-3-clause | 429955b811e87e887c53e4b169793ba1 | 37.766667 | 162 | 0.660361 | 4.473077 | false | false | false | false |
dimagi/commcare-hq | corehq/form_processor/utils/xform.py | 1 | 9152 | from datetime import datetime
from lxml import etree
import re
import iso8601
import pytz
import xml2json
from corehq.form_processor.interfaces.processor import XFormQuestionValueIterator
from corehq.form_processor.models import Attachment, XFormInstance
from corehq.form_processor.exceptions import XFormQuestionValue... | bsd-3-clause | 18b53f149792276b6b57d3704cb209a7 | 33.406015 | 114 | 0.655594 | 3.580595 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/payments_docdata/migrations/0001_initial.py | 2 | 8230 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-23 13:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('payments', '0001_initial'),
]
o... | bsd-3-clause | c63ae5b73fd60d5a47e26f84de68e1e7 | 68.159664 | 202 | 0.600729 | 4.257631 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/domain/project_access/middleware.py | 1 | 1526 | from datetime import datetime, timedelta
from django.utils.deprecation import MiddlewareMixin
from corehq.apps.domain.project_access.models import (
ENTRY_RECORD_FREQUENCY,
SuperuserProjectEntryRecord,
)
from corehq.apps.users.tasks import update_domain_date
from corehq.util.quickcache import quickcache
cla... | bsd-3-clause | c546917d2c4d39680dca440d4476b961 | 45.242424 | 98 | 0.714286 | 3.882952 | false | false | false | false |
dimagi/commcare-hq | corehq/pillows/ledger.py | 1 | 4277 | from collections import namedtuple
from functools import lru_cache
from pillowtop.checkpoints.manager import (
get_checkpoint_for_elasticsearch_pillow,
)
from pillowtop.pillow.interface import ConstructedPillow
from pillowtop.processors import PillowProcessor
from corehq.apps.change_feed import topics
from corehq... | bsd-3-clause | 56d15dd01f4d8958fa46c420769ba108 | 35.555556 | 111 | 0.708908 | 3.664953 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/case_search/views.py | 1 | 3244 | import json
import re
from django.http import Http404
from django.urls import reverse
from django.utils.translation import gettext_lazy
from dimagi.utils.web import json_response
from corehq.apps.case_search.models import case_search_enabled_for_domain
from corehq.apps.domain.decorators import cls_require_superuser_... | bsd-3-clause | 170f30dba2801c00682c838d84c584d3 | 35.044444 | 89 | 0.611591 | 3.951279 | false | false | false | false |
dimagi/commcare-hq | corehq/motech/generic_inbound/utils.py | 1 | 1296 | import json
import uuid
from base64 import urlsafe_b64encode
from django.utils.translation import gettext as _
from casexml.apps.phone.xml import get_registration_element_data
from corehq.apps.userreports.specs import EvaluationContext
from corehq.motech.generic_inbound.exceptions import GenericInboundUserError
def... | bsd-3-clause | 9a4a543e0fafd9a40ed0da20f11fed41 | 27.8 | 90 | 0.675926 | 3.800587 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/products/migrations/0001_initial.py | 1 | 1498 | from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='SQLProduct',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_... | bsd-3-clause | 398cfe7c5e88f224a1ff663f350dd554 | 43.058824 | 114 | 0.565421 | 4.317003 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/userreports/migrations/0018_ucrexpression.py | 1 | 1026 | # Generated by Django 3.2.12 on 2022-04-12 15:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userreports', '0017_index_cleanup'),
]
operations = [
migrations.CreateModel(
name='UCRExpression',
fields=[
... | bsd-3-clause | a073716e59369ab0d86c28e1b0d27894 | 37 | 198 | 0.567251 | 4.239669 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/cms/migrations/0035_auto_20171017_1611.py | 1 | 1079 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-10-17 14:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('cms', '0034_auto_20171017_1549'),
]
operations = [
... | bsd-3-clause | 86a39c2fd781382a9d4ad22c9166b84f | 26.666667 | 86 | 0.560704 | 4.386179 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.