content stringlengths 4 20k |
|---|
# 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):
# Adding model 'DomainSignature'
db.create_table('domain_signatures', (
('id', self.gf('django... |
# encoding: utf-8
import sys
import unittest
import twitter
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
import responses
class ErrNull(object):
""" Suppress output of tests while writing to stdout or stderr. This just
takes in data and does nothing with it.
"""
... |
#!/usr/bin/env python
"""Base class for protocols flavor.
Each set of protocols has a flavor object. The current one is dynamically
imported once.
"""
class ProtocolsFlavor(object):
"""Base class for protocols flavor."""
def binlog_player_protocol(self):
"""The binlog player protocol between vttablets, in g... |
from __future__ import unicode_literals
import datetime
from builtins import object
from medusa import app, ws
MESSAGE = 'notice'
ERROR = 'error'
class Notifications(object):
"""A queue of Notification objects."""
def __init__(self):
self._messages = []
self._errors = []
def message(s... |
""" Bokeh comes with a number of interactive tools.
There are five types of tool interactions:
.. hlist::
:columns: 5
* Pan/Drag
* Click/Tap
* Scroll/Pinch
* Actions
* Inspectors
For the first three comprise the category of gesture tools, and only
one tool for each gesture can be active at a... |
from midonetclient.resource_base import ResourceBase
from midonetclient.rule import Rule
from midonetclient import vendor_media_type
class Chain(ResourceBase):
media_type = vendor_media_type.APPLICATION_CHAIN_JSON
def __init__(self, uri, dto, auth):
super(Chain, self).__init__(uri, dto, auth)
d... |
import wizard_generate_edifact |
from wtforms.fields import SelectMultipleField as BaseSelectField
from wtforms.validators import ValidationError
from wtforms.widgets import HTMLString, html_params
from wtforms.widgets import Select as BaseSelectWidget
# __all__ = ('SelectField', 'SelectWidget')
class SelectWidget(BaseSelectWidget):
"""
Ad... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
import resources_rc
import os.path, sys
# Set up current path, so that we know where to look for mudules
currentPath = os.path.dirname(__file__)
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/tools'))
# Multi-function modules
im... |
"""
Class for Tilera bare-metal nodes.
"""
import base64
import os
import jinja2
from oslo.config import cfg
from nova.compute import instance_types
from ironic.common import exception
from ironic.common import utils
from ironic.common import states
from ironic import db
from ironic.manager import base
from ironic.o... |
from __future__ import unicode_literals
from __future__ import absolute_import
import logging
from flask import Flask
from pypuppetdb import connect
from puppetboard.utils import (jsonprint, prettyprint, url_for_field,
url_static_offline, get_or_abort)
from . import __version__
APP =... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
# imports
from flask import request
from flask import render_template
from flask import Blueprint
from flask import redirect
from flask import url_for
from project import db
from project.models import Organization
from .forms import OrganizationForm
# config
organizations_blueprint = Blueprint(
'organizations',... |
import logging
from time import time
import hmac
import hashlib
import urllib
import json
class ZimbraRetriever:
"""
Retrieves an Addressbook from Zimbra
"""
config = None
""" Retriever configuration """
addressbook = None
""" Retrieved Addressbook """
def __init__(self, config):
... |
import os
from . import common
def mkdirs_p(*dirnames):
for dirname in dirnames:
if not os.path.exists(dirname):
os.makedirs(dirname)
def create_containing_dir_if_necessary(filename):
dirname = os.path.dirname(filename)
mkdirs_p(dirname)
class EasyOpen:
def __init__(self, file... |
"""
Various utilities and helper functions.
"""
import numbers
import numpy as np
def get_prng(seed=None):
"""Turn seed into a np.random.RandomState instance
Parameters
----------
seed : {None, int, RandomState}
If seed is None, return the RandomState singleton used by np.random.
If... |
import itertools
from collections import defaultdict
import bmesh
import bpy
from bpy.props import (BoolProperty, FloatProperty, IntProperty)
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, fullList_np, numpy_full_list
from sverchok.utils.sv_obj_helper import SvObjH... |
from __future__ import absolute_import, print_function
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import couchdb
import json
import jsonpickle
import sys,os
consumer_key="hVExlxALeBFp9CSLP5KfRMyhr"
consumer_secret="sRmuFRKdYUDJgteteXvDDE5LlpzgtGXY9bwuisZV4usv9... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import defaultdict
from random import randint
'''
Simple sequential mapreduce emulator. The main function is mapreduce(), that generates a function that emulates the
execution of a MapReduce computtion using the map, reduce and combine functions provided. ... |
try:
from . import generic as g
except BaseException:
import generic as g
from trimesh.viewer.trackball import Trackball
class TrackballTest(g.unittest.TestCase):
def test_resize(self):
trackball = Trackball(
pose=g.np.eye(4),
size=(640, 480),
scale=1.0,
... |
#! /usr/bin/env python
# encoding: utf-8
import os,sys,re
import Options,TaskGen,Task,Utils
from TaskGen import taskgen,feature,after
class msgfmt_taskgen(TaskGen.task_gen):
def __init__(self,*k,**kw):
TaskGen.task_gen.__init__(self,*k,**kw)
def init_msgfmt(self):
self.default_install_path='${KDE4_LOCALE_INSTALL_D... |
import os
from distutils.core import setup
from pyngdom import __version__
try:
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
long_description = f.read()
f.close()
except:
long_description = ''
setup(
name='pyngdom',
version=__version__,
packages=['pyngdom'],
author=... |
#coding=utf-8
from PIL import Image
import ImageGrab
import os
import hashlib
import time
import pickle
import win32gui
import win32con
import win32api
# class autoAnswer():
getbrow = win32gui.FindWindow('Chrome_WidgetWin_1',u'立秋·驾培-闯关王 - Google Chrome') ##定义窗口
win32gui.ShowWindow(getbrow,w... |
import copy
from oslo_serialization import jsonutils
from nova.api.openstack import api_version_request as avr
from nova.api.openstack.compute import views
from nova.api import wsgi
from nova import test
from nova.tests.unit.api.openstack import fakes
from nova.tests.unit import matchers
from nova.tests import uuidse... |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 License, or
(at your option) any ... |
import os
import socket
from email.utils import formatdate
from mimetypes import guess_type
def run_server(root_dir):
# Socket set-up
server_socket = socket.socket(
socket.AF_INET,
socket.SOCK_STREAM,
socket.IPPROTO_IP
)
try:
address = ('127.0.0.1', 50000)
s... |
#!/usr/bin/python
import sys, os
import idtranslate
import lxml.etree as ET
# This script requires two arguments: an "unlinked" XCCDF file and an ID name scheme.
# This script is designed to convert and synchronize check IDs referenced from
# the XCCDF document for the supported checksystems, which are currently OVAL... |
def lcs(lista: str, listb:list, i:int, j:int):
if i < 0 or j < 0:
return 0
else:
if lista[i] == listb[j]:
return lcs(lista, listb, i-1, j-1) + 1
else:
return max(lcs(lista, listb, i-1, j), lcs(lista, listb, i, j-1))
class Memo():
def __init__(self):
... |
from __future__ import absolute_import
from mock import patch
from sentry.models import IdentityProvider, Identity, Integration, OrganizationIntegration
from sentry.testutils import IntegrationTestCase
from sentry.integrations.example import ExampleIntegrationProvider, AliasedIntegrationProvider
from sentry.models im... |
# -*- coding: utf-8 -*-
"""
Script is responsible for scraping data from website and save data in redis.
"""
import re
import redis
import urllib2
import settings
from bs4 import BeautifulSoup
from datetime import datetime
WEBSITE = 'http://www.x-kom.pl'
FORMAT_DATETIME = '%Y-%m-%d %H:%M:%S.%f'
REDIS_SERVER =... |
'''
Copyleft Apr 05, 2017 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: <EMAIL>
'''
import numpy as np;
np.set_printoptions(linewidth=200, precision=5, suppress=True)
import pandas as pd;
pd.options.display.max_rows = 20;
pd.options.display.expand_frame_repr = False
import seaborn as sns
import pylab a... |
from msrest.serialization import Model
class LinuxConfiguration(Model):
"""Describes Windows configuration of the OS Profile.
:param disable_password_authentication: Specifies whether password
authentication should be disabled.
:type disable_password_authentication: bool
:param ssh: The SSH conf... |
import math
from screenlets.options import ColorOption, IntOption, BoolOption
fft = True
bc = (0.0, 0.6, 1.0, 0.4) #body color
tc = (0.0, 0.6, 1.0, 0.8) #top color
cc = tc #center color
n_slices = 20 #Angular divisions
n_steps = 20
slice_spacing = 20
step_spacing = 1
step_width = 4
center_radiu... |
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.template.loader import render_to_string
from django.template import Context
from challenges.models import Submission
from timeslot.models import Release
from timeslot.notifications import send_reminder
if 'dj... |
# pyChess_junkLib.py
# Where crappy unfactored code sits and dies.
# Hopefully some of it may be of use for future me.
def getMoves(self):
""" returns a list of elligble moves """
moveList = []
if self.piece in ["Bishop", "Queen", "Rook"]:
for coords in movementTemplate[self.piece]:
mo... |
#!/bin/python
import web
import json
from room import Room
from dataContainer import *
urls = (
'/', 'index',
'/addBeacon/(\w+)/(\d+)/(\d+)', 'addBeacon',
'/getRssi', 'getRssi',
'/list', 'list',
'/reset', 'reset'
)
room = Room()
class index:
"""
Show list of routes
"""
def GET(... |
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django.core.urlresolvers import reverse
from core.models.storage import RESOLUTION_STEP
from core.models.utils import QuerySet
from datetime import datetime, tim... |
import os
import glob
import pydicom # requires pydicom >= 1.x
import warnings
from pandas import DataFrame, read_csv
__all__ = ['OAI']
class OAI():
"""Abstract class providing methods to read the OsteoArthritis Initiative (OAI) datasets.
The OAI only provided the data along with a .csv file containing th... |
"""
This class talks to clients, runs their messages through our hooks
(by passing them to MessageHandler.handleline(...)) and returns
responses, usually through the send method it shares with its client.
"""
from builtins import *
from twisted.protocols import basic
from domain.client import Client
from system.mess... |
import sys
import unittest
from datetime import date
import holidays
class TestMorocco(unittest.TestCase):
def setUp(self):
self.holidays = holidays.Morocco()
def test_2019(self):
_holidays = [
date(2019, 1, 1),
date(2019, 1, 11),
date(2019, 5, 1),
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
import time
import copy
from datetime import datetime
import six
from pytz import utc, timezone
from . import fields
from .api import *
__all__ = ['BaseCompany', 'BaseContact', 'BaseLead',
'CompanyTask', 'Contac... |
import inspect, os
# Our local modules
from trepan.processor.command import base_cmd as Mbase_cmd
class EditCommand(Mbase_cmd.DebuggerCommand):
"""**edit** *position*
Edit specified file or module.
With no argument, edits file containing most recent line listed.
See also:
---------
`list`
"""
aliases ... |
import os
import uuid
import dj_database_url
DEBUG = bool(os.environ.get('DEBUG', False))
TEST = bool(os.environ.get('TEST', False))
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
PROJECT_DIR = os.path.dirname(__file__)
DEFAULT_DATABASE_URL = "sqlite:///%s" % os.path.join(PRO... |
from tests.unittest.base_custom import TestCustomField
# Needs to be imported last
from ..custom import user
class TestCustomCommandCustomUser(TestCustomField):
def setUp(self):
super().setUp()
self.args = self.args._replace(field='user', nick='megotsthis')
async def test(self):
self... |
import unittest
from airflow.providers.qubole.hooks.qubole_check import parse_first_row
class TestQuboleCheckHook(unittest.TestCase):
def test_single_row_bool(self):
query_result = ['true\ttrue']
record_list = parse_first_row(query_result)
assert [True, True] == record_list
def test_... |
import uuid
import pretend
import pytest
from pyramid.interfaces import IAuthenticationPolicy, IAuthorizationPolicy
from pyramid.security import Denied
from zope.interface.verify import verifyClass
from warehouse.macaroons import auth_policy
from warehouse.macaroons.interfaces import IMacaroonService
from warehouse.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file."""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
# coding=utf-8
from django.db import models
from mptt.fields import TreeForeignKey
from mptt.models import MPTTModel
from django.contrib.auth.models import User, Group
#from django.conf import settings
#from sistema.thumbs import ImageWithThumbsField
# Create your models here.
class RolUsuario(models.Model):
""... |
{
'name': 'Insurance',
'version': '1.0',
'author': 'Carlos Eduardo Vercelino - CLVsol',
'category': 'Generic Modules/Others',
'license': 'AGPL-3',
'website': 'http://clvsol.com',
'description': '''
Insurance
=========
''',
'images': [],
'depends': [
'clv_base',
'c... |
import collections
import os
import random
import numpy as np
import tensorflow as tf
from common.network_helpers import load_network, get_stochastic_network_move, save_network
def train_policy_gradients(game_spec,
create_network,
network_file_path,
... |
from django.apps import apps
from django.db import models, IntegrityError
from django.db.models import get_model
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from .accessmask import Call
#from tasks.models import EveApiCache
import... |
import datetime
from mkt.monolith.models import MonolithRecord
from stats.models import GlobalStat
METRIC = 'apps_count_installed'
def run():
"""Backfill apps_count_installed."""
# Get the first metric and increment daily until today's date.
today = datetime.datetime.today().replace(hour=0, minute=0, s... |
# -*- coding: utf8 -*-
import os, time
import base64
import requests
import aes as EN
import StringIO
import gzip
import xmltv
import urllib
import simplejson as json
class dodat():
def __init__(self,
base,
login,
path,
dump_name='',
ti... |
import re
import textwrap
from flowui.widget import Widget
class Table(Widget):
'''Table widget
The table is a widget for structured data presentation. It is very similar
to the table widget of HTML or as used by many spreadsheet tools. A table
can consist of rows and or cells that are laid out in a... |
from hamcrest import assert_that, has_item, is_not, has_properties
from netman.core.objects.exceptions import UnknownBond
from tests.adapters.configured_test_case import skip_on_switches, ConfiguredTestCase
class BondManagementTest(ConfiguredTestCase):
__test__ = False
@skip_on_switches("cisco", "brocade", ... |
import logging
from autotest.client.shared import error
from virttest import virsh
def run(test, params, env):
"""
Test command: virsh help.
1.Get all parameters from configuration.
2.Perform virsh help operation.
3.Check help information valid or not.
4.Check result.
"""
extra = pa... |
from __future__ import unicode_literals
from httpstream import Path, ParameterString, URI
def test_can_parse_none_path():
path = Path(None)
assert str(path) == ""
assert path.string is None
def test_can_parse_empty_path():
path = Path("")
assert str(path) == ""
assert path.string == ""
de... |
import cv2
import numpy as np
class ImageProcessor(object):
def __init__(self):
pass
def readImage(self, identifier):
return cv2.imread('snaps/' + identifier + '.jpg')
def writeImage(self, identifier, image):
cv2.imwrite('snaps/' + identifier + '.jpg', image)
def addNumber(se... |
import pandas as pd
df = pd.read_csv('data/src/sample_pandas_normal.csv')
print(df)
# name age state point
# 0 Alice 24 NY 64
# 1 Bob 42 CA 92
# 2 Charlie 18 CA 70
# 3 Dave 68 TX 70
# 4 Ellen 24 CA 88
# 5 Frank 30 NY 57
df_s = df.sample(... |
"""This example gets workflow external condition requests.
Workflow external condition requests must be triggered or skipped for a workflow
to finish.
"""
# Import appropriate modules from the client library.
from googleads import dfp
def main(client):
# Initialize appropriate service.
workflow_request_servic... |
import os
import re
from duplicity import backend
from duplicity.errors import UnsupportedBackendScheme, BackendException
from duplicity.pexpect import run
from duplicity import log
from duplicity import globals
class Par2WrapperBackend(backend.Backend):
"""This backend wrap around other backends and create Par2 r... |
import glob
from generate_utils import Generate
class GeneratePrintConfig(Generate):
'''Generate MFP configuration and copy the print logos.
'''
def generate(self):
self._generate_print_config()
self._generate_print_logo()
def _generate_print_config(self):
for template in glo... |
"""
Utilities for working with lists of model instances which represent
trees.
"""
from __future__ import unicode_literals
import copy
import csv
import itertools
import sys
from django.utils.six import next, text_type
from django.utils.six.moves import zip
from django.utils.translation import ugettext as _
__all__ =... |
import datetime
import time
import re
from .normalizing import normalize
from .misc import plural_or_not
_timer_re = re.compile('([+-])?(\d+:)?(\d+):(\d+)(.\d+)?')
def _get_timetuple(epoch_secs=None):
if epoch_secs is None: # can also be 0 (at least in unit tests)
epoch_secs = time.time()
secs, mi... |
"""PhaseExecutor module for handling the phases of a test.
Each phase is an instance of phase_descriptor.PhaseDescriptor and therefore has
relevant options. Each option is taken into account when executing a phase,
such as checking options.run_if as soon as possible and timing out at the
appropriate time.
A phase mus... |
import os
import logging
import json
from jinja2 import FileSystemLoader, Environment
from src.crawlers import FreeElectronsCrawler, KernelCICrawler
from src.crawlers import RemoteAccessError
from src.writers import FileWriter, LavaWriter, UnavailableError
class JobCrafter(object):
"""
This class handle th... |
"""Hook for Azure Container Registry"""
from typing import Dict
from azure.mgmt.containerinstance.models import ImageRegistryCredential
from airflow.hooks.base import BaseHook
class AzureContainerRegistryHook(BaseHook):
"""
A hook to communicate with a Azure Container Registry.
:param conn_id: :ref:`A... |
#!/usr/bin/env python2
"""Request handler utilities.
Defines a set of parsers and utilities for easier request handling.
"""
import functools
import json
from datetime import datetime
from dateutil.relativedelta import relativedelta
from flask import request
class Error(Exception):
"""Exception raised when an... |
from sippy.Time.Timeout import Timeout
from sippy.UaStateGeneric import UaStateGeneric
class UaStateDisconnected(UaStateGeneric):
sname = 'Disconnected'
def __init__(self, ua):
UaStateGeneric.__init__(self, ua)
ua.on_local_sdp_change = None
ua.on_remote_sdp_change = None
Timeou... |
import inspect
import os
import re
from django import template
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.shortcuts import render_to_response
from django.core.exceptions imp... |
import os
from ert.ecl import EclSum
from ert.enkf import AnalysisConfig, EclConfig, GenKwConfig, EnkfConfigNode, SiteConfig, ObsVector
from ert.enkf import GenDataConfig, FieldConfig, EnkfFs, EnkfObs, EnKFState, EnsembleConfig
from ert.enkf import ErtTemplate, ErtTemplates, LocalConfig, ModelConfig
from ert.enkf.enkf_... |
"""hint.py
This module manages everything to do with in-editor documentation, including
auto-complete, signature pop-ups, and external documentation access.
It exports the following `sublime_plugin` subclasses:
* `GideSignatureCommand`: A `TextCommand` that will show a the signature
for the symbol under t... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.six.moves.urllib.parse import urlsplit
from builds.constants import LATEST
from projects.models import Project
from projects.forms import UpdateProjectForm
class Testmaker(TestC... |
import re
from s2s_core import SVGAttribute, SVGTypeError
class SVGColor(SVGAttribute):
"""Class for SVG 'color' attribute.
Value: <color> | inherit
Initial: depends on user agent
Inherited: yes
"""
color_keywords = {'aliceblue': ('FF', 'F8', 'F0'),
... |
#/usr/bin/env python3
# Imports
import pygame, sys, math
from random import randint
from pygame.locals import *
from classes import *
from formulae import *
# Environment variables
isVisibleMouse = False
dimensions = Point(1024, 768)
# Setting environment
pygame.init()
fpsClock = pygame.time.Clock()
pygame.mouse.set... |
import sqlite3, sys, binascii, time, os.path
from datetime import datetime, timedelta
from Crypto.Hash import SHA256
from Crypto import Random
from sys import getsizeof
class ResqStore:
""" Utilizing a small SQLite database for resq-pi. """
def __init__(self, db_path):
self.db_path = db_path
def _connec... |
# coding: utf-8
# In[1]:
# Reference: https://github.com/andosa/treeinterpreter
# Blog: http://blog.datadive.net/random-forest-interpretation-with-scikit-learn/
from treeinterpreter import treeinterpreter as ti
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor
import n... |
# -*- coding: utf-8 -*-
from .model import ModalityModel
from .estimator import BayesianModalities
from .predict import ModalityPredictor
from .simulate import add_noise
from .visualize import MODALITY_TO_COLOR, MODALITY_ORDER, MODALITY_PALETTE,\
MODALITY_TO_CMAP, ModalitiesViz, violinplot, barplot
__author__ = 'O... |
import VS #VS is only for news
import debug
import quest
import quest_drone
import quest_surplus
import vsrandom
## The below modules are not used in privateer... /ermo
#import dantestmission
#import quest_abu_dhabi
#import quest_contraband_truck
#import quest_disappear
#import quest_isowing
#import quest_racene
#impo... |
# -*- coding: utf-8 -*-
from module.plugins.internal.XFSHoster import XFSHoster
class HugefilesNet(XFSHoster):
__name__ = "HugefilesNet"
__type__ = "hoster"
__version__ = "0.11"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?hugefiles\.net/\w{12}'
__config__ = [("activated", "bool"... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This defines derived arrays and utility functions to extend the utility of
tipsy SimSnaps. Note that this has only been tested on tipsy formatted
snapshots.
The ONLY functions that should be defined OR defined as an import in this file
should be deriveda arrays. Thi... |
# coding=utf-8
import time
import unittest
import HTMLTestRunner
from appium import webdriver
class Learn(unittest.TestCase):
def setUp(self):
desired_caps = {
'platformName':'Android',
'deviceName':'G40GLD4572500169',
'platformVersion':'6.0',
... |
from django.shortcuts import render
# Create your views here.
#coding=utf-8
from django.shortcuts import render,render_to_response
from django.http import HttpResponse,HttpResponseRedirect
from django.template import Context
from django import forms
from blog.models import Tiltle
class TiltleForm(forms.Form):
til... |
'''
Resources management
====================
Resource management can be a pain if you have multiple paths and projects.
Kivy offers 2 functions for searching for specific resources across a list
of paths.
Resource lookup
---------------
When Kivy looks for a resource e.g. an image or a kv file, it searches through
... |
from django import template
from django.conf import settings
from django.apps import apps
from django.db.models.aggregates import Count
from django.contrib.contenttypes.models import ContentType
from ..forms import CommentForm
from ..models import Comment
register = template.Library()
@register.simple_tag
def gener... |
'''
Static Class for handling the game over condition
Ashley Ingram
'''
import pygame, error
from highscoremonitor import HighScoreMonitor
class GameOver:
screen = None
score = None
bg = None
@staticmethod
def gameOver(screen, score):
"""gameOver
@param screen The sc... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import warnings
import matplotlib.axes as maxes
from matplotlib.artist import Artist
from matplotlib.axis import XAxis, YAxis
class SimpleChainedObjects(object):
def __init__(self, objects):
... |
from cuon.Databases.SingleData import SingleData
import logging
import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade
import gobject
#from gtk import TRUE, FALSE
class SingleOrderSupply(SingleData):
def __init__(self, allTables):
SingleData.__init__(self)
# tables.dbd and address
... |
from unittest import TestCase
from hammr.utils.generate_utils import *
class TestGenerateK5(TestCase):
def test_generate_k5vmdk_should_return_uncompressed_image_given_compressed_image(self):
# given
image_given = CompressedImage()
intall_profile_given = MockObject()
# when
... |
from __future__ import unicode_literals, print_function
import pprint
import pandas as pd
from datadez.filter import filter_empty
from datadez.filter import filter_small_occurrence
from datadez.summarize import summarize
from tests.faker import get_random_dataframe
if __name__ == "__main__":
# Get nice output
... |
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
def _backward_one(x, g):
if g is None:
xp = cuda.get_array_module(x)
return xp.zeros_like(x)
if g.ndim != x.ndim:
g = g.sum(axis=tuple(range(g.ndim - x.ndim)))
# An input var... |
"""Tests for call_trees module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.autograph.converters import call_trees
from tensorflow.contrib.autograph.converters import converter_test_base
from tensorflow.pyt... |
N_ = lambda x: x
from pyanaconda.ui.categories import SpokeCategory
__all__ = ["SecurityCategory"]
class SecurityCategory(SpokeCategory):
"""
Class for the Hello world category. Category groups related spokes
together. Both logically and visually (creates a box on a hub). It
references a class of the... |
import gtk
from copy import deepcopy
from cylc.task_state import TASK_STATUSES_ORDERED
empty = {}
empty['small'] = ["11 11 1 1", ". c None"]
empty['small'].extend(["..........."] * 11)
empty['medium'] = ["17 17 1 1", ". c None"]
empty['medium'].extend(["................."] * 17)
empty['large'] = ["22 22 1 1", ". c N... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.test import TestCase
from django.utils import timezone
from meta import settings as meta_settings
from wagtail.core.models import Site
from wagtail.images.models import Image
from wagtail.images.tests.utils import get_test_image_file
from wagtailmet... |
# -*- encoding: utf-8 -*-
from django.contrib.auth.models import Permission
from django.core.urlresolvers import NoReverseMatch, reverse
from django.test import Client, TestCase
from caffe.models import Caffe
from .forms import EmployeeForm
from .models import Employee
class EmployeeViewsTests(TestCase):
"""Te... |
from cybox.common import ToolInformation
from mixbox import fields
import maec
from . import _namespace
import maec.bindings.maec_bundle as bundle_binding
class AVClassification(ToolInformation, maec.Entity):
_namespace = _namespace
_binding = bundle_binding
_binding_class = bundle_binding.AVClassificati... |
"""
## @file
This file tests specific experiments to see if they are providing the
correct results. These are high level tests of the algorithms themselves.
"""
import os
import shutil
from subprocess import call
import time
import unittest2 as unittest
from pkg_resources import resource_filename
from nupic.data.fil... |
from django.utils.translation import ugettext_lazy as _
from django_jinja import library
EXTRA_FIELD_VERBOSE_NAMES = {
"description_diff": _("description"),
"content_diff": _("content"),
"blocked_note_diff": _("blocked note"),
"milestone": _("sprint"),
}
@library.global_function
def verbose_name(ob... |
'''Some general purpose algorithms.'''
from .list import indices_removed
#-------------------------------------------------------------------------------
# defer_reduce
def defer_reduce(func, items, test, accum=None):
'''Recursively reduce items by func, but only the items that do not cause test(items, accum) to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.