text
stringlengths
0
1.05M
meta
dict
from django.utils import six from django.utils.encoding import smart_text from compressor.exceptions import ParserError from compressor.parser import ParserBase class DefaultHtmlParser(ParserBase, six.moves.html_parser.HTMLParser): def __init__(self, content): six.moves.html_parser.HTMLParser.__init__(se...
{ "repo_name": "WillisXChen/django-oscar", "path": "oscar/lib/python2.7/site-packages/compressor/parser/default_htmlparser.py", "copies": "6", "size": "2473", "license": "bsd-3-clause", "hash": 2910854038108893700, "line_mean": 30.3037974684, "line_max": 105, "alpha_frac": 0.5090982612, "autogenerat...
from django.utils import six from django.utils.six.moves.urllib import parse from django import template from oscar.core.loading import get_model from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import resolve, Resolver404 from oscar.apps.customer import history Site = get_model(...
{ "repo_name": "jinnykoo/christmas", "path": "src/oscar/templatetags/history_tags.py", "copies": "5", "size": "1909", "license": "bsd-3-clause", "hash": -2527715205040198000, "line_mean": 26.6666666667, "line_max": 76, "alpha_frac": 0.6600314301, "autogenerated": false, "ratio": 4.105376344086022,...
from django.utils import six from django.utils.six.moves.urllib.parse import urlencode from django import template from django.template.loader import render_to_string from django.utils.encoding import smart_str register = template.Library() def _do_paginator(context, adjacent_pages, template_name): if template_n...
{ "repo_name": "MichalMaM/ella", "path": "ella/core/templatetags/pagination.py", "copies": "1", "size": "2605", "license": "bsd-3-clause", "hash": 460708758700317600, "line_mean": 33.7333333333, "line_max": 122, "alpha_frac": 0.6452975048, "autogenerated": false, "ratio": 3.7698986975397974, "co...
from django.utils import six from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ( ObjectDoesNotExist, MultipleObjectsReturned, ValidationError,) from .model_arguments import QueryArgument from .inlines import InlineBase, InlineMetaClass, InlineOptions from .template_inlines...
{ "repo_name": "acdha/django-inlines", "path": "django_inlines/inlines/model_inlines.py", "copies": "2", "size": "2685", "license": "bsd-3-clause", "hash": 3355580044286985000, "line_mean": 30.2209302326, "line_max": 77, "alpha_frac": 0.6677839851, "autogenerated": false, "ratio": 4.12442396313364...
from django.utils import six from djsw_wrapper.router import SwaggerRouter from djsw_wrapper.errors import SwaggerValidationError, SwaggerGenericError import flex import os import re class Swagger(): # handle is local filename, file object, string or url def __init__(self, handle, module): self.schema...
{ "repo_name": "ErintLabs/django-openapi-gen", "path": "djsw_wrapper/core.py", "copies": "1", "size": "1957", "license": "mit", "hash": -6988149715581339000, "line_mean": 31.0819672131, "line_max": 115, "alpha_frac": 0.5886561063, "autogenerated": false, "ratio": 4.65952380952381, "config_test":...
from django.utils import six from functools import wraps try: # using compatible_datetime instead of datetime only # not to override the original datetime package from django.utils import timezone as compatible_datetime except ImportError: from datetime import datetime as compatible_datetime from dateti...
{ "repo_name": "pjdelport/Django-facebook", "path": "django_facebook/utils.py", "copies": "1", "size": "20990", "license": "bsd-3-clause", "hash": 1926579593918012700, "line_mean": 28.8577524893, "line_max": 157, "alpha_frac": 0.6468794664, "autogenerated": false, "ratio": 3.9897357916745864, "c...
from django.utils import six from openpyxl import Workbook from openpyxl.styles import Font from openpyxl.writer.write_only import WriteOnlyCell from main.utils_data_package import GenericSchema COLUMN_HEADER_FONT = Font(bold=True) class DefaultExporter: def __init__(self, dataset, records=None): self.d...
{ "repo_name": "ropable/biosys", "path": "biosys/apps/main/api/exporters.py", "copies": "2", "size": "2712", "license": "apache-2.0", "hash": -2409879672001830000, "line_mean": 29.1333333333, "line_max": 96, "alpha_frac": 0.5586283186, "autogenerated": false, "ratio": 4.244131455399061, "config_...
from django.utils import six from rest_framework import permissions, status from uuidfield.fields import StringUUID from mobile_framework import get_device_model, get_app_user_model AppUser = get_app_user_model() Device = get_device_model() class IsSameDeviceOrReadOnly(permissions.BasePermission): """ Allows...
{ "repo_name": "mstarinteractive/django-mobile-framework", "path": "mobile_framework/core/permissions.py", "copies": "1", "size": "1784", "license": "mit", "hash": -7217532351859115000, "line_mean": 32.0555555556, "line_max": 82, "alpha_frac": 0.6126681614, "autogenerated": false, "ratio": 4.26794...
from django.utils import six from rest_framework import status from rest_framework.views import exception_handler from kolibri.core import error_constants def custom_exception_handler(exc, context): # Call REST framework's default exception handler first, # to get the standard error response. response = ...
{ "repo_name": "DXCanas/kolibri", "path": "kolibri/core/utils.py", "copies": "1", "size": "1841", "license": "mit", "hash": 5435012426367749000, "line_mean": 35.82, "line_max": 87, "alpha_frac": 0.6295491581, "autogenerated": false, "ratio": 4.3522458628841605, "config_test": false, "has_no_ke...
from django.utils import six from rest_framework.permissions import AllowAny, IsAdminUser, IsAuthenticated from rest_framework.views import APIView from .compat import import_string from rest_framework_swagger import SWAGGER_SETTINGS class APIDocView(APIView): def initial(self, request, *args, **kwargs): ...
{ "repo_name": "CantemoInternal/django-rest-swagger", "path": "rest_framework_swagger/apidocview.py", "copies": "13", "size": "1343", "license": "bsd-2-clause", "hash": 8980289856855129000, "line_mean": 43.7666666667, "line_max": 88, "alpha_frac": 0.7043931497, "autogenerated": false, "ratio": 4.0...
from django.utils import six from rest_generator.helpers import * from django.core.management import call_command import os import ast import astor from django.conf import settings class AppsConfiguratorService(): def start(self, options): self.BASE_APP = settings.BASE_DIR.split('/')[-1] self.PROJE...
{ "repo_name": "harlov/django-rest-generator", "path": "rest_generator/services/apps_configurator_service.py", "copies": "1", "size": "2712", "license": "bsd-2-clause", "hash": 8449712049169906000, "line_mean": 36.6805555556, "line_max": 89, "alpha_frac": 0.5313421829, "autogenerated": false, "rat...
from django.utils import six import datetime import django from django.db import models from django import test from django.utils.functional import curry from django.utils.translation import activate, deactivate import dbsettings from dbsettings import loading, views # Set up some settings to test MODULE_NAME = 'db...
{ "repo_name": "johnpaulett/django-dbsettings", "path": "dbsettings/tests/tests.py", "copies": "2", "size": "20287", "license": "bsd-3-clause", "hash": 4689862404699737000, "line_mean": 47.8843373494, "line_max": 97, "alpha_frac": 0.649134914, "autogenerated": false, "ratio": 3.8313503305004724, ...
from django.utils import six import hashlib import random from django.conf import settings from django.contrib.auth import models as auth_models from django.core.urlresolvers import reverse from django.core.validators import RegexValidator from django.db import models from django.template import Template, Context, Tem...
{ "repo_name": "faratro/django-oscar", "path": "src/oscar/apps/customer/abstract_models.py", "copies": "22", "size": "15661", "license": "bsd-3-clause", "hash": 1608415473345283800, "line_mean": 35.8494117647, "line_max": 79, "alpha_frac": 0.6168827023, "autogenerated": false, "ratio": 4.270793564...
from django.utils import six import warnings from django.forms.forms import get_declared_fields from django.forms.widgets import media_property from django.core.exceptions import FieldError from django_town.mongoengine_extension.forms.field_factory import fields_for_document from django_town.mongoengine_extension.form...
{ "repo_name": "uptown/django-town", "path": "django_town/mongoengine_extension/forms/options.py", "copies": "1", "size": "4323", "license": "mit", "hash": 2282945053851151600, "line_mean": 44.0416666667, "line_max": 91, "alpha_frac": 0.5699745547, "autogenerated": false, "ratio": 4.63344051446945...
from django.utils import six import warnings from django.template import Library from django.templatetags.static import static from static_precompiler.settings import PREPEND_STATIC_URL, USE_CACHE, CACHE_TIMEOUT from static_precompiler.utils import compile_static, get_compiler_by_name, get_cache_key, get_hexdigest, ge...
{ "repo_name": "paera/django-static-precompiler", "path": "static_precompiler/templatetags/compile_static.py", "copies": "1", "size": "2031", "license": "mit", "hash": 413315958592667840, "line_mean": 30.2461538462, "line_max": 114, "alpha_frac": 0.6715903496, "autogenerated": false, "ratio": 3.86...
from django.utils import six from .base import TableMeta class AlreadyRegistered(Exception): pass class Manager(object): def __init__(self, ): self._registry = {} def register(self, table_or_iterable): if isinstance(table_or_iterable, TableMeta): table_or_iterable = [table_...
{ "repo_name": "scibi/django-sqltables-old", "path": "sqltables/manager.py", "copies": "1", "size": "1040", "license": "bsd-3-clause", "hash": 614261296118900000, "line_mean": 22.6363636364, "line_max": 81, "alpha_frac": 0.5951923077, "autogenerated": false, "ratio": 4.3153526970954355, "config_...
from django.utils import six from common.models import Project, Settings from testreport.models import TestPlan from testreport.models import Launch from testreport.models import Build from testreport.models import TestResult from testreport.models import LaunchItem from testreport.models import Bug from stages.model...
{ "repo_name": "2gis/badger-api", "path": "cdws_api/serializers.py", "copies": "1", "size": "4242", "license": "mit", "hash": -751852987268686300, "line_mean": 27.0927152318, "line_max": 78, "alpha_frac": 0.667845356, "autogenerated": false, "ratio": 4.4004149377593365, "config_test": true, "h...
from django.utils import six from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured from oscar.core.loading import get_model # A setting that can be used in foreign key declarations AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', '...
{ "repo_name": "jinnykoo/wuyisj", "path": "src/oscar/core/compat.py", "copies": "5", "size": "5848", "license": "bsd-3-clause", "hash": 4156816608988356000, "line_mean": 31.4888888889, "line_max": 79, "alpha_frac": 0.6427838577, "autogenerated": false, "ratio": 4.080949057920447, "config_test": ...
from django.utils import six from django.contrib import messages from django.contrib.sites.models import get_current_site from oscar.core.loading import get_model from django.template import TemplateSyntaxError from django.utils.translation import ugettext_lazy as _ from django.views import generic from oscar.core.lo...
{ "repo_name": "saadatqadri/django-oscar", "path": "src/oscar/apps/dashboard/communications/views.py", "copies": "33", "size": "3118", "license": "bsd-3-clause", "hash": 6858106863527144000, "line_mean": 35.2558139535, "line_max": 76, "alpha_frac": 0.6423989737, "autogenerated": false, "ratio": 4....
from django.utils import six from django import forms from oscar.core.loading import get_model from django.template import Template, TemplateSyntaxError from django.utils.translation import ugettext_lazy as _ from oscar.apps.customer.utils import normalise_email CommunicationEventType = get_model('customer', 'Communi...
{ "repo_name": "kapt/django-oscar", "path": "oscar/apps/dashboard/communications/forms.py", "copies": "33", "size": "3228", "license": "bsd-3-clause", "hash": -7569007085450011000, "line_mean": 34.8666666667, "line_max": 79, "alpha_frac": 0.6328996283, "autogenerated": false, "ratio": 4.3562753036...
from django.utils import six from easy_thumbnails.conf import settings class Aliases(object): """ A container which stores and retrieves named easy-thumbnail options dictionaries. """ def __init__(self, populate_from_settings=True): """ Initialize the Aliases object. :pa...
{ "repo_name": "jaddison/easy-thumbnails", "path": "easy_thumbnails/alias.py", "copies": "8", "size": "4051", "license": "bsd-3-clause", "hash": 1945894817035144700, "line_mean": 31.1507936508, "line_max": 79, "alpha_frac": 0.5704764256, "autogenerated": false, "ratio": 4.408052230685528, "confi...
from django.utils import six from rest_framework.permissions import BasePermission, SAFE_METHODS from rest_framework_conditions.shortcuts import is_url_for_list_view, \ is_nested_url_for_current_user class ConditionPermission(BasePermission): """ Permission for evaluating a condition class. """ ...
{ "repo_name": "NextHub/drf-conditions", "path": "rest_framework_conditions/conditions.py", "copies": "1", "size": "11048", "license": "isc", "hash": 4019941248399855600, "line_mean": 26.144963145, "line_max": 79, "alpha_frac": 0.6376719768, "autogenerated": false, "ratio": 4.24923076923077, "co...
from django.utils import six import re from collections import deque __all__ = ["u", "Component"] _RX_TAG = re.compile(r'([. # ]?[^\s#.]+)') component_registry = {} def styles_to_string(value): if isinstance(value, str): return value return ";".join("%s:%s" % (key.replace("_", "-"), value) for ...
{ "repo_name": "vivsh/django-ginger", "path": "ginger/uru.py", "copies": "1", "size": "4660", "license": "mit", "hash": -1206357303483993900, "line_mean": 24.6098901099, "line_max": 113, "alpha_frac": 0.5122317597, "autogenerated": false, "ratio": 3.8544251447477254, "config_test": false, "has...
from django.utils import six class FileProxyMixin(object): """ A mixin class used to forward file methods to an underlaying file object. The internal file object has to be called "file":: class FileProxy(FileProxyMixin): def __init__(self, file): self.file = file ...
{ "repo_name": "rmboggs/django", "path": "django/core/files/utils.py", "copies": "395", "size": "1338", "license": "bsd-3-clause", "hash": -7402708627289800000, "line_mean": 38.3529411765, "line_max": 69, "alpha_frac": 0.6883408072, "autogenerated": false, "ratio": 3.878260869565217, "config_tes...
from django.utils import six # NOTE: the downside here is that we will not be able to control the order # of the limits as they get applied. Thus this - or alternatively, a # decorator based approach wouldn't be right, as one might want to # be explicit about what context will be shown for what. So ...
{ "repo_name": "PaesslerAG/django-performance-testing", "path": "proof-of-concepts/metaclass-based-registry.py", "copies": "1", "size": "1735", "license": "bsd-3-clause", "hash": -866651989815802800, "line_mean": 26.9838709677, "line_max": 76, "alpha_frac": 0.5677233429, "autogenerated": false, "r...
from django.utils import six try: from collections import UserDict except ImportError: from UserDict import UserDict # noqa try: from urllib.parse import parse_qsl, parse_qs, urlparse, urlunparse, urljoin except ImportError: from urlparse import parse_qsl, parse_qs, urlparse, urlunparse, urljoin # ...
{ "repo_name": "pztrick/django-allauth", "path": "allauth/compat.py", "copies": "1", "size": "1217", "license": "mit", "hash": 2138547623345165000, "line_mean": 26.0444444444, "line_max": 83, "alpha_frac": 0.606409203, "autogenerated": false, "ratio": 3.791277258566978, "config_test": false, "...
from django.utils import six from django.utils.deprecation import ( DeprecationInstanceCheck, RemovedInDjango20Warning, ) from . import engines from .base import Origin from .exceptions import TemplateDoesNotExist def get_template(template_name, using=None): """ Loads and returns a template f...
{ "repo_name": "yephper/django", "path": "django/template/loader.py", "copies": "1", "size": "2478", "license": "bsd-3-clause", "hash": -6127657328211894000, "line_mean": 30.1818181818, "line_max": 78, "alpha_frac": 0.6577885391, "autogenerated": false, "ratio": 4.489130434782608, "config_test":...
from django.utils import six class FileProxyMixin(object): """ A mixin class used to forward file methods to an underlaying file object. The internal file object has to be called "file":: class FileProxy(FileProxyMixin): def __init__(self, file): self.file =...
{ "repo_name": "yephper/django", "path": "django/core/files/utils.py", "copies": "1", "size": "1372", "license": "bsd-3-clause", "hash": -5135472566110096000, "line_mean": 38.3529411765, "line_max": 69, "alpha_frac": 0.6712827988, "autogenerated": false, "ratio": 3.9768115942028985, "config_test...
from django.utils import six class FileProxyMixin(object): """ A mixin class used to forward file methods to an underlaying file object. The internal file object has to be called "file":: class FileProxy(FileProxyMixin): def __init__(self, file): self.file = file ...
{ "repo_name": "letouriste001/SmartForest_2.0", "path": "python3.4Smartforest/lib/python3.4/site-packages/django/core/files/utils.py", "copies": "1", "size": "1338", "license": "mit", "hash": -4676802610061007000, "line_mean": 38.3529411765, "line_max": 69, "alpha_frac": 0.6883408072, "autogenerated...
from django.utils import text, timezone from faker.generator import random from .compat import HAS_GEOS, HAS_PSYCOPG2 def comma_sep_integers(faker, field, *args, **kwargs): return ",".join([faker.random_int() for _ in range(10)]) def decimal(faker, field, *args, **kwargs): right_digits = field.decimal_pla...
{ "repo_name": "fcurella/django-fakery", "path": "django_fakery/fakes.py", "copies": "1", "size": "4684", "license": "mit", "hash": -4040493613003260400, "line_mean": 35.3100775194, "line_max": 88, "alpha_frac": 0.6253202391, "autogenerated": false, "ratio": 3.4825278810408924, "config_test": fa...
from django.utils import timezone as datetime from . import signals from .tasks import dispatch_action class Timeline(object): def __init__(self, instance, *args, **kwargs): from . import app self.instance = instance self.backend = kwargs.pop('backend', app.backend) def mark_as_rea...
{ "repo_name": "thoas/django-sequere", "path": "sequere/contrib/timeline/timeline.py", "copies": "1", "size": "2601", "license": "mit", "hash": -5783803341195037000, "line_mean": 33.68, "line_max": 98, "alpha_frac": 0.6024605921, "autogenerated": false, "ratio": 4.236156351791531, "config_test":...
from django.utils import timezone, dateparse from datetime import datetime, timedelta from .models import Reservation, Field ''' kind of utils for django-reservations ''' class ReservationExist(Exception): pass def create_reservation(field_id, res_date, reservation_time, user): """ Create reservation....
{ "repo_name": "kojdjak/django-reservations", "path": "reservations/rutils.py", "copies": "1", "size": "1628", "license": "mit", "hash": -4453062783353413600, "line_mean": 30.9411764706, "line_max": 117, "alpha_frac": 0.707002457, "autogenerated": false, "ratio": 3.7168949771689497, "config_test...
from django.utils import timezone from appPonto.models import * class Porta(models.Model): descricao = models.CharField('Descrição', max_length=255) local = models.CharField('Local', max_length=255) def __str__(self): return self.descricao class Meta: permissions = (('view_porta', 'Can see por...
{ "repo_name": "Ednilsonpalhares/ProjetoPontoPython", "path": "appPortas/models.py", "copies": "2", "size": "2815", "license": "mit", "hash": -372001796747158300, "line_mean": 37.4931506849, "line_max": 110, "alpha_frac": 0.5950177936, "autogenerated": false, "ratio": 3.1118493909191582, "config...
from django.utils import timezone from approver.models import Project, ClinicalArea, ClinicalSetting, Person, BigAim, Descriptor, Contact from django.contrib.auth.models import User from approver import utils class ProjectForm(): def __init__(self, project=Project(),is_disabled=False): start_date = projec...
{ "repo_name": "PFWhite/qipr_approver", "path": "qipr_approver/approver/forms/project_form.py", "copies": "1", "size": "5923", "license": "apache-2.0", "hash": -5615138991530440000, "line_mean": 60.0412371134, "line_max": 286, "alpha_frac": 0.4847154197, "autogenerated": false, "ratio": 4.72545889...
from django.utils import timezone from approver.models import Project, Keyword, ClinicalArea, ClinicalSetting, SafetyTarget, Person, BigAim from django.contrib.auth.models import User from approver import utils class ProjectForm(): def __init__(self, project=Project(),is_disabled=False): start_date = proj...
{ "repo_name": "amberlallen/qipr_approver", "path": "qipr_approver/approver/forms/project_form.py", "copies": "1", "size": "4749", "license": "apache-2.0", "hash": 7388909333681867000, "line_mean": 53.5862068966, "line_max": 125, "alpha_frac": 0.4640977048, "autogenerated": false, "ratio": 4.57514...
from django.utils import timezone from arango import ArangoClient from datetime import date, datetime, timedelta from django.conf import settings from SocialNetwork_API.const import ActionType, CollectionType class ArangoCore(object): @classmethod def clean_data(cls, data): if 'tip_amount' in data: ...
{ "repo_name": "HoangNguyenHuy/SocialNetwork", "path": "src/SocialNetwork_API/arango_core/core.py", "copies": "1", "size": "17818", "license": "mit", "hash": 8026363506102341000, "line_mean": 37.5692640693, "line_max": 133, "alpha_frac": 0.5739140195, "autogenerated": false, "ratio": 4.58281893004...
from django.utils import timezone from bootstrapform import models from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from cloudinary.models import CloudinaryField from django.template.defaultfilters import register class UserProfile(models.Model): ...
{ "repo_name": "andela/codango", "path": "codango/userprofile/models.py", "copies": "1", "size": "3897", "license": "mit", "hash": 6787125811050483000, "line_mean": 31.475, "line_max": 79, "alpha_frac": 0.6789838337, "autogenerated": false, "ratio": 3.9323915237134206, "config_test": false, "h...
from django.utils import timezone from common.headers import * from app.models import * VALIDATION_FAILED = L('Form validation failed.') def urlpatterns(): return patterns('', url('^list/$', get_list), url('^add/$', add), url('^item:(?P<pk>.*)/$', item),...
{ "repo_name": "lingxiaoyang/N2O", "path": "app/modules/poll/api.py", "copies": "1", "size": "3383", "license": "mit", "hash": -7009290745652379000, "line_mean": 32.495049505, "line_max": 80, "alpha_frac": 0.5663612179, "autogenerated": false, "ratio": 3.8840413318025258, "config_test": false, ...
from django.utils import timezone from contactboard.models import Curs def status_inscripcio(extraescolar, alumne): reqs = [] des_de = extraescolar.inscripcio_des_de if des_de: ok = timezone.now() > des_de # pylint: disable=invalid-name reqs.append({'ok': ok, 'motiu': 'inici', 'data': des...
{ "repo_name": "victorg590/ampadb", "path": "extraescolars/support.py", "copies": "2", "size": "1723", "license": "mit", "hash": 4412737870827282000, "line_mean": 37.2666666667, "line_max": 71, "alpha_frac": 0.5023228804, "autogenerated": false, "ratio": 3.273764258555133, "config_test": false, ...
from django.utils import timezone from {{ cookiecutter.repo_name }}.apps.devices.models import Device from celery import shared_task import os @shared_task def pull_attributes(device_id=None, **kwargs): """ Pulls attribute data from the device vendor's API, stores the attributes in the database, and r...
{ "repo_name": "aschn/cookiecutter-django-iot", "path": "{{ cookiecutter.repo_name }}/{{ cookiecutter.repo_name }}/apps/interactions/tasks.py", "copies": "1", "size": "2807", "license": "mit", "hash": -6000535559486100000, "line_mean": 23.8407079646, "line_max": 67, "alpha_frac": 0.6095475597, "auto...
from django.utils import timezone from datetime import datetime from base.forms import (CreateForm, UpdateForm, DeleteForm) from business.models import BusinessModel from locus.models import AddressModel from offer.models import (OfferModel, OfferCategoryMapModel) from upload.models import FileUploadModel from base.v...
{ "repo_name": "amitdhiman000/MyOffers", "path": "offer/forms.py", "copies": "1", "size": "5411", "license": "apache-2.0", "hash": -2917309436225103400, "line_mean": 31.993902439, "line_max": 102, "alpha_frac": 0.5876917391, "autogenerated": false, "ratio": 3.755031228313671, "config_test": fals...
from django.utils import timezone from datetime import datetime from functools import wraps from shutil import rmtree import gnupg import tempfile def with_gpg_obj(func): @wraps(func) def inner(key): # create temp gpg keyring temp_dir = tempfile.mkdtemp() gpg_obj = gnupg.GPG(homedir=te...
{ "repo_name": "whitesmith/hawkpost", "path": "humans/utils.py", "copies": "1", "size": "1765", "license": "mit", "hash": -7977370706621619000, "line_mean": 28.4166666667, "line_max": 78, "alpha_frac": 0.6311614731, "autogenerated": false, "ratio": 3.8369565217391304, "config_test": false, "ha...
from django.utils import timezone from datetime import datetime, timedelta, MINYEAR from zerver.lib.timestamp import is_timezone_aware from six import text_type MIN_TIME = datetime(MINYEAR, 1, 1, 0, 0, 0, tzinfo=timezone.utc) # Name isn't great .. fixedinterval? timerange? Trying to distinguish # generic intervals l...
{ "repo_name": "umkay/zulip", "path": "analytics/lib/interval.py", "copies": "2", "size": "2898", "license": "apache-2.0", "hash": -6966194024212589000, "line_mean": 40.4, "line_max": 96, "alpha_frac": 0.6666666667, "autogenerated": false, "ratio": 3.986244841815681, "config_test": false, "has...
from django.utils import timezone from datetime import datetime,timedelta from borg_utils.singleton import SingletonMetaclass,Singleton class JobIntervalMetaclass(SingletonMetaclass): """ A metaclass for job interval class """ _classes = [] def __init__(cls,name,base,dct): """ cach...
{ "repo_name": "rockychen-dpaw/borgcollector", "path": "borg_utils/jobintervals.py", "copies": "2", "size": "7328", "license": "bsd-3-clause", "hash": -4800493409660603000, "line_mean": 25.5507246377, "line_max": 182, "alpha_frac": 0.5825600437, "autogenerated": false, "ratio": 4.024162548050522, ...
from django.utils import timezone from dateutil.parser import parse as date_parse from channels import Channel from channels.generic.websockets import JsonWebsocketConsumer from webirc.models import IRCScreen, Screen, Message, EnterExitEvent from django.dispatch import receiver from django.db.models.signals import po...
{ "repo_name": "jawsper/webirc", "path": "src/webirc/consumers/__init__.py", "copies": "1", "size": "5305", "license": "mit", "hash": -7999778012362529000, "line_mean": 32.3647798742, "line_max": 102, "alpha_frac": 0.5447690858, "autogenerated": false, "ratio": 4.2103174603174605, "config_test":...
from django.utils import timezone from dateutil.relativedelta import relativedelta import logging from django.core.management.base import BaseCommand from django.db.models import Count from frontend.models import OrgBookmark from frontend.models import SearchBookmark from frontend.models import User logger = logging...
{ "repo_name": "annapowellsmith/openpresc", "path": "openprescribing/frontend/management/commands/cleanup_unverified_alerts.py", "copies": "1", "size": "1251", "license": "mit", "hash": -7594375084341586000, "line_mean": 35.7941176471, "line_max": 68, "alpha_frac": 0.6554756195, "autogenerated": fal...
from django.utils import timezone from decimal import Decimal, getcontext def mk_int(s): """ Function to change a string to int or 0 if None. :param s: String to change to int. :return: Either returns the int of the string or 0 for None. """ try: s = s.strip() return int(s) if...
{ "repo_name": "toms3t/Propalyzer", "path": "propalyzer_site/propalyzer_app/context_data.py", "copies": "1", "size": "17138", "license": "mit", "hash": 3560546983824879000, "line_mean": 35.7768240343, "line_max": 108, "alpha_frac": 0.5416034543, "autogenerated": false, "ratio": 3.4692307692307693,...
from django.utils import timezone from decimal import Decimal from hiicart.gateway.base import IPNBase from hiicart.gateway.google.settings import SETTINGS as default_settings from hiicart.models import CART_TYPES class GoogleIPN(IPNBase): """Google Checkout IPN Handler.""" def __init__(self, cart): ...
{ "repo_name": "hiidef/hiicart", "path": "hiicart/gateway/google/ipn.py", "copies": "1", "size": "7705", "license": "mit", "hash": 3969837253656628000, "line_mean": 42.5310734463, "line_max": 126, "alpha_frac": 0.6202465931, "autogenerated": false, "ratio": 3.8200297471492317, "config_test": fal...
from django.utils import timezone from dilla import spam, spammers import random #@spam.strict_handler('easyblog.Post.title') #def get_blog_post_title(record, field): # return random.choice(string.ascii_letters) @spam.global_handler('DateField') @spam.global_handler('TimeField') @spam.global_handler('DateTimeField...
{ "repo_name": "jmcclell/easyblog", "path": "sample/dilla_spamlib.py", "copies": "1", "size": "1034", "license": "mit", "hash": 3670372655638836700, "line_mean": 33.5, "line_max": 70, "alpha_frac": 0.7359767892, "autogenerated": false, "ratio": 3.5170068027210886, "config_test": false, "has_no...
from django.utils import timezone from django.conf import settings from django.core.validators import MinLengthValidator, MaxLengthValidator, MinValueValidator, MaxValueValidator from django.db import models from survey.interviewer_configs import LEVEL_OF_EDUCATION, LANGUAGES, INTERVIEWER_MIN_AGE, INTERVIEWER_MAX_AGE f...
{ "repo_name": "unicefuganda/uSurvey", "path": "survey/models/interviewer.py", "copies": "1", "size": "9210", "license": "bsd-3-clause", "hash": -5021631270633770000, "line_mean": 36.5918367347, "line_max": 117, "alpha_frac": 0.6338762215, "autogenerated": false, "ratio": 4.228650137741047, "con...
from django.utils import timezone from django.conf import settings from api.exceptions import AuthenticationFailed, PermissionDenied from api.authentication import BaseAuthentication, TokenAuthentication, SessionAuthentication as _SessionAuthentication from gui.models import User from vms.models import Dc def _set_r...
{ "repo_name": "erigones/esdc-ce", "path": "api/accounts/base/authentication.py", "copies": "1", "size": "2586", "license": "apache-2.0", "hash": -9198491801009661000, "line_mean": 31.325, "line_max": 119, "alpha_frac": 0.680974478, "autogenerated": false, "ratio": 4.360876897133221, "config_tes...
from django.utils import timezone from django.conf import settings from django.contrib.auth import models as django_auth_models from ..db import models from ..db.models.manager import NodeModelManager from ..decorators import borrows_methods class UserManager(NodeModelManager, django_auth_models.UserManager): pa...
{ "repo_name": "mpetyx/django-rdfGraph", "path": "graphBackend/graphBackend/api/neo4django/graph_auth/models.py", "copies": "3", "size": "1607", "license": "mit", "hash": -3206726615408297000, "line_mean": 36.3720930233, "line_max": 76, "alpha_frac": 0.7429993777, "autogenerated": false, "ratio": ...
from django.utils import timezone from django.conf import settings import logging import datetime from .models import Comment, Commenter from .forms import CommentForm from .tasks import send_email logger = logging.getLogger(__name__) class CommentFormMixin(object): form_class = CommentForm # override...
{ "repo_name": "marthaurion/blog_django", "path": "comments/views.py", "copies": "1", "size": "4193", "license": "mit", "hash": -8230110420220637000, "line_mean": 43.6170212766, "line_max": 124, "alpha_frac": 0.625804913, "autogenerated": false, "ratio": 4.537878787878788, "config_test": false, ...
from django.utils import timezone from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.auth.models import PermissionsMixin from django.core.urlresolvers import reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils....
{ "repo_name": "foohooboo/graphql-cookiecutter", "path": "graphql_cookiecutter/users/models.py", "copies": "1", "size": "2826", "license": "mit", "hash": -8538061240327196000, "line_mean": 32.6428571429, "line_max": 81, "alpha_frac": 0.6535739561, "autogenerated": false, "ratio": 4.077922077922078...
from django.utils import timezone from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import PermissionsMixin, UserManager from django.db import models from django.utils.translation import ugettext_lazy as _ MAX_LENGTH = 255 # Create your models here. class User(AbstractBaseUs...
{ "repo_name": "ycheng-aa/qr_server", "path": "apps/auth/models.py", "copies": "1", "size": "2359", "license": "mit", "hash": 1366650697722124000, "line_mean": 32.7142857143, "line_max": 111, "alpha_frac": 0.6396778296, "autogenerated": false, "ratio": 4.109756097560975, "config_test": false, ...
from django.utils import timezone from django.contrib.auth.decorators import login_required from django.contrib.auth import get_user_model from django.core import signing from django.core.urlresolvers import reverse from django.shortcuts import resolve_url from django.utils.decorators import method_decorator from djang...
{ "repo_name": "tarak/django-password-policies", "path": "password_policies/views.py", "copies": "1", "size": "10896", "license": "bsd-3-clause", "hash": -8808141230543305000, "line_mean": 38.4782608696, "line_max": 80, "alpha_frac": 0.6455580029, "autogenerated": false, "ratio": 4.242990654205608...
from django.utils import timezone from django.contrib.auth.models import BaseUserManager class UserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser, **extra_fields): """ Creates and saves a User with the given email and password. ...
{ "repo_name": "SLCPython/slcpy.com", "path": "slcpy/users/managers.py", "copies": "1", "size": "1089", "license": "mit", "hash": -2879399514455119000, "line_mean": 37.8928571429, "line_max": 79, "alpha_frac": 0.6060606061, "autogenerated": false, "ratio": 4.156488549618321, "config_test": false...
from django.utils import timezone from django.contrib.auth.models import User from django.db import models from django.db.models.signals import post_save from django.utils.translation import ugettext_lazy from guardian.shortcuts import get_perms_for_model, assign_perm from rest_framework.authtoken.models import Token f...
{ "repo_name": "spatialdev/onadata", "path": "onadata/apps/main/models/user_profile.py", "copies": "8", "size": "3006", "license": "bsd-2-clause", "hash": 1571958195003635700, "line_mean": 37.5384615385, "line_max": 78, "alpha_frac": 0.7019294744, "autogenerated": false, "ratio": 3.781132075471698...
from django.utils import timezone from django.contrib.contenttypes.models import ContentType from nose.tools import * # noqa: F403 from api.base.settings.defaults import API_BASE from tests.base import ApiTestCase from osf_tests.factories import ( AuthUserFactory, PreprintFactory ) from osf.utils.permissions...
{ "repo_name": "brianjgeiger/osf.io", "path": "api_tests/preprints/views/test_preprint_files_list.py", "copies": "4", "size": "15540", "license": "apache-2.0", "hash": 2038366270560269000, "line_mean": 34.9722222222, "line_max": 120, "alpha_frac": 0.6249034749, "autogenerated": false, "ratio": 3.5...
from django.utils import timezone from django.contrib import admin from django.conf.urls import patterns, url from django.shortcuts import render, redirect from us_ignite.profiles.models import Profile, ProfileLink from us_ignite.profiles import exporter, forms, inviter email = lambda u: u.user.email email.short_des...
{ "repo_name": "us-ignite/us_ignite", "path": "us_ignite/profiles/admin.py", "copies": "1", "size": "3644", "license": "bsd-3-clause", "hash": 748704400761779300, "line_mean": 34.7254901961, "line_max": 75, "alpha_frac": 0.573819978, "autogenerated": false, "ratio": 4.164571428571429, "config_te...
from django.utils import timezone from django.core.management.base import BaseCommand from optparse import make_option from orcamentos.crm.models import Employee from orcamentos.proposal.models import Entry, NumLastProposal class Command(BaseCommand): help = ''' Cria orçamento. ''' option_list = BaseCommand.o...
{ "repo_name": "rg3915/orcamentos", "path": "orcamentos/core/management/commands/create_proposal.py", "copies": "1", "size": "1127", "license": "mit", "hash": -2252501025609353500, "line_mean": 35.1290322581, "line_max": 67, "alpha_frac": 0.6035714286, "autogenerated": false, "ratio": 3.6482084690...
from django.utils import timezone from django.core.urlresolvers import reverse from django.db import models class PublishedPressReleaseManager(models.Manager): def get_queryset(self): return super(PublishedPressReleaseManager, self).get_queryset().filter( release_date__lt=timezone.now()) cla...
{ "repo_name": "MjAbuz/foundation", "path": "foundation/press/models.py", "copies": "2", "size": "1943", "license": "mit", "hash": -6604229339705519000, "line_mean": 28.8923076923, "line_max": 79, "alpha_frac": 0.6932578487, "autogenerated": false, "ratio": 4.014462809917355, "config_test": fals...
from django.utils import timezone from django.core.urlresolvers import reverse from rest_framework import serializers from taggit.models import Tag from . import models class EventSerializer(serializers.ModelSerializer): class Meta: model = models.Event fields = ( 'uuid', ...
{ "repo_name": "EliotBerriot/tempo", "path": "tempo/events/serializers.py", "copies": "1", "size": "2819", "license": "mit", "hash": -8749481768872759000, "line_mean": 23.7280701754, "line_max": 59, "alpha_frac": 0.586732884, "autogenerated": false, "ratio": 4.488853503184713, "config_test": fal...
from django.utils import timezone from django.db import models from django.conf import settings from django.core.exceptions import ValidationError from django.utils.translation import ugettext as _ from jsonfield import JSONField class SurveyManager(models.Manager): def get_available_surveys(self): now =...
{ "repo_name": "sebastian-code/django-surveys", "path": "surveys/models.py", "copies": "1", "size": "3787", "license": "bsd-3-clause", "hash": 1701161029754827500, "line_mean": 33.7431192661, "line_max": 77, "alpha_frac": 0.6408766834, "autogenerated": false, "ratio": 4.2936507936507935, "config...
from django.utils import timezone from django.db import models from django.contrib.auth.models import User from django.utils.six import python_2_unicode_compatible from django.contrib.auth.models import User, Group #from rest_framework import serializers # Create your models here. class Article(models.Model): aut...
{ "repo_name": "htwenhe/DJOA", "path": "oa/models.py", "copies": "1", "size": "6664", "license": "mit", "hash": -2902208854691226600, "line_mean": 30.2962962963, "line_max": 88, "alpha_frac": 0.6852071006, "autogenerated": false, "ratio": 2.1240050272308335, "config_test": false, "has_no_keywo...
from django.utils import timezone from django.db import models from django.contrib.auth.models import User class Category(models.Model): name = models.CharField(max_length=32,unique=True) def __str__(self): return self.name class UserProfile(models.Model): user = models.OneToOneField(User) h...
{ "repo_name": "starbt/flea_market", "path": "market/models.py", "copies": "1", "size": "2279", "license": "mit", "hash": -4848307152339056000, "line_mean": 37.6271186441, "line_max": 159, "alpha_frac": 0.7257569109, "autogenerated": false, "ratio": 3.5609375, "config_test": false, "has_no_key...
from django.utils import timezone from django.db import models from django.core.exceptions import ObjectDoesNotExist from .managers import PublisherManager from .utils import assert_draft from .signals import ( publisher_publish_pre_save_draft, publisher_pre_publish, publisher_post_publish, publisher_p...
{ "repo_name": "jp74/django-model-publisher", "path": "publisher/models.py", "copies": "1", "size": "8870", "license": "bsd-3-clause", "hash": 6126397678037380000, "line_mean": 30.1228070175, "line_max": 96, "alpha_frac": 0.6188275085, "autogenerated": false, "ratio": 4.421734795613161, "config_...
from django.utils import timezone from django.db import models from django.db.models.query import Q from django.contrib.contenttypes.models import ContentType try: # Django >= 1.8 from django.contrib.contenttypes.fields import GenericForeignKey except ImportError: # Django <= 1.7 from django.contrib.con...
{ "repo_name": "m000/django_generic_confirmation", "path": "generic_confirmation/models.py", "copies": "1", "size": "3304", "license": "bsd-3-clause", "hash": 3788120052762542000, "line_mean": 34.9130434783, "line_max": 94, "alpha_frac": 0.6619249395, "autogenerated": false, "ratio": 4.03418803418...
from django.utils import timezone from django.db import models from django.dispatch import receiver from django.core.exceptions import ValidationError from framework.utils import iso8601format from osf.utils.fields import NonNaiveDateTimeField from website.util import sanitize from osf.models.base import BaseModel, O...
{ "repo_name": "aaxelb/osf.io", "path": "osf/models/private_link.py", "copies": "1", "size": "2363", "license": "apache-2.0", "hash": 5407847320102121000, "line_mean": 41.1964285714, "line_max": 103, "alpha_frac": 0.6720270842, "autogenerated": false, "ratio": 3.8051529790660226, "config_test": ...
from django.utils import timezone from django.db import models from .models import CoreRun from .compute import Compute, JobFailError from django.views.generic.base import View from django.views.generic.detail import SingleObjectMixin, DetailView from django.shortcuts import render, redirect from django.http import Htt...
{ "repo_name": "OpenSourcePolicyCenter/webapp-public", "path": "webapp/apps/core/views.py", "copies": "2", "size": "6438", "license": "mit", "hash": -1532669856995114200, "line_mean": 37.3214285714, "line_max": 95, "alpha_frac": 0.554675365, "autogenerated": false, "ratio": 4.483286908077995, "c...
from django.utils import timezone from django.db import models from uuid import uuid4 class SimpleTokenAuthModel(models.Model): """ Model is intended to store a tokens used in an authentication process. This model provides information such as token string representation, last use and a boolean flag if a t...
{ "repo_name": "erigones/api_core", "path": "models.py", "copies": "1", "size": "1642", "license": "bsd-3-clause", "hash": 1814036239088437800, "line_mean": 32.5102040816, "line_max": 116, "alpha_frac": 0.6333739342, "autogenerated": false, "ratio": 4.691428571428571, "config_test": false, "ha...
from django.utils import timezone from django.db import models import datetime from django.contrib.auth.models import User class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __str__(self): return self.question_text ...
{ "repo_name": "matheuskiser/pdx_code_guild", "path": "django/mysite/polls/models.py", "copies": "1", "size": "1348", "license": "mit", "hash": -1974771666865645000, "line_mean": 30.3488372093, "line_max": 90, "alpha_frac": 0.7084569733, "autogenerated": false, "ratio": 4, "config_test": false, ...
from django.utils import timezone from django.db import models from framework.utils import iso8601format from osf.utils.fields import NonNaiveDateTimeField from website.util import sanitize from osf.models.base import BaseModel, ObjectIDMixin class PrivateLink(ObjectIDMixin, BaseModel): date_created = NonNaiveD...
{ "repo_name": "hmoco/osf.io", "path": "osf/models/private_link.py", "copies": "5", "size": "1805", "license": "apache-2.0", "hash": -2243013953605263000, "line_mean": 40.0227272727, "line_max": 92, "alpha_frac": 0.6526315789, "autogenerated": false, "ratio": 3.8160676532769555, "config_test": f...
from django.utils import timezone from django.db import models from framework.utils import iso8601format from osf.utils.fields import NonNaiveDatetimeField from website.util import sanitize from osf.models.base import BaseModel, ObjectIDMixin class PrivateLink(ObjectIDMixin, BaseModel): # TODO DELETE ME POST MI...
{ "repo_name": "mluo613/osf.io", "path": "osf/models/private_link.py", "copies": "2", "size": "2129", "license": "apache-2.0", "hash": 5192043355638300000, "line_mean": 39.1698113208, "line_max": 92, "alpha_frac": 0.6552372006, "autogenerated": false, "ratio": 3.6833910034602075, "config_test": ...
from django.utils import timezone from django.db import models class ArchivableModel(models.Model): ''' An abstract model class for models that are not meant to be deleted. Calling the delete() function on such models will result in archiving, which sets deleted_ts to current timestamp. Usage: ...
{ "repo_name": "tosfan4ever/hacktheplanet", "path": "api/generics.py", "copies": "2", "size": "1039", "license": "bsd-3-clause", "hash": -4373886250343837000, "line_mean": 27.8611111111, "line_max": 81, "alpha_frac": 0.624639076, "autogenerated": false, "ratio": 4.275720164609053, "config_test":...
from django.utils import timezone from django.db import models class SugestaoCompra(models.Model): nivel = models.CharField( db_index=True, max_length=1, verbose_name='Nível') referencia = models.CharField( db_index=True, max_length=5, verbose_name='Referência') tamanho = m...
{ "repo_name": "anselmobd/fo2", "path": "src/insumo/models.py", "copies": "1", "size": "1753", "license": "mit", "hash": -5836860378485375000, "line_mean": 30.1785714286, "line_max": 57, "alpha_frac": 0.6214203895, "autogenerated": false, "ratio": 3.3512476007677545, "config_test": false, "has...
from django.utils import timezone from django.db import models class Term(models.Model): SPRING = 'spring' SUMMER = 'summer' AUTUMN = 'autumn' WINTER = 'winter' QUARTERNAME_CHOICES = ( (WINTER, 'Winter'), (SPRING, 'Spring'), (SUMMER, 'Summer'), (AUTUMN, 'Autumn'), ...
{ "repo_name": "uw-it-aca/course-dashboards", "path": "coursedashboards/models/term.py", "copies": "1", "size": "2031", "license": "apache-2.0", "hash": 8473267794938476000, "line_mean": 26.8219178082, "line_max": 73, "alpha_frac": 0.5484982767, "autogenerated": false, "ratio": 3.5757042253521125,...
from django.utils import timezone from django.db import models, transaction class YearManager(models.Manager): @transaction.atomic def copy_last_year(self): last_year = self.all().order_by('-year')[0] new_year = self.model(year=last_year.year+1) new_year.add_periods(vt1_start=last_year...
{ "repo_name": "I-sektionen/i-portalen", "path": "wsgi/iportalen_django/course_evaluations/managers.py", "copies": "1", "size": "1163", "license": "mit", "hash": 6369695794183625000, "line_mean": 47.4583333333, "line_max": 93, "alpha_frac": 0.5907136715, "autogenerated": false, "ratio": 3.34195402...
from django.utils import timezone from django.db.models import Max from django.core.exceptions import ValidationError from breach.analyzer import decide_next_world_state from breach.backtracking_analyzer import decide_next_backtracking_world_state from breach.models import Target, Round, SampleSet from breach.sniffer ...
{ "repo_name": "dimkarakostas/rupture", "path": "backend/breach/strategy.py", "copies": "2", "size": "25526", "license": "mit", "hash": 6065101104733728000, "line_mean": 40.4383116883, "line_max": 143, "alpha_frac": 0.6201128261, "autogenerated": false, "ratio": 4.461027612722824, "config_test":...
from django.utils import timezone from django.db.models import Max from django.core.exceptions import ValidationError from breach.analyzer import decide_next_world_state from breach.models import Target, Round, SampleSet from breach.sniffer import Sniffer import string import requests import logging import random l...
{ "repo_name": "esarafianou/rupture", "path": "backend/breach/strategy.py", "copies": "1", "size": "21165", "license": "mit", "hash": 8374448430651045000, "line_mean": 40.0174418605, "line_max": 143, "alpha_frac": 0.6231514292, "autogenerated": false, "ratio": 4.487913486005089, "config_test": f...
from django.utils import timezone from django.db.models import ( Count, Subquery, Exists, OuterRef, Value, NullBooleanField, Case, When ) from rest_framework import serializers, viewsets, mixins, status from rest_framework.response import Response from rest_framework.reverse import reverse from oauth2_provide...
{ "repo_name": "stefanw/froide", "path": "froide/foirequestfollower/api_views.py", "copies": "1", "size": "8674", "license": "mit", "hash": 8770956799538485000, "line_mean": 34.1174089069, "line_max": 84, "alpha_frac": 0.6081392668, "autogenerated": false, "ratio": 4.365374937091092, "config_tes...
from django.utils import timezone from django.db.models import Q from django.db.models.query import QuerySet MAX_TILE_PROCESSING_TIME = timezone.timedelta(minutes=10) class SourceTileQuerySet(QuerySet): MAX_TILE_PROCESSING_TIME = MAX_TILE_PROCESSING_TIME @classmethod def get_timout(cls): return...
{ "repo_name": "pipermerriam/mozy", "path": "mozy/apps/mosaic/managers.py", "copies": "1", "size": "2332", "license": "mit", "hash": 1932079513031318300, "line_mean": 25.8045977011, "line_max": 63, "alpha_frac": 0.5544596913, "autogenerated": false, "ratio": 3.94585448392555, "config_test": fals...
from django.utils import timezone from django.db.models import Q from datetime import timedelta from .models import DiscountCombo def getApplicableDiscountCombos( cart_object_list, newCustomer=True, student=False, customer=None, addOn=False, cannotCombine=False, dateTime=None ): filters = Q(active=True...
{ "repo_name": "django-danceschool/django-danceschool", "path": "danceschool/discounts/helpers.py", "copies": "1", "size": "9011", "license": "bsd-3-clause", "hash": 5546494592261819000, "line_mean": 44.055, "line_max": 103, "alpha_frac": 0.596715126, "autogenerated": false, "ratio": 4.67860851505...
from django.utils import timezone from django.db.models import Q from rest_framework import status from rest_framework.response import Response from threepio import logger from atmosphere import settings from core.exceptions import ProviderNotActive from core.models import AtmosphereUser as User from core.models.all...
{ "repo_name": "CCI-MOC/GUI-Backend", "path": "api/v1/views/instance.py", "copies": "1", "size": "38019", "license": "apache-2.0", "hash": -7771473084693090000, "line_mean": 41.7660292463, "line_max": 110, "alpha_frac": 0.5871537915, "autogenerated": false, "ratio": 4.625182481751825, "config_te...
from django.utils import timezone from django_filters.rest_framework import DjangoFilterBackend from drf_haystack.viewsets import HaystackViewSet from rest_flex_fields.views import FlexFieldsMixin from rest_framework.permissions import AllowAny from rest_framework.viewsets import ReadOnlyModelViewSet from outpost.djan...
{ "repo_name": "medunigraz/outpost", "path": "src/outpost/django/typo3/api.py", "copies": "1", "size": "4495", "license": "bsd-2-clause", "hash": 1956525575985205800, "line_mean": 22.0512820513, "line_max": 67, "alpha_frac": 0.6578420467, "autogenerated": false, "ratio": 4.071557971014493, "conf...
from django.utils import timezone from django.forms import ( ValidationError, ModelForm, CharField, HiddenInput, Form, FileField, ) from .models import ( Article, ArticleComment, ) HONEYPOT_STRING = str(347 * 347) def honeypot_ok(cleaned_data, missing_name): return ( clea...
{ "repo_name": "w0rp/w0rpzone", "path": "blog/forms.py", "copies": "1", "size": "2339", "license": "bsd-2-clause", "hash": 5175004593482085000, "line_mean": 21.7087378641, "line_max": 75, "alpha_frac": 0.5724668662, "autogenerated": false, "ratio": 4.16934046345811, "config_test": false, "has_...
from django.utils import timezone from django.http import Http404 from django.shortcuts import get_object_or_404 from django.contrib.auth.models import User from django.db.models import Q from taggit.models import Tag from rest_framework.views import APIView from rest_framework.generics import ListAPIView from rest_fr...
{ "repo_name": "portnov/assethub", "path": "assethub/assets/rest.py", "copies": "1", "size": "3749", "license": "bsd-3-clause", "hash": 5952752536132512000, "line_mean": 36.1188118812, "line_max": 98, "alpha_frac": 0.6988530275, "autogenerated": false, "ratio": 3.942166140904311, "config_test": ...
from django.utils import timezone from django.http import HttpResponse, Http404 from django.shortcuts import render, redirect from django.views.generic import View, TemplateView from django.contrib import messages from django.contrib.auth import authenticate, login, logout from django.template.context_processors import...
{ "repo_name": "andela/codango", "path": "codango/account/views.py", "copies": "1", "size": "12479", "license": "mit", "hash": 2458559903448528000, "line_mean": 36.2507462687, "line_max": 79, "alpha_frac": 0.5679942303, "autogenerated": false, "ratio": 4.666791323859386, "config_test": false, ...
from django.utils import timezone from django.http import HttpResponseRedirect from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views.generic.base import TemplateView from django.views.generic.detail ...
{ "repo_name": "chibie/biblecomment", "path": "mybiblecomment/views.py", "copies": "1", "size": "6599", "license": "mit", "hash": 7922026920873257000, "line_mean": 41.8506493506, "line_max": 114, "alpha_frac": 0.6294893166, "autogenerated": false, "ratio": 3.951497005988024, "config_test": false...
from django.utils import timezone from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import * from inventory.devices.models import Ipad, Adapter, Headphones, Case class DeviceForm(forms.Form): '''Form for creating a new device. ''' DEVICE_TYPES = ( ...
{ "repo_name": "sloria/device-inventory", "path": "inventory/devices/forms.py", "copies": "1", "size": "4523", "license": "bsd-3-clause", "hash": 870091785569759500, "line_mean": 32.7537313433, "line_max": 79, "alpha_frac": 0.4810966173, "autogenerated": false, "ratio": 4.721294363256785, "confi...
from django.utils import timezone from django import forms from django.forms.util import ErrorDict EXPIRATION_MONTH_CHOICES = [(i, "%02d" % i) for i in range(1, 13)] EXPIRATION_YEAR_CHOICES = range(timezone.now().year, timezone.now().year + 10) FORM_MODEL_TRANSLATION = { 'billing__first_name': 'bill_first_name', ...
{ "repo_name": "hiidef/hiicart", "path": "hiicart/gateway/veritrans_air/forms.py", "copies": "1", "size": "3030", "license": "mit", "hash": 3109351743895716400, "line_mean": 38.3506493506, "line_max": 94, "alpha_frac": 0.6471947195, "autogenerated": false, "ratio": 3.5647058823529414, "config_te...
from django.utils import timezone from django import forms from django.forms.util import ErrorDict EXPIRATION_MONTH_CHOICES = [(i, "%02d" % i) for i in range(1, 13)] EXPIRATION_YEAR_CHOICES = range(timezone.now().year, timezone.now().year + 10) FORM_MODEL_TRANSLATION = { 'billing__first_name': 'bill_first_name',...
{ "repo_name": "hiidef/hiicart", "path": "hiicart/gateway/stripe/forms.py", "copies": "1", "size": "4447", "license": "mit", "hash": 3476588284001003000, "line_mean": 37.6695652174, "line_max": 133, "alpha_frac": 0.6498763211, "autogenerated": false, "ratio": 3.687396351575456, "config_test": fa...
from django.utils import timezone from django import forms from django.forms.util import ErrorDict PAYMENT_FIELDS = {'credit_card__number': 'x_card_num', 'credit_card__cvv': 'x_card_code', 'credit_card__exp_date': 'x_exp_date', 'credit_card__expiration_month': 'x_e...
{ "repo_name": "hiidef/hiicart", "path": "hiicart/gateway/authorizenet/forms.py", "copies": "1", "size": "5395", "license": "mit", "hash": -67328045055630600, "line_mean": 38.6691176471, "line_max": 131, "alpha_frac": 0.5568118628, "autogenerated": false, "ratio": 3.672566371681416, "config_test...
from django.utils import timezone from django import forms from wagtail.admin.forms import WagtailAdminPageForm from django.utils.translation import ugettext_lazy as _ class ReactionQuestionChoiceForm(forms.Form): choice = forms.ChoiceField( required=True, error_messages={'required': _("You didn'...
{ "repo_name": "praekelt/molo", "path": "molo/core/forms.py", "copies": "1", "size": "2501", "license": "bsd-2-clause", "hash": 1852684369036077600, "line_mean": 33.7361111111, "line_max": 78, "alpha_frac": 0.5533786485, "autogenerated": false, "ratio": 4.426548672566372, "config_test": false, ...
from django.utils import timezone from django_iot.apps.devices.models import Device from celery import shared_task import os @shared_task def pull_attributes(device_id=None, **kwargs): """ Pulls attribute data from the device vendor's API, stores the attributes in the database, and returns the pks of ...
{ "repo_name": "pmaxit/DJANGO_IOT", "path": "django_iot/apps/interactions/tasks.py", "copies": "1", "size": "2789", "license": "mit", "hash": -5415215365545720000, "line_mean": 23.6814159292, "line_max": 65, "alpha_frac": 0.6095374686, "autogenerated": false, "ratio": 3.6989389920424403, "config...
from django.utils import timezone from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.views import generic from blog.models import Post class PostView(generic.ListView): template_name = 'blog/posts.html' ...
{ "repo_name": "KellyChan/Python", "path": "python/django/django-blog/blogsite/blog/views.py", "copies": "3", "size": "1197", "license": "mit", "hash": -6123539609626784000, "line_mean": 25.0217391304, "line_max": 79, "alpha_frac": 0.6783625731, "autogenerated": false, "ratio": 4.057627118644068, ...
from django.utils import timezone from django.shortcuts import redirect from django.views.generic import View, TemplateView from django.shortcuts import render from django.core.urlresolvers import reverse_lazy from django.http import HttpResponseRedirect from .models import BodyWeightWorkout, WeightExercise from .form...
{ "repo_name": "johnshiver/fitizen", "path": "fitizen/body_weight_workout/views.py", "copies": "1", "size": "7190", "license": "mit", "hash": -5534753234417332000, "line_mean": 41.7976190476, "line_max": 126, "alpha_frac": 0.5503477051, "autogenerated": false, "ratio": 3.7447916666666665, "confi...
from django.utils import timezone from django.shortcuts import redirect, render from django.http import HttpResponse from .models import AccessAttempt, LockedUser from .appsettings import (LOCKOUT_COUNT_LIMIT, COOLOFF_PERIOD_SEC, LOCKOUT_TEMPLATE, LOCKOUT_MSG_URL) lockout_msg = "Too many lo...
{ "repo_name": "maulik13/django-antibrute", "path": "antibrute/main.py", "copies": "1", "size": "2122", "license": "mit", "hash": 173129910433683420, "line_mean": 31.6461538462, "line_max": 83, "alpha_frac": 0.6866163996, "autogenerated": false, "ratio": 3.9737827715355807, "config_test": false,...
from django.utils import timezone from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.core.urlresolvers import reverse from django.db.models import F from .models import Question, Choice from polls.tasks import add, long_task, debug_ta...
{ "repo_name": "gnhuy91/django-tutorial-docker", "path": "apps/polls/views.py", "copies": "1", "size": "2098", "license": "mit", "hash": -5419093980463695000, "line_mean": 38.5849056604, "line_max": 104, "alpha_frac": 0.6873212583, "autogenerated": false, "ratio": 3.9214953271028037, "config_tes...
from django.utils import timezone from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.views import generic from django.contrib import messages from django.core.mail import send_mail from django.conf import settings ...
{ "repo_name": "alykhank/reserve", "path": "claim/views.py", "copies": "1", "size": "1916", "license": "mit", "hash": -6092968134644190000, "line_mean": 33.2142857143, "line_max": 204, "alpha_frac": 0.751565762, "autogenerated": false, "ratio": 3.446043165467626, "config_test": false, "has_no_...