code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cs_core', '0008_auto_20160619_2158'),
('cs_questions', '0008_delete_quizresponse'),
]
operations = [
migrations.CreateModel(
name='QuizRespon... |
"""
This file is part of Commix Project (http://commixproject.com).
Copyright (c) 2014-2017 Anastasios Stasinopoulos (@ancst).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the L... |
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x01\x12\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x0b\x00\x00\x00\x0d\x08\x06\x00\x00\x00\x7f\xf5\x94\x3b\
\x00\x00\x00\xd9\x49\x44\x41\x54\x28\x53\x7d\x90\x31\x0e\x45\x40\
\x10\x86\x47\x24\x24\x1a\x0d\x0d\xd1\x22\x51\x70\x8... |
import re
import sys
'''JSON to tsobj - converts old-style json_push_back formatters to new-style tsobj_add'''
re_push_back = re.compile('\s*json_push_back\(\s*(\w+)\s*,\s*json_new_([aibf])\(\s*"(\w+)"\s*,\s*(.*)\s*\)\)\s*;\s*')
tsobj_add = 'tsobj_add_%(typetag)s(%(node)s, TSOBJ_STR("%(field)s"), %(value)s);'
lines = [... |
"""
Forms specific to working directly with resources
"""
from __future__ import unicode_literals
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Div, Layout, Submit
from django import forms
from django.utils.translation import ugettext_lazy as _
from orb.models import Tag
from collections im... |
../../../../share/pyshared/aptdaemon/enums.py |
import re
import hashlib
import time
import logging
from decimal import Decimal
import datetime
import jsonschema
import json
import iso8601
import UserDict
import base64
class BadTokenFormatError(Exception):
pass
class Token(UserDict.DictMixin):
MIN_VALUE = Decimal("0.01")
MAX_VALUE = Decimal("999.99")
... |
"""User Interface."""
__author__ = 'Patrick Michl'
__email__ = 'frootlab@gmail.com'
__license__ = 'GPLv3'
__docformat__ = 'google'
import functools
import os
import sys
from nemoa.base import this
from nemoa.core import log
from nemoa.types import Any, AnyFunc, ExcType, Exc, Traceback, OptVoidFunc
_NOTIFICATION_TYPES =... |
from pandas import read_csv, concat, DataFrame, Series
from math import exp
from sklearn.externals import joblib
from sklearn import svm
probeList = ['A_23_P214627','A_23_P145863','A_23_P86682','A_23_P126593','A_23_P354387','A_23_P53126','A_23_P50498','A_23_P75430','A_23_P204847','A_23_P202672','A_24_P38276','A_32_P436... |
import sys
import argparse
VERSION = 'multimail 2.2.2'
DESCRIPTION = """
multimail - massive email sender
NAME: multimail
VERSION: 2.2.2
AUTHORS: Marco Chieppa (aka crap0101)
DATE: 2011-07-09
LICENSE: GNU GPL v3 or later
REQUIRES:
- Python >= 2.6
- argparse module (for python < 2.7)
OPTIONAL:
... |
"""
Primality testing
"""
_pseudos = set([
669094855201,
1052516956501, 2007193456621, 2744715551581, 9542968210729,
17699592963781, 19671510288601,
24983920772821, 24984938689453, 29661584268781, 37473222618541,
46856248255981, 47922612926653, 48103703944453, 491105... |
"""7. 10001st prime
https://projecteuler.net/problem=7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see
that the 6th prime is 13.
What is the 10 001st prime number?
""" |
from .ruliweb_spiders import RuliwebSpider
class RuliwebSpiderXBOX(RuliwebSpider):
name = 'xbox' |
from django import template
from django.conf import settings
register = template.Library()
@register.filter(name="add_class")
def add_class(value, arg):
return value.as_widget(attrs={"class": arg})
@register.filter(name="mix_name")
def mix_name(value, arg):
if value:
value = str(value)
return va... |
import cpu
import memory |
from __future__ import absolute_import, print_function
import sys
import os
from . import ext_tools
from . import catalog
from . import common_info
from numpy.core.multiarray import _get_ndarray_c_version
ndarray_api_version = '/* NDARRAY API VERSION %x */' % (_get_ndarray_c_version(),)
function_catalog = catalog.catal... |
_VEH_CELL_RESULTS_PUBLIC = ('health', 'credits', 'xp', 'achievementCredits', 'achievementXP', 'achievementFreeXP', 'shots', 'directHits', 'directTeamHits', 'explosionHits', 'piercings', 'damageDealt', 'sniperDamageDealt', 'damageAssistedRadio', 'damageAssistedTrack', 'damageReceived', 'damageBlockedByArmor', 'directHit... |
import json
import scipy.stats as sps
from dipde.internals.utilities import discretize_if_needed
def test_continuous_no_N():
discretize_if_needed(sps.norm(loc=2, scale=1.5))
def test_continuous_N():
discretize_if_needed((sps.norm(loc=2, scale=1.5),25))
def test_scalar():
discretize_if_needed(.02)
def test_d... |
"""
Test TorrentProvider
"""
import os
import unittest
from sickchill import settings
from sickchill.providers.GenericProvider import GenericProvider
from sickchill.providers.torrent.TorrentProvider import TorrentProvider
from .generic_provider_tests import GenericProviderTests
class TorrentProviderTests(GenericProvide... |
from hmpy.interface import Interface
__all__ = ["Interface"] |
import unittest
import inspect
import os
from lxml import etree
myfile = inspect.getfile(inspect.currentframe())
mydir = os.path.dirname(inspect.getfile(inspect.currentframe()))
os.environ['MACHINATION_BOOTSTRAP_DIR'] = mydir
from workers import dummyordered
class WorkerTestCase(unittest.TestCase):
def setUp(self):... |
import argparse
import os
from computer_vision_client import ComputerVisionClient
from emotion_client import EmotionClient
from face_client import FaceClient
if __name__ == '__main__':
face_client = FaceClient(key=os.environ['CS_FACE_API_KEY'])
emotion_client = EmotionClient(key=os.environ['CS_EMOTION_API_KEY']... |
"""Command line interface access
"""
import subprocess
def command(arg, p=False):
if p:
print(arg)
return subprocess.getoutput(arg) |
"""Common preprocessor passes."""
from deeplearning.clgen import errors
from deeplearning.clgen.preprocessors import public
from labm8.py import app
FLAGS = app.FLAGS
def _MinimumLineCount(text: str, min_line_count: int) -> str:
"""Private implementation of minimum number of lines.
Args:
text: The source to ver... |
from django.contrib.auth.models import User
from tastypie import fields
from tastypie.resources import ModelResource
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from .authentication import SessionAuthentication
from tastypie.authorization import Authorization
from tastypie.validation import FormValidation
fr... |
FILENAME = 'image.fits'
FILE_NB = 1
SHOW = True
CUDA = False
SKY_RANGE = [0.01, 0.99]
NBINS = 30
INTERACTIVE = True
NOBJ = 100
VAL_BND = None
NOWRITE = False
USE_MOMENTS = False
STARS = [(32,32)]
NPIX = 64
SKY_BACKGROUND = [0.]
SIGMA_SKY = [10.]
IMG_GAIN = 1.
S_FACT = 2.0
G_RES = 2.0
CENTER = 'SW'
MOF_INIT = None
MAX_I... |
"""
Converts SOLiD data to Sanger FASTQ format.
usage: %prog [options]
-i, --input1=i: Forward reads file
-q, --input2=q: Forward qual file
-I, --input3=I: Reverse reads file
-Q, --input4=Q: Reverse qual file
-o, --output1=o: Forward output
-r, --output2=r: Reverse output
usage: %prog forward_reads_fi... |
"""Tests for module ``robottelo.ssh``."""
import os
from robottelo import ssh
from robottelo.config import conf, get_app_root
from unittest2 import TestCase
class MockSSHClient(object):
"""A mock ``paramiko.SSHClient`` object."""
def __init__(self):
"""Set several debugging counters to 0.
Whenev... |
__author__= "Luis C. Pérez Tato (LCPT) and Ana Ortega (AOO)"
__copyright__= "Copyright 2015, LCPT and AOO"
__license__= "GPL"
__version__= "3.0"
__email__= "l.pereztato@gmail.com"
'''Cantilever under horizontal uniform load in local x direction.'''
import xc_base
import geom
import xc
from solution import predefined_so... |
"""Threading module, used to launch games while monitoring them."""
import os
import sys
import time
import shlex
import threading
import subprocess
import contextlib
from gi.repository import GLib
from textwrap import dedent
from lutris import settings
from lutris import runtime
from lutris.util.log import logger
from... |
"""
Poisson Tensor factorization for Multi-layer networks.
"""
import time
import sys
import numpy as np
from numpy.random import RandomState
import tools as tl
class MultiTensor :
def __init__(self,N=100,L=1,K=2, N_real=1,tolerance=0.1,decision=10,maxit=500,rseed=0,out_adjacency=False,inf=1e10,err_max=0.00001,err=0.1... |
"""Jsonification Functions for python-mssqlclient."""
import csv
import datetime
import json
import uuid
try:
from StringIO import StringIO
except ImportError: # pragma: nocover
from io import StringIO
def stringify(obj):
"""
Convert json non-serializable objects to string.
Currently converts `date... |
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.api import mail
from google.appengine.api import memcache
import models
import hashlib
import time
import random
import string
import server
import logging
import re
class Add(webapp.RequestHandler):
"""
Mapping: /... |
"""
Interface for Dynamips virtual Ethernet switch module ("ethsw").
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L558
"""
import asyncio
from gns3server.utils import parse_version
from .device import Device
from ..nios.nio_udp import NIOUDP
from ..dynamips_error import DynamipsError
from ...error impo... |
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 1
for i in range(len(nums)):
if nums.count(i+1):
continue
return i+1
return le... |
import logging
import time
from Queue import Queue, Empty
from collections import deque
from threading import Thread, Lock
from twisted.internet.defer import Deferred, TimeoutError
from twisted.python.failure import Failure
logger = logging.getLogger(__name__)
class QueueJob(object):
def __init__(self, method, *arg... |
"""probando URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
NAME="sortablecls"
VERSION="0.9.1" |
import pypyodbc
class Connection(object):
"""docstring for Connection"""
def __init__(self, sqlServer,BDname):
super(Connection, self).__init__()
self.cnxn = None
self.cursor=None
self.sqlServer=sqlServer
self.BDname=BDname
def get_cursor(self):
return self.cu... |
import rospy
from world_step.srv import step_world
class WorldStep(object):
""" Connect to the step_world service and handle stepping the physics simulation. """
def __init__(self):
# Wait for the StepWorld node to start.
rospy.wait_for_service('step_world')
self.step = rospy.ServiceProx... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('category', '0003_postcategory'),
]
operations = [
migrations.AlterField(
model_name='postcategory',
name='parent',
fi... |
import requests
from cloudbot import hook
from cloudbot.util import web
@hook.command("lmgtfy", "gfy")
def lmgtfy(text):
"""[phrase] - gets a lmgtfy.com link for the specified phrase"""
link = "http://lmgtfy.com/?q={}".format(requests.utils.quote(text))
return web.try_shorten(link)
@hook.command("lmbtfy", "... |
import urllib
import urllib2
import json
from Globals import *
class CouchPotato(object):
def __init__(self, base_url='http://localhost:5050', api_key='71e9ea6a3e16430389450eb88e93a8a1'):
self.apikey = api_key
self.baseurl = base_url
def __repr__(self):
return '[script.tvguide.CouchPotat... |
from django.shortcuts import get_object_or_404, render, redirect
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist
from .models import *
ARTICLES_PER_PAGE=10
def blog(request):
articles = Article.objects.order_by('-date_time') # -field means descending
hide_next = len(ar... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: aci_domain_to_vlan_pool
short_description: Bind Domain to VLAN... |
import tempfile
import stripe
from stripe.test.helper import StripeResourceTest
class FileUploadTest(StripeResourceTest):
def test_create_file_upload(self):
test_file = tempfile.TemporaryFile()
stripe.FileUpload.create(
purpose='dispute_evidence',
file=test_file
)
... |
import sys
from enum import Enum
from typing import *
from pros.common import logger
from .upgrade_manifest_v1 import UpgradeManifestV1
from ..instructions import UpgradeInstruction, UpgradeResult, NothingInstruction
class PlatformsV2(Enum):
Unknown = 0
Windows86 = 1
Windows64 = 2
MacOS = 3
Linux = ... |
from django.test import TestCase
from django.test import override_settings
from django_jinja.backend import Jinja2
from mock import patch
from nose.tools import eq_
from bedrock.base.templatetags import helpers
jinja_env = Jinja2.get_default()
SEND_TO_DEVICE_MESSAGE_SETS = {
'default': {
'sms_countries': ['... |
import bustimes.fields
import django.contrib.gis.db.models.fields
import django.contrib.postgres.fields.ranges
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
replaces = [('bustimes', '0001_initial'), ('bustimes', '0002_auto_20200930_1131'), ('bustime... |
import json
import sys
from os.path import dirname, join
from six.moves import cStringIO as StringIO
from mozlog import handlers, structuredlog
sys.path.insert(0, join(dirname(__file__), "..", ".."))
from formatters.chromium import ChromiumFormatter
def test_chromium_required_fields(capfd):
# Test that the test res... |
import copy
import json
import os
import asyncio
import pytest
import webdriver
from six import string_types
from six.moves.urllib.parse import urlunsplit
from tests.support import defaults
from tests.support.helpers import cleanup_session, deep_update
from tests.support.inline import build_inline
from tests.support.ht... |
# Copyright 2014-2017 The ODL contributors
"""Miscellaneous phantoms that do not fit in other categories."""
from __future__ import print_function, division, absolute_import
import numpy as np
import sys
__all__ = ('submarine', 'text')
def submarine(space, smooth=True, taper=20.0):
"""Return a 'submarine' phantom ... |
import time
from gettext import ngettext
import online
import game
import connection
from config import config
heartbeat_timeout = 5
def heartbeat():
# idle timeout
if config.idle_timeout:
now = time.time()
for u in online.online:
if (now - u.session.last_command_time > config.idle_t... |
from pts.core.basics.configuration import ConfigurationDefinition
definition = ConfigurationDefinition()
definition.add_optional("commands", "string_list", "commands to be run in interactive mode")
definition.add_flag("interactive", "use interactive mode", default=None)
definition.add_flag("show", "show stuff", True)
d... |
from weboob.tools.browser import BasePage
import urllib
__all__ = ['LoginPage']
class LoginPage(BasePage):
def on_loaded(self):
pass
def login(self, user, pwd):
post_data = {"credential" : str(user),
"pwd" : str(pwd),
"save_user": "false",
... |
from openerp.tools.translate import _
from openerp.osv import orm
class AccountStatementProfil(orm.Model):
_inherit = "account.statement.profile"
def _get_import_type_selection(self, cr, uid, context=None):
"""Inherited from parent to add parser."""
selection = super(AccountStatementProfil, self... |
from . import product_pricelist
from . import sale_order |
from django.core.exceptions import ValidationError
from django.test import TestCase
from squad.core.models import Group
class MetricThresholdTest(TestCase):
def setUp(self):
self.group = Group.objects.create(slug='mygroup')
self.project = self.group.projects.create(slug='myproject')
self.env... |
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.core.mail import EmailMessage
from django.utils.translation import ugettext_lazy as _
class ContactForm(forms.Form):
subject = forms.CharField(label=_("Subject"), max_length=100)
sender = forms.EmailFiel... |
"""
action-mail.py
Created by Thomas Mangin on 2009-01-10.
Copyright (c) 2008 Exa Networks. All rights reserved.
See LICENSE for details.
"""
from __future__ import with_statement
import os
import sys
try:
import psyco
psyco.full()
print 'Psyco found and enabled'
except ImportError:
print 'Psyco is not available'
f... |
from odoo import models, fields
class AccountMove(models.Model):
_inherit = "account.move"
print_payment_reference_in_invoices = fields.Boolean(
string="Print payment reference in invoices",
related='payment_mode_id.print_payment_reference_in_invoices') |
import os
import pdb
import re
import sys
import logging
import imaplib
import email
import shutil
import base64
from openerp.osv import fields, osv, expression, orm
from datetime import datetime, timedelta
from openerp.tools.translate import _
from openerp.tools import (
DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SER... |
from . import (
hr_contract_deduction,
hr_contract_register,
hr_contract_risk,
hr_contract,
hr_payslip_deduction_line,
hr_payslip
) |
"""
Functions for creating and restoring url-safe signed pickled objects.
The format used looks like this:
>>> dumps("hello", secret="secretkey")
'UydoZWxsbycKcDAKLg.F2uusAzJLBjUqmMog4Mr21QZIFk'
There are two components here, separatad by a '.'. The first component is a
URLsafe base64 encoded pickle of the object passe... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Optout.force_disabled'
db.add_column('bulk_email_optout', 'force_disabled',
self.gf('django.db.mo... |
from crm import model
from endpoints_proto_datastore.ndb import EndpointsModel
from google.appengine.api import search
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
from protorpc import messages
from crm import iomessages
from crm.endpoints_helper import EndpointsHel... |
from django import shortcuts
from quotes_app.models import Podcast, Episode
def navigation_autocomplete(request,
template_name='navigation_autocomplete/autocomplete.html'):
q = request.GET.get('q', '')
context = {'q' : q}
queries = {}
queries['nav_podcasts'] = Podcast.objects.filter(title__icontains... |
from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView, DeleteView
from catalog.views.base import GenericListView, GenericCreateView
from catalog.models import LaunchFacility
from catalog.forms import LaunchFacilityForm
from catalog.filters import LaunchFacilityFilter
from d... |
import operator
from . import BaseFilter
from PokeAlarm.Utilities import MonUtils
from PokeAlarm.Utilities.GruntUtils import get_grunt_id
class GruntFilter(BaseFilter):
""" Filter class for limiting which invasions trigger a notification. """
def __init__(self, mgr, name, data):
""" Initializes base par... |
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
company_share_product = fields.Boolean(
"Share product to all companies",
compute="_compute_share_product",
compute_sudo=True,
)
invoice_auto_validation = fields.Boolean(
help="When a... |
from .detail import ContactDetailView
from .edit import ContactEditView
from .list import ContactListView
from .mass_edit import ContactGroupMassEditView, ContactMassEditView
from .reset import ContactResetPasswordView
__all__ = [
"ContactListView",
"ContactDetailView",
"ContactResetPasswordView",
"Cont... |
from openerp.osv import fields, osv
import time
import datetime
from openerp import tools
from openerp.osv.orm import except_orm
from openerp.tools.translate import _
from dateutil.relativedelta import relativedelta
def str_to_datetime(strdate):
return datetime.datetime.strptime(strdate, tools.DEFAULT_SERVER_DATE_F... |
import httplib
import urlparse
from vidscraper.utils.mimetypes import is_accepted_type, is_accepted_filename
def is_video_url(url):
"""
If the URL represents a video file, this function returns True.
1) It checks the extension to see if it's in VIDEO_EXTENSIONS
2) It performs an HTTP HEAD request and ch... |
"""The main Pjuu entry point. This module initializes everything as well as
provide the create_app() function to build an instance of Pjuu.
:license: AGPL v3, see LICENSE for more details
:copyright: 2014-2021 Joe Doherty
"""
import os
from flask import Flask
from flask_mail import Mail
from flask_pymongo import PyMong... |
from openerp.tests.common import TransactionCase
class EventCase(TransactionCase):
def setUp(self, *args, **kwargs):
super(EventCase, self).setUp(*args, **kwargs)
# Partners
self.partner1 = self.env["res.partner"].create({"name": "Test Partner 1"})
self.partner2 = self.env["res.partn... |
import datetime
import json
import pickle
from uuid import uuid4
import tornado.web
from pylm.registry.handlers.manager import ConfigManager
from pylm.registry.handlers.persistency.db import DB
from pylm.registry.handlers.persistency.models import User, Cluster
class ClusterHandler(tornado.web.RequestHandler):
def ... |
{
'name': 'Timesheet on Issues',
'version': '1.0',
'category': 'Project Management',
'description': """
This module adds the Timesheet support for the Issues/Bugs Management in Project.
=================================================================================
Worklogs can be maintained to signif... |
from openerp import models, fields
class DjbcForm261(models.Model):
_name = "l10n_id.djbc_bc261"
_description = "Form 2.6.1 DJBC"
_inherits = {
"l10n_id.djbc_custom_document": "custom_document_id",
}
custom_document_id = fields.Many2one(
string="Custom Document",
comodel_name... |
'''
Description
from stderr output table from pgdriveneestimator.py, using "testmulti" or "testserial"
thatlists indices of individuals for each replicate, find for each indiv, the frequency
with which it is in the same replicate as the indiv whose index is provided as arg 2
'''
__filename__ = "get_freq_idx_paired_with... |
import unittest
import sys
import os
import shutil
import json
import tempfile
from datetime import date
from youtube import HttpError
from unittest.mock import patch
from unittest.mock import MagicMock
from unittest.mock import call
sys.path.append('.')
target = __import__("vallenato_fr")
website = __import__("website... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
import hashlib
from functools import partial
from datetime import datetime
from django.contrib.contenttypes.models import ContentType
from django.contrib.gis.db import models
from django.contrib.gis... |
from openerp import api, fields, models
import logging
_logger = logging.getLogger(__name__)
class AddressEventWizard(models.TransientModel):
_name = 'myo.address.event.wizard'
address_ids = fields.Many2many('myo.address', string='Addresses')
category_id = fields.Many2one('myo.event.category', string='Categ... |
from openerp import models, exceptions, _, modules
from openerp.tools import drop_view_if_exists
class AbstractSqlView(models.AbstractModel):
_name = 'sql.view.managed'
_auto = False
_current_module = ""
_sql_file_name = ""
_query_static_param = ()
def init(self, cr):
if self._name != 's... |
""" PackageTools - A set of tools to aid working with packages.
Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
Copyright (c) 2000-2011, eGenix.com Software GmbH; mailto:info@egenix.com
See the documentation for further information on copyrights,
or contact the author. All Rights Res... |
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
cr = env.cr
cr.execute("""
UPDATE calendar_event e
SET academic_year_id = (
SELECT school_year_id
FROM hr_employee_supervised_year t
WHERE t.id = e.super... |
import os
from unittest import TestCase
from unittest.mock import patch
from bs4 import BeautifulSoup
from RatS.plex.plex_ratings_parser import PlexRatingsParser
TESTDATA_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "assets")
)
class PlexRatingsParserTest(TestCase):
def ... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'ReconData.success_flag'
db.delete_column('recon_data', 'success_flag')
# D... |
"""
Module :mod:`openquake.hazardlib.mfd.evenly_discretized` defines an evenly
discretized MFD.
"""
from openquake.hazardlib.mfd.base import BaseMFD
class ArbitraryMFD(BaseMFD):
"""
An arbitrary MFD is defined as a list of tuples of magnitude values and
their corresponding rates
:param magnitudes:
... |
from django.views.generic import DetailView
from people.models import Person
class PersonFacebookAdsView(DetailView):
queryset = Person.objects.all().prefetch_related("facebookadvert_set")
pk_url_kwarg = "person_id"
template_name = "facebook_data/person_ads.html"
def get_context_data(self, **kwargs):
... |
"""
Administration interface of the LAVA Results application.
"""
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
from lava_results_app.models import (
ActionData,
BugLink,
Query,
TestCase,
TestSet,
TestSuite,
)
class ActionDataAdmin(admin.ModelAdmin):... |
from hint_class_helpers.find_matches import find_matches
class Prob6_Part11:
"""
Author: Shen Ting Ang
Date: 11/7/2016
"""
def check_attempt(self, params):
self.attempt = params['attempt'] #student's attempt
self.answer = params['answer'] #solution
self.att_tree = params['att... |
from itertools import combinations
from ..node import ExpressionNode as N, ExpressionLeaf as L, Scope, \
OP_MUL, OP_DIV, OP_POW, OP_ADD, OP_SQRT, negate
from ..possibilities import Possibility as P, MESSAGES
from ..translate import _
def match_add_exponents(node):
"""
a^p * a^q -> a^(p + q)... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'UserProject.permission'
db.alter_column(u'user_project', 'permission', self.gf('django.db.models.fields.IntegerField'... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0021_auto_20161205_2015'),
]
operations = [
migrations.AddField(
model_name='projectlink',
name='type',
field... |
import datetime
from itertools import groupby
import warnings
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import connections
from django.db.models import Max
from django.http import Http404
from django.utils.timezone import make_aware, utc
from rest_framework im... |
from __future__ import absolute_import, division, print_function
from ..basics.mask import Mask
class GalaxyList(object):
"""
This class ...
"""
def __init__(self):
"""
This function ...
"""
self.principal = None
self.companions = []
self.other = []
# ... |
import datetime
import os
JWT_IDENTITY_CLAIM = 'sub'
JWT_ACCESS_TOKEN_EXPIRES = datetime.timedelta(days=30)
JWT_SECRET_KEY = os.environ['JWT_SECRET_KEY']
SQLALCHEMY_TRACK_MODIFICATIONS = False
ERROR_404_HELP = False |
from optparse import make_option
from django.core.management.base import BaseCommand
import django_rq
class Command(BaseCommand):
help = u'List upcoming scheduled tasks'
def handle(self, **options):
scheduler = django_rq.get_scheduler('default')
print 'scheduled tasks:'
for job, dt in sc... |
"""TOSEC API views"""
from rest_framework import generics, filters
from tosec.models import Category, Game
from tosec.serializers import CategorySerializer, GameSerializer
class CategoryListView(generics.ListAPIView):
serializer_class = CategorySerializer
queryset = Category.objects.all()
filter_backends = ... |
import factory
from base.models.enums.groups import FACULTY_MANAGER_GROUP, CENTRAL_MANAGER_GROUP, UE_FACULTY_MANAGER_GROUP, \
CATALOG_VIEWER_GROUP, ENTITY_MANAGER_GROUP, PROGRAM_MANAGER_GROUP, TUTOR
class GroupFactory(factory.django.DjangoModelFactory):
class Meta:
model = 'auth.Group'
django_ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.