content stringlengths 4 20k |
|---|
"""
Admin views for managing volumes.
"""
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon import exceptions
from horizon import forms
from horizon.utils import memoized
... |
import datetime
import decimal
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.utils import timezone
from djstripe.models impor... |
import unittest
import logging
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class ChromeLauncherTests (unittest.TestCase):
def testLaunchAndCloseBrowser(self):
self.webdriver = webdriver.Chrome()
self.webdriver.quit()
def test_... |
import os
from fnmatch import fnmatch
import readline
from polysh.host_syntax import expand_syntax
from polysh.console import console_output
from polysh import dispatchers
from polysh import remote_dispatcher
def toggle_shells(command, enable):
"""Enable or disable the specified shells. If the command would have
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.executor.task_executor import TaskExecutor
from ansible.play... |
#!/usr/bin/env python
"""
Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile
Read the given picklefile as a series of key/value pairs and write to a new
database. If the database already exists, any contents are deleted. The
optional flags indicate the type of the output database:
-a - open ... |
from __future__ import division, print_function, absolute_import
import os
import numpy as np
from numpy.testing import (assert_equal, assert_allclose, assert_,
TestCase, assert_raises, run_module_suite, assert_almost_equal,
assert_raises, assert_array_almost_equal)
from numpy import array, asarray, pi, sin, ... |
"""
Utility functions for validating forms
"""
from django import forms
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from django.contrib.auth.forms import PasswordResetForm
from django.contrib.auth.hashers import UNUSABLE_PASSWORD
from django.contrib.auth.tokens import ... |
"""
AmCAT-specific adaptations to rest_framework filters
(using django_filters)
activated by settings.REST_FRAMEWORK['FILTER_BACKEND']
"""
from api.rest import count
from rest_framework import filters
from django_filters import filterset
from django_filters.filters import Filter
from django_filters.filters import Numb... |
from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from pkg_resources.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from pkg_resources.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from pkg_resources.e... |
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if hasattr(d, "iteritems") else d.items()
class FeatureHasher(BaseEstim... |
"""
This is the GUI for the Curve Animation
"""
import wx
from direct.interval.IntervalGlobal import *
from direct.actor.Actor import *
from . import ObjectGlobals as OG
class CurveAnimUI(wx.Dialog):
"""
This is the Curve Animation Panel implementation.
"""
def __init__(self, parent, editor):
... |
from .entity_health_state import EntityHealthState
class PartitionHealthState(EntityHealthState):
"""Represents the health state of a partition, which contains the partition
identifier and its aggregated health state.
:param aggregated_health_state: The health state of a Service Fabric
entity such a... |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.cor... |
"""log model admin."""
from django.contrib import admin
from django.db import models
from django.forms.widgets import TextInput
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.log_mgr.models import MakahikiLog
from apps.admin.admin import challenge_designer_site, challenge_manager_site, develop... |
"""
Tests for defer() and only().
"""
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Secondary(models.Model):
first = models.CharField(max_length=50)
second = models.CharField(max_length=50)
@python_2_unicode_compatible
class Primary(models.Model):
name... |
import pandas as pd
import matchup
import xlsxwriter
import xlautofit
import xlrd
import sys
import time
import collections
import os
week_timer = time.time()
week_number = 'conf_matrix'
matchups = collections.OrderedDict()
matchups['Matchups'] = [('NE', 'IND'),
('NE', 'SEA'),
... |
#!/usr/bin/env python3
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
"""
Represent tells the computer how this class should look when printed
:return: The printing of this class depends on the dat... |
from openerp.osv import osv
class stock_move(osv.Model):
_inherit = "stock.move"
def _get_invoice_line_vals(self, cr, uid, move, partner, inv_type, context=None):
""" Add a reference to the stock.move in the invoice line
In anglo-saxon the price for COGS should be taken from stock.move
... |
# -*- coding: utf-8 -*-
import datetime
import hashlib
import logging
import os
import re
import traceback
import werkzeug
import werkzeug.routing
import werkzeug.utils
import openerp
from openerp.addons.base import ir
from openerp.addons.base.ir import ir_qweb
from openerp.addons.website.models.website import slug, ... |
"""
GDAL - Constant definitions
"""
from ctypes import (
c_double, c_float, c_int16, c_int32, c_ubyte, c_uint16, c_uint32,
)
# See http://www.gdal.org/gdal_8h.html#a22e22ce0a55036a96f652765793fb7a4
GDAL_PIXEL_TYPES = {
0: 'GDT_Unknown', # Unknown or unspecified type
1: 'GDT_Byte', # Eight bit unsigned in... |
"""
VPS.net driver
"""
import base64
try:
import simplejson as json
except ImportError:
import json
from libcloud.utils.py3 import b
from libcloud.common.base import ConnectionUserAndKey, JsonResponse
from libcloud.common.types import InvalidCredsError, MalformedResponseError
from libcloud.compute.providers ... |
import posixpath
from itertools import groupby
from operator import attrgetter
from flask import render_template, request, session
from sqlalchemy.orm import joinedload
from indico.core import signals
from indico.modules.events.layout import theme_settings
from indico.modules.events.management.views import WPEventMan... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six... |
import project_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
'''
Dummy Socks5 server for testing.
'''
from __future__ import print_function, division, unicode_literals
import socket, threading, Queue
import traceback, sys
### Protocol constants
class Command:
CONNECT = 0x01
class AddressType:
IPV4 = 0x01
DOMAINNAME = 0x03
IPV6 = 0x04
### Utility functions
def ... |
"""Functional tests for scan ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.compiler.tests import xla_test
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import errors_impl
f... |
"""
>>> from m1 import *
>>> from m2 import *
Prove that we get an appropriate error from trying to return a type
for which we have no registered to_python converter
>>> def check_unregistered(f, msgprefix):
... try:
... f(1)
... except TypeError, x:
... if not str(x).startswith(msgp... |
from unittest import TestCase, main
import numpy.testing as npt
from qiita_core.util import qiita_test_checker
from qiita_core.qiita_settings import qiita_config
import qiita_db as qdb
@qiita_test_checker()
class TestPortal(TestCase):
def setUp(self):
self.portal = qiita_config.portal
self.study... |
"""
FILE: sample_create_client_async.py
DESCRIPTION:
These samples demonstrate creating a ContainerRegistryClient and a ContainerRepository
USAGE:
python sample_create_client_async.py
Set the environment variables with your own values before running the sample:
1) AZURE_CONTAINERREGISTRY_URL - The UR... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requirements here... |
import time
from datetime import datetime
from openerp.report import report_sxw
from openerp.osv import osv
class exam_student_lable_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(exam_student_lable_report, self).__init__(cr, uid, name, context=context)
self.lo... |
import socket
import re
from urlparse import urlparse, urlunparse
# common module imports
from spacewalk.common.rhnConfig import CFG
from spacewalk.common.rhnLog import log_debug, log_error
from spacewalk.common.rhnTB import Traceback
from spacewalk.common import rhnFlags, rhnLib, apache
# local module imports
from p... |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.utils import quote
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugettext, ugett... |
import yaml
def _compare_events(events1, events2):
assert len(events1) == len(events2), (events1, events2)
for event1, event2 in zip(events1, events2):
assert event1.__class__ == event2.__class__, (event1, event2)
if isinstance(event1, yaml.NodeEvent):
assert event1.anchor == event2... |
#!/usr/bin/env python
"""
cmaling::
[mm] thf cmalign RF01831.cm 4lvv.seq
# STOCKHOLM 1.0
#=GF AU Infernal 1.1.2
4lvv -GGAGAGUA-GAUGAUUCGCGUUAAGUGUGUGUGA-AUGGGAUGUCG-UCACACAACGAAGC---GAGA---GCGCGGUGAAUCAUU-GCAUCCGCUCCA
#=GR 4lvv PP .********.******************9999998.***********.8999999***... |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
from test.test_support import run_unittest, TESTFN, EnvironmentVarGuard
from test.test_support import captured_output
import __builtin__
import os
import sys
import re
im... |
import datetime
import unittest
from airflow import DAG, configuration
from airflow.contrib.operators.spark_sql_operator import SparkSqlOperator
DEFAULT_DATE = datetime.datetime(2017, 1, 1)
class TestSparkSqlOperator(unittest.TestCase):
_config = {
'sql': 'SELECT 22',
'conn_id': 'spark_special_... |
# -*- coding: utf-8 -*-
# TODO 多进程 有木桶最短效应。但是目前没法解决变量共享。
import json
import math
import time
from ..utils import *
from ..core import DetDupCore
class DetDupTask(object):
default_attrs = [
"process_count",
"cache_dir",
"original_model",
"items_model",
... |
# This test requires Numpy.
import sys
import vtk
from vtk.test import Testing
try:
import numpy as np
except ImportError:
print("WARNING: This test requires Numeric Python: http://numpy.sf.net")
sys.exit(0)
def GenerateCell(cellType, points):
cell = vtk.vtkUnstructuredGrid()
pts = vtk.vtkPoints()... |
import json
import time
import logging
import signal
import redis
from celery.result import AsyncResult
from celery.utils.log import get_task_logger
from redash import redis_connection, models, statsd_client, settings, utils
from redash.utils import gen_query_hash
from redash.worker import celery
from redash.query_runn... |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, getConfigListEntry
from Components.Sources.StaticText import StaticText
class HdmiCECSetupScreen(Screen, ConfigListScreen):
skin = """
<screen position="c-300,c-250" size="600,500" title="HDMI C... |
"""
This module is a SOAP client using twisted's deferreds.
It uses the SOAPpy package.
@author: Raphael Slinckx
@copyright: Copyright 2005
@license: LGPL
@contact: U{<EMAIL><mailto:<EMAIL>>}
@version: 0.1.0
"""
__revision__ = "$id"
import SOAPpy, logging
from SOAPpy.Config import Config
from twisted.web import clie... |
from django.db import models
from contacts.models import Contact
from phone_numbers.models import PhoneNumber
class SmsMessage(models.Model):
date_created = models.DateTimeField(auto_now_add=True, db_index=True)
date_modified = models.DateTimeField(auto_now=True)
deleted = models.BooleanField(default=Fal... |
"""Proto match tests between `tensorboard.compat.proto` and TensorFlow.
These tests verify that the local copy of TensorFlow protos are the same
as those available directly from TensorFlow. Local protos are used to
build `tensorboard-notf` without a TensorFlow dependency.
"""
import difflib
import importlib
import ... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as manimation
from scipy.stats import gaussian_kde
from pprint import pprint
import sys
import os
from astropy.io import ascii
from astropy.table import vstack
# chainfile = "/Users/zequnl/Installs/montepython_public/chains/example/2016-10... |
from init_instantiation_data import *
include_files = ['basis_functions/bspline_space.h',
'basis_functions/nurbs_space.h',
'geometry/push_forward.h',
'geometry/cartesian_grid_element_accessor.h',
'geometry/mapping_element_accessor.h',
... |
{
'name': 'Account Banking - Payments Transfer Account',
'version': '0.2',
'license': 'AGPL-3',
'author': "Banking addons community,Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/banking',
'category': 'Banking addons',
'post_init_hook': 'set_date_sent',
'depends': ... |
from .base import TestCase
import os
import mock
import shutil
import time
from django.conf import settings
import whisper
import gzip
from graphite.readers import WhisperReader, GzippedWhisperReader
from graphite.wsgi import application # NOQA makes sure we have a working WSGI app
class WhisperReadersTests(Test... |
import time
from openerp.osv import fields, osv
class account_analytic_balance(osv.osv_memory):
_name = 'account.analytic.balance'
_description = 'Account Analytic Balance'
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=... |
from __future__ import unicode_literals
from django.conf import settings
from django.shortcuts import render
from shuup.core.error_handling import ErrorPageHandler
class AdminPageErrorHandler(ErrorPageHandler):
"""
Page Error handler for Shuup Admin
"""
@classmethod
def can_handle_error(cls, re... |
#!/usr/bin/env python
import sys, os, markdown, re
from BeautifulSoup import BeautifulSoup
def _split_lines(s):
return re.findall(r'([^\n]*\n?)', s)
class Writer:
def __init__(self):
self.started = False
self.indent = 0
self.last_wrote = '\n'
def _write(self, s):
if s... |
import superdesk
from superdesk.publish.formatters.nitf_formatter import NITFFormatter
from superdesk.errors import FormatterError
from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, SIGN_OFF
from lxml import etree as etree
from lxml.etree import SubElement
import re
from .unicodetoascii import to_ascii
from s... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'GroupedMessage', fields ['checksum', 'logger', 'view']
db.delete_unique('sentry_g... |
"""Tests for tensorflow.python.framework.importer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import random
from tensorflow.core.util import test_log_pb2
from tensorflow.python.client import session
from tensorflow.python.frame... |
import os
import tempfile
import unittest
from collections import OrderedDict
from coalib.parsing.ConfParser import ConfParser
from coalib.settings.Section import Section
class ConfParserTest(unittest.TestCase):
example_file = """to be ignored
a_default, another = val
TEST = tobeignored # do you know th... |
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveBarrierAPI(TestDistBase):
def _setup_config(self):
pass
def test_barrier_nccl(self):
self.check_with_place("col... |
"""
This test script is intended to give a block-level based overview of
SSD performance.
"""
import os
from avocado import Test
from avocado.utils import build
from avocado.utils import process
from avocado.utils import genio
from avocado.utils.software_manager import SoftwareManager
import avocado.utils.git as git
... |
from Interactors.GameInteractors import CountGamesInteractor
from Interactors.Interactor import Interactor
from Tests.Interactors.InteractorTestBase import InteractorTestBase
class TestCountGamesInteractor(InteractorTestBase):
"""Unit tests for the CountGamesInteractor class"""
def setUp(self):
"""se... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import glob
import os
import re
import time
from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.module_utils._text import to_text
from ansible.plugins.action.sros import ActionModule as _ActionModule
from... |
import serial
import struct
import time
import random
import sys
import shimmerUtil
# Find the data serial port
# this needs to find the real serial port
port = shimmerUtil.find_data_port(True)
if port == '':
print 'Could not find SHIMMER data port port. Exiting.'
sys.exit()
speed = 115200
print 'Found SHIM... |
# -*- coding: utf-8 -*-
""" Commerce app tests package. """
import json
from django.test import TestCase
from django.test.utils import override_settings
import httpretty
import jwt
import mock
from commerce import ecommerce_api_client
from student.tests.factories import UserFactory
TEST_PUBLIC_URL_ROOT = 'http://ww... |
"""Viewfinder base operation.
ViewfinderOperation is the base class for all other Viewfinder operations. It contains code
that is common across at least two derived operations.
"""
__authors__ = ['<EMAIL> (Andy Kimball)']
from copy import deepcopy
from tornado import gen
from viewfinder.backend.base.exceptions impor... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 19 11:10:52 2017
@author: e
"""
import numpy as np
from BetaGammaC import NP_Energy2BetaC_GammaC
def GammaT(alphaT,betaT):
gammaT=(1.+alphaT**2)/betaT
return gammaT
def SigmaT2D(alphaT,betaT):
gammaT=GammaT(alphaT,betaT)
sigmaT=np.... |
"""Base class with common routines between the Apache and Lighttpd servers."""
import logging
import os
import time
import urllib
from webkitpy.common.system import filesystem
_log = logging.getLogger("webkitpy.layout_tests.port.http_server_base")
class HttpServerBase(object):
def __init__(self, port_obj):
... |
from spack import *
class PyDeeptools(PythonPackage):
"""deepTools addresses the challenge of handling the large amounts of data
that are now routinely generated from DNA sequencing centers."""
homepage = "https://pypi.io/packages/source/d/deepTools"
url = "https://pypi.io/packages/source/d/d... |
{
'name': 'Leave Management',
'version': '1.5',
'author': 'OpenERP SA',
'category': 'Human Resources',
'sequence': 27,
'summary': 'Holidays, Allocation and Leave Requests',
'website': 'http://www.openerp.com',
'description': """
Manage leaves and allocation requests
=====================... |
import project_gtd_empty
import project_gtd_fill
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from collections import defaultdict
def autodict():
return defaultdict(autodict)
flag_fields = autodict()
symbolic_fields = autodict()
def define_flag_field(event_name, field_name, delim):
flag_fields[event_name][field_name]['delim'] = delim
def define_flag_value(event_name, field_name, value, field_str):
... |
import logging
import operator
import pkg_resources
import re
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.formatter import deep_format
logger = logging.getLogger(__name__)
class ModuleRegistry(object):
entry_points_cache = {}
def __init__(self, config, plugins_list=None):
... |
"""
Test the user course tag API.
"""
from django.test import TestCase
from student.tests.factories import UserFactory
from openedx.core.djangoapps.user_api.course_tag import api as course_tag_api
from opaque_keys.edx.locations import SlashSeparatedCourseKey
class TestCourseTagAPI(TestCase):
"""
Test the use... |
import sys
import tempfile
import os
import zipfile
import datetime
import time
import subprocess
import pkg_resources
try:
unicode
except NameError:
unicode = str
def timestamp(dt):
"""
Return a timestamp for a local, naive datetime instance.
"""
try:
return dt.timestamp()
except... |
class Cartridge:
def __init__(self):
self.banks = {}
self.bank_id = 0
self.pc = 0
self.inespgr = 1
self.ineschr = 1
self.inesmap = 1
self.inesmir = 1
self.rs = 0
self.path = ''
def nes_id(self):
# NES
return [0x4e, 0x45, 0... |
# -*- encoding: utf-8 -*-
'''
import pilas
try:
import opencv
from opencv import highgui
except ImportError:
opencv = None
import os
try:
from PySFML import sf
except ImportError:
pass
class MissingOpencv(Exception):
def __init__(self):
self.value = "Open CV no esta instalado, obteng... |
# coding=utf-8
import os
import shutil
import sys
import pytest
from httpie.plugins.builtin import HTTPBasicAuth
from utils import TestEnvironment, mk_config_dir, http, HTTP_OK, \
no_content_type
from fixtures import UNICODE
class SessionTestBase(object):
def start_session(self, httpbin):
"""Create... |
"""
Testing for the gradient boosting loss functions and initial estimators.
"""
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn.utils import check_random_state
from ... |
from rest_framework import generics
from rest_framework import permissions as drf_permissions
from rest_framework.exceptions import NotAuthenticated
from django.contrib.auth.models import AnonymousUser
from modularodm import Q
from framework.auth.core import Auth
from framework.auth.oauth_scopes import CoreScopes
fr... |
"""Functions for finding node and edge dominating sets.
A *`dominating set`_[1] for an undirected graph *G* with vertex set *V*
and edge set *E* is a subset *D* of *V* such that every vertex not in
*D* is adjacent to at least one member of *D*. An *`edge dominating
set`_[2] is a subset *F* of *E* such that every edge ... |
import datetime
import numpy as np
from backtest import Backtest
from data import HistoricCSVDataHandler
from event import SignalEvent
from execution import SimulatedExecutionHandler
from portfolio import Portfolio
from strategy import Strategy
class MovingAverageCrossStrategy(Strategy):
"""
Carries out a ba... |
"""
Unit Tests for nova.scheduler.rpcapi
"""
from oslo.config import cfg
from nova import context
from nova.openstack.common import rpc
from nova.scheduler import rpcapi as scheduler_rpcapi
from nova import test
CONF = cfg.CONF
class SchedulerRpcAPITestCase(test.NoDBTestCase):
def _test_scheduler_api(self, met... |
from boto.swf.exceptions import SWFResponseError
from freezegun import freeze_time
from moto import mock_swf_deprecated
from moto.swf import swf_backend
from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
# PollForActivityTask endpoint
@mock_swf_deprecated
def test_poll_for_activity_task_when_one():... |
from .base import base
class openerp_standard(base):
'''No search at all. Use OpenERP's standard mechanism to attach mails to
mail.thread objects. Note that this algorithm always matches.'''
name = 'Odoo standard'
readonly_fields = [
'model_field',
'mail_field',
'match_first',... |
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
sanitized_Request,
)
class AzubuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?azubu\.(?:tv|uol.com.br)/[^/]+#!/play/(?P<id>\d+)'
_TESTS = [
{
... |
from api.models.user import User
from api.models.commodity import Commodity
from api.models.contribution import Contribution
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for user model
"""
uuid = serializers.UUIDField(read_only=True, format='hex'... |
import unittest
from promopuffincore import main, accounts, campaigns, codes
import test_data
import json
class PromoPuffinCoreTestCase(unittest.TestCase):
def setUp(self):
# db_conf = {
# 'name': '',
# 'engine': 'SqliteDatabase',
# 'check_same_thread': False,
#... |
import json
import unittest
from student.tests.factories import UserFactory, RegistrationFactory, PendingEmailChangeFactory
from student.views import (
reactivation_email_for_user, do_email_change_request, confirm_email_change,
validate_new_email, SETTING_CHANGE_INITIATED
)
from student.models import UserProfi... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.creden... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
class GtkDemoTest(unittest.TestCase):
"""
TestCase subclass which handles bringing up and shutting down gtk3-demo as a fixture. Used for writing other test
cases.
"""
def se... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TaskUsage'
db.create_table(u'projects_taskusage', (
(u'id', self.gf('django.db.m... |
#!/usr/bin/python
import unittest
try:
import autotest.common as common
except ImportError:
import common
from kernelexpand import decompose_kernel
from kernelexpand import mirror_kernel_components
from autotest.client.shared.settings import settings
from autotest.client.shared.test_utils import mock
km = 'ht... |
"""
Functions to allow *Functional* Reactive Programming. Each of these
functions produces a new signal.
"""
import sys
from .signals import Signal
from .signals import undefined
def merge(*signals):
""" Merge all signal values into a tuple.
"""
frame = sys._getframe(1)
def _merge(*values):
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: fail
short_description: Fail with custom message
descript... |
"""The main statusbar widget."""
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt, QSize, QTimer
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy
from qutebrowser.browser import browsertab
from qutebrowser.config import config, style
from qutebrowser.utils import usertypes,... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.dellos6 import dellos6_config
from units.modules.utils import set_module_args
from .dellos6_module import TestDellos6Module, load_fixture
class TestDellos6ConfigMod... |
from __future__ import absolute_import
import mimetypes
import os.path
import random
import re
import string
from django.conf import settings
from django.core.files.storage import default_storage
from django.template.defaultfilters import slugify
from django.utils.encoding import force_text
# Non-image file icons, m... |
"""
I hold resource classes and helper classes that deal with CGI scripts.
"""
# System Imports
import string
import os
import urllib
# Twisted Imports
from twisted.web import http
from twisted.internet import reactor, protocol
from twisted.spread import pb
from twisted.python import log, filepath
from twisted.web im... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import docopt
import itertools
import logging
import os
import re
import requests
import sys
import time
import urllib
version = '0.1'
__doc__ = """
ddo.py {version} --- look up words in Den Danske Ordbog
A command-line interface for lookin... |
import hashlib
import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.log import getLogger
logger = getLogger('django.request')
class CommonMiddleware(object):
"""... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './acq4/analysis/modules/MapImager/MapConvolverTemplate.ui'
#
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
exce... |
import argparse
from app.environment import Environment
import app.apis.twitter as twitter
import app.apis.file_api as file_api
import app.apis.kintone as kintone
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Data Extractor for Watson Disaster App")
keyword, locations = Environment.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.