content string |
|---|
from pymongo import MongoClient
client = MongoClient()
db = client.ramey
print "Ramey Instalation"
print "========================"
print "installing db data.."
print "- table users"
#create default users
db.users.insert([
{
"_id":"ramey",
"userid":"ramey",
"pwd":"0558d3dd05c436844318664582ec1d08",
"fulln... |
"""API over the neutron service.
"""
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from openstack_dashboard import api
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils
from openstack_dashboard.usage import quotas
@u... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'transformation_calc.ui'
#
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
... |
"""Implement the rules of each Python build utility type."""
import compileall
import logging
import os
import subprocess
import zipfile
import shared_utils as su
MAIN_FILE_NAME = '__main__.py'
INIT_FILE_NAME = '__init__.py'
PY_SHEBANG_HEADER = '#!/usr/bin/env python2.7\n'
SHEBANG_SYMBOL = '#!'
# Thanks to the Pytho... |
import stage
import game
import theme
import curses
import gameloop
import parser
screen = None
def drawTile(x, y, tile='', color=None):
color = color or theme.get_color('default')
x = x * 2 + stage.padding[3] * 2 + stage.width / 2
y += stage.padding[0] + stage.height / 2
try:
screen.addstr... |
from marshmallow import Schema, fields, validates
from willstores.errors import ValidationError
class PriceSchema(Schema):
outlet = fields.Float(required=True)
retail = fields.Float(required=True)
currency = fields.String(required=True)
symbol = fields.String(required=True)
@validates("outle... |
from django.contrib.gis.db import models
from django.utils.translation import ugettext as _
from django.core import urlresolvers
from django.contrib.contenttypes.models import ContentType
# south introspection rules
try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ['... |
import engine.baseActions as baseActions
########################################################
# BEGIN OVERRIDE CLASSES #
########################################################
class Move(baseActions.Move):
def __init__(self):
baseActions.Move.__init__(self)
... |
# encoding: utf-8
"""
Simple type classes, providing validation and format translation for values
stored in XML element attributes. Naming generally corresponds to the simple
type in the associated XML schema.
"""
from __future__ import absolute_import, print_function
import numbers
from pptx.exc import InvalidXmlE... |
"""Copyright 2008 Orbitz WorldWide
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
"""Tests for android_env.components.thread_function."""
from absl.testing import absltest
from android_env.components import thread_function
class ThreadFunctionTest(absltest.TestCase):
def test_hello_world(self):
class HelloFunction(thread_function.ThreadFunction):
def main(self):
v = self._r... |
"""
Version of cinder API compatible with Provizo snapshots.
An MPStackware snapshot is implemented as a read-only volume, so our
"create volume from snapshot" function just returns that.
Points to note:
(1) As a policy, for each snapshot, we allow only one volume derived
from it to exist at any time. Since there is on... |
from nose.tools import *
from flexmock import flexmock
from vision import Vision
import numpy
def test_one_car_closed_day():
image_bytes = load_bytes('test/unit/one_car_closed_day.jpg')
flexmock(Vision)
Vision.should_receive('load_multipart_stream').and_return(image_bytes).once()
Vision.should_receive('is_point_... |
from __future__ import print_function
import random
import math
import argparse
from connector.client import Client
def get_args():
parser = argparse.ArgumentParser("Adversarial Client for the game")
parser.add_argument('--ip', default='127.0.0.1',
help='IP address of the game server... |
# -*- coding: utf-8 -*-
from gettext import gettext as _
NAME = _('Montevideo')
STATES = [
(_('San José'), 254, 62, 279, 0),
(_('Canelones'), 253, 441, 126, 0),
(_('Montevideo'), 252, 423, 476, 0)
]
CITIES = [
(_('Santiago Vázquez'), 165, 392, 2, 55, 14),
(_('Ciudad Vieja'), 433, 666, 1, -50, 18... |
"""
=============================================
Compute MxNE with time-frequency sparse prior
=============================================
The TF-MxNE solver is a distributed inverse method (like dSPM or sLORETA)
that promotes focal (sparse) sources (such as dipole fitting techniques).
The benefit of this approach ... |
from invenio.legacy.search_engine import get_fieldvalues
from intbitset import intbitset
def config_cache(cache={}):
if 'config' not in cache:
cache['config'] = load_config('citation')
return cache['config']
def get_recids_matching_query(p, f, m='e'):
"""Return list of recIDs matching query for ... |
'''
Facades
=======
Interface of all the features availables.
'''
__all__ = ('Accelerometer', 'Camera', 'GPS', 'Notification',
'TTS', 'Email', 'Vibrator')
class Accelerometer(object):
'''Accelerometer facade.
'''
@property
def acceleration(self):
'''Property that returns values ... |
from __future__ import absolute_import
from __future__ import with_statement
import glob
import os
from celery.exceptions import SecurityError
from .utils import crypto, reraise_errors
class Certificate(object):
"""X.509 certificate."""
def __init__(self, cert):
assert crypto is not None
w... |
from msrest.serialization import Model
class TaskInformation(Model):
"""Information about a task running on a compute node.
:param task_url: The URL of the task.
:type task_url: str
:param job_id: The ID of the job to which the task belongs.
:type job_id: str
:param task_id: The ID of the tas... |
import curses, math
def alert(stdscr, message, block=True):
my, mx = stdscr.getmaxyx()
lines = message.split('\n')
height = 4 + len(lines)
width = max([len(line) for line in lines]) + 8
win = curses.newwin(height, width, my/2-height/2, mx/2-width/2)
win.border(0)
for i in range(len(lines)):
win.addst... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst... |
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
#
# Program Parameters
#
import os
import... |
import ddt
from django.core.exceptions import ValidationError
from django.utils.timezone import now, timedelta
from oscar.core.loading import get_model
from oscar.test import factories
from ecommerce.coupons.tests.mixins import CouponMixin
from ecommerce.extensions.catalogue.tests.mixins import DiscoveryTestMixin
from... |
# coding: utf-8
"""This module contains several handy functions primarily meant for internal use."""
from __future__ import division
#from datetime import date, time, timedelta, tzinfo
import datetime
from inspect import isfunction, ismethod, getargspec
from calendar import timegm
import time
import re
from pytz imp... |
##
# .bin.pg_python - Python console with a connection.
##
"""
Python command with a PG-API connection(``db``).
"""
import os
import sys
import re
import code
import optparse
import contextlib
from .. import clientparameters
from ..python import command as pycmd
from .. import project
from ..driver import default as p... |
"""Utilities for generating Tensor-valued random seeds."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from te... |
from scss import Scss
from csscompressor import compress
from sassy_coffee import utils
import sassin, os, coffeescript, sassy_coffee
def compile_files():
ftc = sassy_coffee.formats_to_compile
exc = sassy_coffee.exclusions
print 'Compiling files with formats ' + str(ftc) + ' and'
print 'exclusions ' + ... |
from __future__ import print_function
import argparse
import os
import re
import sys
import mp3_event_parser
#top = "c:\\users\\snichol\\music\\itunes\\itunes media\\music"
pattern = re.compile('.*\.(mp3)$', re.IGNORECASE)
class FileInfo(object):
'''Identifying information about an MP3 file'''
... |
import re
from odoo import http
from odoo.http import request
from odoo.addons.website_event.controllers.main import WebsiteEventController
class WebsiteEventControllerExtended(WebsiteEventController):
@http.route()
def registration_confirm(self, event, **post):
"""Check that threre are no email dup... |
class Packet:
PACKET_LENGTH = 4
def decode(b):
"""Retuns a Packet object for the given string, or None if it isn't valid."""
if len(b) != Packet.PACKET_LENGTH:
return None
if b[0] ^ b[1] ^ b[2] != b[3] or ((b[0] & 0x80) >> 7) != 1:
return None
if (b[0] ... |
#!/usr/bin/python
import sys
import re
import types
def usage():
print "Usage: %s filename clubvaluemax clubvaluemin" % sys.argv[0]
print " filename: league table you want to process"
print " clubvalues: max/min values of the top/bottom clubs"
print
print "Output will be to stand... |
from neon.initializers.initializer import (Array,
Constant,
Gaussian,
GlorotUniform,
IdentityInit,
Kaimin... |
from __future__ import absolute_import, division, print_function
import re
from subprocess import check_call, CalledProcessError
from graphviz import Digraph
from .core import istask, get_dependencies, ishashable
def task_label(task):
"""Label for a task on a dot graph.
Examples
--------
>>> from ... |
""" Keeping things as simple as possible for now
channel setup is static
will need to be able to cooperate with other robovero
classes in the future.
also, it would be a good idea if this module could handle
arbitrary channel settings
"""
from robovero.lpc17xx_mcpwm import MCPWM_Init, MCPWM_CHANNEL_CFG_Type, \
... |
import traceback
import psutil
import re
import multiprocessing
try:
import subprocess32 as subprocess
except Exception:
import subprocess
from pandaharvester.harvesterbody.agent_base import AgentBase
from pandaharvester.harvesterconfig import harvester_config
from pandaharvester.harvestercore import core_util... |
import os
import sys
from gi.repository import Gtk
from gi.repository import Gdk
import pygame
from pygame.locals import *
from pygame.color import *
sys.path.append('lib/')
# If your architecture is different, comment these lines and install
# the modules in your system.
sys.path.append('lib/Box2D-2.0.2b2-py2.7-lin... |
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of linked list.
@param n: An integer.
@return: The head of linked list.
"""
def removeNthFromEnd(self, h... |
from django.db import models
from django.conf import settings
from django.utils.text import slugify
from django.core.urlresolvers import reverse
# Create your models here.
class Bukkake(models.Model):
NORMAL = 'no'
CLARENDON = 'cl'
GINGHAM = 'gi'
MOON = 'mo'
LARK = 'la'
REYES = 're'
JUNO = ... |
#!/usr/bin/env python
"""
DESCRIPTION:
MagPy credentials functions:
Methods for storing and accessing user/password information for data bases and ftp accounts. Sensitive data is encrypted.
For even better security please change the permission by chmod 600 ~/.magpycred
Credential file looks like:
#... |
from importlib import import_module
import os
from toolz import merge
from zipline import run_algorithm
# These are used by test_examples.py to discover the examples to run.
EXAMPLE_MODULES = {}
for f in os.listdir(os.path.dirname(__file__)):
if not f.endswith('.py') or f == '__init__.py':
continue
... |
from __future__ import absolute_import
from __future__ import division
from math import sin, cos, pi, sqrt
from copy import deepcopy
import logging
import globals.globals as g
from core.linegeo import LineGeo
from core.arcgeo import ArcGeo
from core.point import Point
from core.intersect import Intersect
... |
"""
Common functions for coordinate reading --- :mod:`MDAnalysis.coordinates.core`
==============================================================================
Important base classes are collected in :mod:`MDAnalysis.coordinates.base`.
.. autofunction:: reader
.. autofunction:: writer
Helper functions:
.. autofun... |
#!/usr/bin/python
import log4py
import sys
from os import utime
from time import time
class Log4PyTest:
def __init__(self):
self.log4py = log4py.Logger().get_instance(self)
def run(self):
self.log4py.error("error")
self.log4py.warn("warn")
self.log4py.info("info")
sel... |
#
# A profiler used to perform profiling on the pluto code, in order to identify the hotspot,
# to which where syntactic transformations can be applied.
#
import os, re, sys
#---------------------------------------------------------
class Profiler:
'''The profiler used to identify the hotspot'''
def __init_... |
# -*- coding: utf-8 -*-
import os, time
from fabric.api import *
from fabric.contrib.project import rsync_project
from contextlib import contextmanager
env.local_stage = os.getcwd()
env.roledefs = {
'testing': ['alioth.lib.pdx.edu'],
'production': ['nomad.lib.pdx.edu'],
}
env.time_stamp = time.strftim... |
# -*- coding: utf-8 -*-
"""
@author: Daniel Antunes & Cédric Hubert
"""
import vrep, copy, sys, random, operator#,time
import numpy as np
import matplotlib.pyplot as plt
# declaration des constantes
DELAY = 150
NB_ITERATIONS = 1500
NB_ACTIONS_ECHANTILLONAGE = 40
NS = 250
K = 10
# declaration des variables
DATA = [] ... |
'''
This is a thin wrapper designed to run all Python tests distributed with IronPython
which do not have external dependencies.
The following options are available:
-M option (Extension mode)
-M:0 : launch ip with ""
this is the default choice if -M: is not specified
-M:1 : launch ip with "-O -D... |
import os
from oslo_config import cfg
from oslo_db import options as db_options
from oslo_log import log as logging
from oslo_policy import opts as policy_opts
from congress.managers import datasource as datasource_mgr
from congress import version
LOG = logging.getLogger(__name__)
core_opts = [
cfg.StrOpt('bind... |
# -*- coding: utf-8 -*-
from functools import wraps
from dagny.renderer import Renderer
from dagny.resource import Resource
from dagny.utils import resource_name
class Action(object):
"""
A descriptor for wrapping an action method.
>>> action = Action
>>> class X(Resource):
... ... |
# This code was taken and modified from Alex Martelli's
# "determine the name of the calling function" recipe (Thanks, Alex!)
#
# This code also benefits from a useful enhancement from Gary Robinson, allowing
# only the arguments to __init__ to be copied, if that is desired.
#
# use sys._getframe() -- it returns a fra... |
from crawler_fetcher.engine import run_fetcher
from mediawords.db import connect_to_db
from mediawords.test.db.create import create_test_medium, create_test_feed, create_test_story
from mediawords.test.hash_server import HashServer
from mediawords.util.network import random_unused_port
def test_run_fetcher():
db ... |
# python kimsufi hunter v0.1
# CONFIG
TARGET_KIMSUFI_ID = "" # something like 150sk40
TARGET_DESCR = ""
EMAIL_FROM_ADDRS = ""
EMAIL_TO_ADRS = ""
EMAIL_SMTP_LOGIN = EMAIL_FROM_ADDRS
EMAIL_SMTP_PASSWD = ""
EMAIL_SMTP_SERVER = "" # somthing like smtp.gmail.com:587
# CODE
import urllib.request
import smtplib
i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Process data to be included in a generic template.
Synopsis:
``python -m cocopp.rungenericmany [OPTIONS] FOLDER``
Help:
``python -m cocopp.rungenericmany -h``
"""
from __future__ import absolute_import
from __future__ import print_function
import os
import s... |
"""
# NOTE:
THE self.lang[operator] PATTERN IS CASTING NEW OPERATORS TO OWN LANGUAGE;
KEEPING Python AS# Python, ES FILTERS AS ES FILTERS, AND Painless AS
Painless. WE COULD COPY partial_eval(), AND OTHERS, TO THIER RESPECTIVE
LANGUAGE, BUT WE KEEP CODE HERE SO THERE IS LESS OF IT
"""
from __future__ import absolute_... |
from PyQt4 import QtCore, QtGui
import sfbm.Global as G
from sfbm.FileUtil import launch
def actionAtPos(pos):
menu = G.App.widgetAt(pos)
if isinstance(menu, QtGui.QMenu):
action = menu.actionAt(menu.mapFromGlobal(pos))
if action and isinstance(action, DraggyAction):
return action
... |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Okinawa Institute of Science and Technology, Japan.
#
# This script runs on STEPS 2.x http://steps.sourceforge.net
#
# H Anwar, I Hepburn, H Nedelescu, W Chen and E De Schutter
# Stochastic calcium mechanisms cause dendritic calcium spike... |
#
# Simple benchmarks for the multiprocessing package
import time, sys, multiprocessing, threading, Queue, gc
if sys.platform == 'win32':
_timer = time.clock
else:
_timer = time.time
delta = 1
#### TEST_QUEUESPEED
def queuespeed_func(q, c, iterations):
a = '0' * 256
c.acquire()
c.notify()
... |
from __future__ import absolute_import
from collections import OrderedDict
from django.test import TestCase, override_settings
from django.utils import timezone
from rest_framework.renderers import JSONRenderer
from rest_framework.test import APIRequestFactory
from rest_framework.reverse import reverse
from silver.... |
import numpy as np
from bayesnet.tensor.constant import Constant
from bayesnet.tensor.tensor import Tensor
from bayesnet.function import Function
class NanSum(Function):
"""
summation along given axis neglecting nan
y = sum_i=1^N x_i
"""
def __init__(self, axis=None, keepdims=False):
if i... |
"""
SoftLayer.tests.managers.ssl_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import testing
from SoftLayer.testing import fixtures
class SSLTests(testing.TestCase):
def set_up(self):
self.ssl = SoftLayer.SSLManager... |
"""
dto.Record is an abstract base class. Its subclasses hold
information about individual data records, which are
represented by individual lines in the HonSSH-generated files,
individual rows in the local db storage tables, or individual
"documents" in the ElasticSearch database.
"""
import abc
fr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
import xml.etree.cElementTree as et
import collections
import accurev.base
class Element(accurev.base.Base):
@staticmethod
def from_stat(client, out):
for element in et.fromstring(out).findall('./element'):
yield Ele... |
"""
Created on 2017.7.3 8:21
Author: Victoria
Email: <EMAIL>
"""
import torch
def accu(output, target, cuda):
"""
Accuracy of output with respect to target.
Input:
output: list of Variables with shape (batch_size, 7/11)
target: Variable with shape (batch_size, 6)
cuda: bool... |
import run
import common
import listing
import store
import sys
# jockler remove IMAGENAME
def remove(args, keep_images=[], keep_containers=[]):
if not common.args_check(args,1):
common.fail("Remove all containers and images associated with an image.\n\nUsage:\n\n jockler remove IMAGENAME")
imagen... |
from pickle import loads
import urllib2
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from cthulhubot.models import BuildComputer, Job
from cthulhubot.views import create_job_assignment
from tests.helpers import BuildmasterTestCase
"""
Tests for API that Cthylla uses. ... |
import os
import time
import ldb
from samba.tests.samba_tool.base import SambaToolCmdTest
from samba import (
nttime2unix,
dsdb
)
class UserCmdTestCase(SambaToolCmdTest):
"""Tests for samba-tool user subcommands"""
users = []
samdb = None
def setUp(self):
super(UserCmdT... |
from sympy import Symbol, Basic, Integer, sympify
class PlotInterval(object):
"""
"""
_v, _v_min, _v_max, _v_steps = None, None, None, None
def require_all_args(f):
def check(self, *args, **kwargs):
for g in [self._v, self._v_min, self._v_max, self._v_steps]:
if g i... |
"""Tests for the Command plug-in."""
import os
from mock import patch
from tarmac.bin.registry import CommandRegistry
from tarmac.plugins import command
from tarmac.tests import TarmacTestCase
from tarmac.tests.test_commands import FakeCommand
from tarmac.tests import Thing
class TestCommand(TarmacTestCase):
""... |
revision = '11'
down_revision = '10'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from geopy.geocoders import Nominatim
from geopy.distance import vincenty
import numpy as np
import math
import json
def radian_to_degree... |
from shuup import configuration
from shuup.core.models import get_person_contact
from shuup.front.checkout.addresses import CompanyForm
from shuup.testing import factories
from shuup.testing.utils import apply_request_middleware
def test_required_fields(rf, admin_user):
request = apply_request_middleware(
... |
import numpy as np
from scipy import weave
"""
This file provides a weavified version of the function
np.einsum('ij,ik,il->jkl', A, A, B)
see also test_special_einsum.py
"""
code = """
int n,m,mm,d;
double tmp;
for(n=0;n<N;n++){
for(m=0;m<M;m++){
//compute diag
tmp = A(n,m)*A(n,m);
for(d=0;d<D;d++){... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
#from CongressionalRecord import db
from neo4j import contextmanager
from neo4j import connection
from re import escape
from django.conf import settings
connection.http.REQUEST_TIMEOUT = 9999
manager = contextmanager.Neo4jDB... |
from galaxy_analysis.plot.plot_styles import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import deepdish as dd
import h5py
import glob
import os
import yt
def generate_dataset(wdir = '.', overwrite = False, filename = 'orbit.h5'):
times = np.array([])
pid = ... |
import os
from FindProgram import find_program
from Command import Command
def get_download_command(uri, dest_path, output):
wget = find_program('wget')
if wget is None:
return None
cmd = [wget, uri, '-O', dest_path, '-o', output]
if uri.startswith('https://'):
cmd.append('--no-check-... |
import numpy as np
import numpy.random as npr
import matplotlib.pyplot as plt
%matplotlib inline
import mdtraj
plt.rc('font', family='serif')
# fetch example data
from msmbuilder.example_datasets import FsPeptide
dataset = FsPeptide().get()
fs_trajectories = dataset.trajectories
fs_t = fs_trajectories[0]
# 1. intern... |
{ 'sequence': 500,
"name" : "Common financial reports"
, "version" : "1.0"
, "author" : "Zikzakmedia SL"
, "website" : "www.zikzakmedia.com"
, "license" : "GPL-3"
, "depends" : ["account","stock_packing_webkit"]
, "category" : "Localisation/Accounting"
, "description": """
Add some common financial/accounting reports a... |
#!/usr/bin/env python
# encoding: utf-8
import os
import sys
import codecs
from setuptools import setup, find_packages
# Used to load the `README.rst` file from disk later.
here = os.path.abspath(os.path.dirname(__file__))
tests_require = [ # We require these packages when running tests.
'coverage', # Capture ... |
"""
grifthost resolveurl plugin
Copyright (C) 2015 tknorris
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 later version.
This program is di... |
from PyGLEngine.api import synthesize, getSortedByAttr, getClassName
#------------------------------------------------------------
#------------------------------------------------------------
class Base(object):
'''The base object almost everything should inherit from'''
def __init__(self, priority=0, world=N... |
import random
import json
import subprocess
class StateTracker:
def __init__(self, salt):
self.salt = salt
self.get_answer = lambda x: get_answer(self.salt, x)
out = subprocess.check_output(["question_generation/get_qnas", self.salt])
self.questions = [line.split('\t') for line in ... |
import unittest
import utils
from tree import TreeNode
# O(n) time. O(log(n)) space. Iterative post-order DFS, stack.
class Solution:
def findTilt(self, root):
"""
:type curr: TreeNode
:rtype: int
"""
if not root:
return 0
stack = []
curr = root... |
# -*- coding: utf-8 -*-
import commonware.log
from django.contrib import auth
from django.shortcuts import render, redirect
from django.forms.models import inlineformset_factory
from ffclub.event.forms import *
from forms import *
from models import *
from ffclub.settings import CUSTOM_ORDER_DETAIL_CHOICES, CUSTOM_P... |
from .sub_resource import SubResource
class LoadBalancingRule(SubResource):
"""A loag balancing rule for a load balancer.
All required parameters must be populated in order to send to Azure.
:param id: Resource Identifier.
:type id: str
:param frontend_ip_configuration: A reference to frontend I... |
#!/usr/bin/env python3
import os
import sys
from xml.dom import minidom
# STRINGTABLE DIAG TOOL
# ---------------------
# Checks for missing translations and all that jazz.
def get_all_languages(projectpath):
""" Checks what languages exist in the repo. """
languages = []
for module in os.listdir(projectpath... |
# -*- coding: utf-8 -*-
import os
import time
import subprocess
import json
import shutil
import datetime
from time import strftime, localtime
import toml
import requests
import csv
import data_gen
conf_fn = os.sep.join(
[os.path.split(os.path.realpath(__file__))[0], "graphs.toml"])
# print conf_fn
with o... |
def is_prime(n):
for i in range(2, int(n ** 0.5)+1):
if not(n%i):
return False
return True
def get_previous_pandigital(n):
str_n = str(n)
inverse_n = str_n[::-1]
for previous, following in zip(inverse_n[1:], inverse_n):
if previous > following:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 26 19:58:53 2017
@author: sitibanc
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# Read CSV
# =============================================... |
"""Positive definite Operator defined with diagonal covariance."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import six
from tensorflow.contrib.distributions.python.ops import operator_pd
from tensorflow.python.framework import ops
from te... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from mock import patch, MagicMock
from audit_tools.audit.permissions import AUDIT_PERMISSIONS, register_permissions, unregister_permissions, SearchAccess, \
A... |
#!/usr/bin/python3
from optparse import OptionParser
import usb
import sys
USB_REQUEST_TYPE = 0x21 # Host To Device | Class | Interface
USB_REQUEST = 0x09 # SET_REPORT
USB_VALUE = 0x0300
USB_INDEX = 0x2
USB_INTERFACE = 2
VENDOR_ID = 0x1532 # Razer... |
import ast, datetime
from django.core.exceptions import ImproperlyConfigured
class Scheduler():
def __init__(self, conf_dict_str):
self.conf = self._parse_conf_dict_str(conf_dict_str)
mandatory_vars = [
'MIN_TIME',
'MAX_TIME',
'INITIAL_NEXT_ACTION_FACTO... |
from conans import ConanFile, CMake, Embedded
class AversivePlusPlusModuleConan(ConanFile):
name = "hal-atmegaxx0_1"
version = "0.1"
exports = "*"
settings = "os", "compiler", "build_type", "arch", "target"
requires = "hal/0.1@AversivePlusPlus/dev", "hdl-atmegaxx0_1/0.1@AversivePlusPlus/dev", "too... |
import setuptools
setuptools.setup(name='nose-cov',
version='1.6',
description='nose plugin for coverage reporting, including subprocesses and multiprocessing',
long_description=open('README.txt').read().strip(),
author='Meme Dough',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- test-case-name: logsnarf.test.test_config -*-
# pylint: disable=invalid-name
"""Logsnarf configuration.
See :doc:`configuration <configuration>` for details on how to configure
logsnarf.
"""
import collections
import logging.config
import ConfigParser
import os
impo... |
# -*- coding: utf-8 -*-
# Define self package variable
__version__ = "1.1.3.25"
__all__ = ["pycltools"]
__author__ = "Adrien Leger"
__email__ = "<EMAIL>"
__url__ = "https://github.com/a-slide/pycoQC"
__licence__ = "GPLv3"
__classifiers__ = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Rese... |
import unittest
from bdec.constraints import ConstraintError, Equals
import bdec.data as dt
import bdec.entry as ent
import bdec.expression as expr
import bdec.field as fld
import bdec.sequence as seq
class TestSequence(unittest.TestCase):
def test_simple_sequence(self):
embedded = [fld.Field("bob", 8), fl... |
from plugins.Name_PoorlyWrittenWayType import P_Name_PoorlyWrittenWayType
import re
class Name_PoorlyWrittenWayType_Lang_es(P_Name_PoorlyWrittenWayType):
only_for = ["es"]
def init(self, logger):
P_Name_PoorlyWrittenWayType.init(self, logger)
self.ReTests = {}
self.ReTests[(100, 'Av... |
from base import MetaRule, FieldRule
class Map(FieldRule):
def __init__(self, field, keywords, data_extractor, **kwargs):
super(Map, self).__init__(field, **kwargs)
if isinstance(keywords, (list, tuple)):
self.keywords = keywords
else:
self.keywords = [keywords]
self.data_extractor = data_extractor
def... |
from collections import Sequence
from types import GeneratorType
import unittest
from school import School
class SchoolTest(unittest.TestCase):
def setUp(self):
self.school = School("Haleakala Hippy School")
def test_an_empty_school(self):
for n in range(1, 9):
self.assertItemsEq... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.