content string |
|---|
"""
Setup script.
"""
from setuptools import setup, find_packages
if __name__ == '__main__':
with \
open('requirements.txt') as requirements, \
open('test_requirements.txt') as test_requirements, \
open('README.md') as readme:
setup(
name='aloe_django',
... |
"""
Server Technology Power Strips
"""
from basicpowerstrip import BasicPowerStrip
from clusto.drivers.devices.common import IPMixin, SNMPMixin
from clusto.drivers.resourcemanagers import IPManager
from clusto.exceptions import DriverException
import re
class PowerTowerXM(BasicPowerStrip, IPMixin, SNMPMixin):
... |
"""
This module provides a simple interface for loading a shared library via ctypes,
allowing it to be specified in an OS-independent way and searched for preferentially
according to the paths that pkg-config specifies.
"""
import os, fnmatch, ctypes, commands, sys, subprocess
from ctypes.util import find_library
from ... |
# -*- encoding: utf-8 -*-
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from .progressBar import cProgressBar
from subchecker import cSubChecker
class cSubCheckerDialog(Gtk.Window):
def __init__(self, parent, subList):
super(cSubCheckerDialog, self).__init__()
self.parent... |
import os
from flask import Flask, request, render_template, send_from_directory
import iss
from util import safe_float, json, jsonp
app = Flask(__name__)
# APIs:
API_DEFS = [
{
"title": "ISS Location Now",
"link": "/iss-now.json",
"desc": "Current ISS location over Earth (latitude/longitu... |
# -*- coding: utf-8 -*-
import random
import pytest
from cfme.common.host_views import HostDetailsView
from cfme.common.host_views import HostEditView
from cfme.infrastructure import host
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infr... |
from elasticapm.instrumentation.packages.base import AbstractInstrumentedModule
from elasticapm.traces import capture_span
try:
from functools import lru_cache
except ImportError:
from cachetools.func import lru_cache
class PyLibMcInstrumentation(AbstractInstrumentedModule):
name = "pylibmc"
instrum... |
# Loading libraries
from scipy.io import loadmat
import h5py
from time import strptime
from calendar import timegm
import pysam
print pysam.__version__
print pysam.__file__
# /nfs/software/cn/el6.5/python/envs/.virtualenvs/cpython279/lib/python2.7/site-packages/RSeQC-2.6.2-py2.7-linux-x86_64.egg
# pip install --ta... |
# -*- coding:utf-8 -*-
import unittest
from testfixtures import compare
from zope.interface import Interface, implementer
class INode(Interface):
pass
@implementer(INode)
class base(object):
pass
def NodeFactory(name, iface_name, base=base):
from zope.interface.interface import InterfaceClass
def __i... |
from rdflib.Graph import Graph
from rdflib import Namespace,BNode
FOAF = Namespace("http://xmlns.com/foaf/0.1/")
RDFS = Namespace("http://www.w3.org/2000/01/rdf-schema#")
def make_foaf_graph(starturi, steps=3):
# Initialize the graph
foafgraph = Graph()
# Keep track of where we've already been
v... |
"""This example gets all cities available to target.
A full list of available tables can be found at
https://developers.google.com/doubleclick-publishers/docs/reference/v201204/PublisherQueryLanguageService
"""
__author__ = '<EMAIL> (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" scri... |
#from .ansi import Terminal
from blessings import *
#import curses
from .message import *
from .collection import *
import datetime
"""
date |time |msgcount|num flights|
------------------------------------------------------------------------------
ICOA |call sign |lat |lon |dist |view |last seen |
--... |
# -*- 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):
# Deleting field 'PollUser.voted'
db.delete_column(u'polls_polluser', 'voted')
def backwards(self, orm... |
"""
Handles the "VOUnit" unit format.
"""
import copy
import keyword
import operator
import re
import warnings
from . import core, generic, utils
class VOUnit(generic.Generic):
"""
The IVOA standard for units used by the VO.
This is an implementation of `Units in the VO 1.0
<http://www.ivoa.net/do... |
""" Methods to compute effective masses and other derivatives. """
__docformat__ = "restructuredtext en"
__all__ = ["Extract", "iter_emass", 'EMass', 'effective_mass']
from .extract import Extract as ExtractDFT
from ..tools.makeclass import makeclass, makefunc
from ..tools import make_cached
from .functional import Vas... |
r"""
Like all boundary condition objects, this class implements
all the methods of the base class **BC** , which are described in detail
in the documentation of the abstract class **BC**.
The OrthorhombicBC class is responsible for the orthorhombic boundary condition.
Currently only periodic boundary conditions are s... |
from django.contrib import admin
from popolo import models
from .behaviors import admin as generics
class PostAdmin(admin.ModelAdmin):
model = models.Post
fieldsets = (
(None, {"fields": ("label", "role", "start_date", "end_date")}),
(
"Details",
{
"cl... |
#!/usr/bin/env python
from __future__ import print_function
import logging
import os.path
import sys
import numpy as np
import forgi.threedee.model.similarity as ftms
import forgi.utilities.commandline_utils as fuc
import forgi.threedee.utilities.pdb as ftup
log = logging.getLogger(__name__)
def get_parser():
... |
from __future__ import absolute_import
import unittest2
from st2common.util.ip_utils import split_host_port
class IPUtilsTests(unittest2.TestCase):
def test_host_port_split(self):
# Simple IPv4
host_str = "1.2.3.4"
host, port = split_host_port(host_str)
self.assertEqual(host, hos... |
from kitchen.utils import iter_ngram, iter_ngram_pad
from nose.tools import assert_equal, raises
@raises(ValueError)
def test_bad_bounds():
list(iter_ngram(range(10), 2, 3))
def test_iter_ngram():
seq = [0, 1, 2, 3, 4]
lst = list(iter_ngram(seq, 1))
assert_equal(lst, [[0], [1], [2], [3], [4]])
... |
import unittest
import os
import grader
CURRENT_FOLDER = os.path.dirname(__file__)
HELPERS_FOLDER = os.path.join(CURRENT_FOLDER, "helpers")
def test_generator(name, fun):
@grader.test
def some_test(m):
assert name != fun()
grader.setDescription(some_test, name)
#print(grader.testcases)
test_g... |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import setup as _setup
# Mock out certain modules while building documentation
class Mock(object):
__all__ = []
def __init__(self, *args, **kw):
pass
def __call__(self, *args, **kw):
return Mock()
... |
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound
from dataactcore.models.baseInterface import BaseInterface
from dataactcore.models.errorModels import FileStatus, ErrorType, File, ErrorMetadata
from dataactcore.utils.responseException import ResponseException
from dataactvalidator.vali... |
import os.path
import unittest
from subprocess import check_output
import pysam
from bam_crumbs.utils.test import TEST_DATA_DIR
from bam_crumbs.utils.bin import BIN_DIR
from bam_crumbs.statistics import (count_reads, ReferenceStats, ReadStats,
CoverageCounter, _flag_to_binary,
... |
'''
Common Distributions in TensorFlow
Author: Rowel Atienza
Project: https://github.com/roatienza/Deep-Learning-Experiments
'''
# On command line: python3 distributions.py
# Prerequisite: tensorflow 1.0 (see tensorflow.org)
from __future__ import print_function
import tensorflow as tf
# Temporary directory for stor... |
from functools import partial
import numpy as np
from keras.preprocessing.image import img_to_array
from keras.preprocessing.image import load_img
from toolbox.image import bicubic_rescale
from toolbox.image import modcrop
from toolbox.paths import data_dir
def load_set(name, lr_sub_size=11, lr_sub_stride=5, scale=... |
__source__ = 'https://leetcode.com/problems/walls-and-gates/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/walls-and-gates.py
# Time: O(m * n)
# Space: O(g)
#
# Description: Leetcode # 286. Walls and Gates
#
# You are given a m x n 2D grid initialized with these three possible values.
#
# -1 -... |
from django.contrib import messages
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.views.decorators.http import require_POST
from base.utils import redirect_back
from decorators import inchar_required
from unit.models import WorldUnit
from world.models.events impor... |
"""Helpers for an Ubuntu application."""
__all__ = [
'make_window',
]
import os
import gtk
from daq.daqconfig import get_data_file
import gettext
from gettext import gettext as _
gettext.textdomain('daq')
def get_builder(builder_file_name):
"""Return a fully-instantiated gtk.Builder instance from speci... |
import sys
import os
import unittest
from cStringIO import StringIO
from types import ListType
from email.test.test_email import TestEmailBase
from test.test_support import TestSkipped
import email
from email import __file__ as testfile
from email.iterators import _structure
def openfile(filename):
from os.path ... |
from twisted.trial import unittest
import mock
from .. import state
class StateTestCase(unittest.TestCase):
def setUp(self):
m = mock.mock_open(read_data='{ "foo": "bar", "bar": "zab" }')
with mock.patch('logsnarf.state.open', m, create=True):
self.state = state.State('somefakefile.js... |
import bpy
from bpy.props import EnumProperty, IntProperty, BoolProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, SIMPLE_DATA_TYPES
import numpy as np
def avr(data):
sum_d = 0.0
flag = True
for d in data:
if type(d) not in [float, int, np.... |
#!/usr/bin/env python
######################
import xml.etree.cElementTree as et
import re
import sys
import base64
def init_file(in_file):
print "\033[1;32m[+]\033[0m Initialising '%s'" % in_file
try:
content = open(in_file).read()
return et.XML(content)
except:
print "\033[1;31m[!]\033[0m Could not acces... |
import os.path as op
from cloudyclient.api import PythonDeployScript, render_template, sudo
class NginxJapperDeployScript(PythonDeployScript):
'''
Standard deployment with nginx + uwsgi.
'''
use_wheel = True
conf_files = [
('nginx/nginx.conf', 'nginx.conf_file'),
('nginx/supervis... |
# manage.py
import unittest
import coverage
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from flask_mail import Message
from project.server import app, db, mail
from project.server.config import BaseConfig
from project.server.models import User, Role, Currency, LexiconType, Stoc... |
import re, bz2, gzip, cStringIO
from xml.sax import make_parser, handler
from xml.sax.saxutils import XMLGenerator, quoteattr
###########################################################################
class dummylog:
def log(self, text):
return
class dummyout:
def __init__(self):
self._n = 0... |
# DotBoxing Game Code
# Matt Mahan and Matt Rundle
# Programming Paradigms PyGameTwisted Project
import pygame
import math
import sys
import os
import time
import getopt
from socket import *
from pygame.locals import *
# Main game state object
class GameSpace:
def __init__(self,reactor):
# Initialize pygame
py... |
#!/usr/bin/env python2
import sys
sys.path.append("../svgwrite-1.1.3")
sys.path.append("../filter")
import premap_pb2 as pb
import types_pb2 as pbtypes
import svgwrite
scale = 1000000
shiftlat = scale*49.941901
shiftlon = scale*14.224436
def drawWays(pbMap,d, node_ids,minlon,minlat):
for way in pbMap.ways:
coord... |
import json
import logging
import time
import xml.etree.ElementTree as ET
from xml.dom.minidom import parseString
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from nodetraq.lib.base import BaseController, render, user_level
from nodetraq.li... |
import sqlalchemy
def upgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine)
software_deployment = sqlalchemy.Table(
'software_deployment', meta, autoload=True)
software_deployment.c.signal_id.drop()
def downgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_eng... |
question_type = 'input_output'
source_language = 'C'
parameter_list = [
['$lower','int'],['$upper','int'],
['$o0','string'],['$o1','string'],['$o2','string'],
['$o3','string'],['$o4','string'],
['$o5','string'],['$o6','string'],['$o7','string'],
['$o8','string'],['$o9','string'],
]
tuple_list = [
['while_bas... |
"""
Settings for eLife
~~~~~~~~~~~
To specify multiple environments, each environment gets its own class,
and calling get_settings will return the specified class that contains
the settings.
You must modify:
aws_access_key_id
aws_secret_access_key
"""
class exp():
# AWS s... |
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import simplifyString, toUnicode
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.movie.base import MovieProvider
from libs.themoviedb import tmdb
import re
log = CPLog(__name__)
class TheMovieDb(MovieProvider... |
from django.contrib import messages
from django.contrib.auth import get_user_model, update_session_auth_hash
from django.db import transaction
from django.http import JsonResponse
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from misago.admin.auth import start_admin_ses... |
# -*- coding: UTF-8 -*-
#! python3
# ----------------------------------------------------------------------------
"""
Complementary set of hooks to use with Isogeo API.
"""
# ---------------------------------------------------------------------------
# ############################################################... |
#!/usr/bin/env python3
'''Test for DNSSEC additions and removals'''
from dnstest.utils import *
from dnstest.test import Test
CHANGE_COUNT = 9
def update_zone(master, slave, zone, changes, change_serial=False, serials=None):
for i in changes:
serial = master.zone_wait(zone)
master.update_zonefil... |
"""
What?
No.
What do you mean it escaped?
Yes.
Damnit Yes/No Buttom! TELL ME!
No.
ARRRRRRRRRRRGGGG
"""
import discord, asyncio
import random#, steam
import json, socket
#from steam import WebAPI, SteamID
from discord.ext import commands
import urllib, requests
class Player():
"""Preperation!"""
def __init__... |
# 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):
db.rename_table('ellacomments_commentoptionsobject', 'ella_comments_commentoptionsobject')
db.rename_table('ellacom... |
import numpy as np
import re
import itertools
from collections import Counter
import gensim
import pickle
import json
import os
import tensorflow as tf
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sentence/blob/m... |
try:
import __builtin__ as builtins
except ImportError:
import builtins
import mock
import pytest
import librarian.data.setup as mod
@mock.patch.object(mod.Setup, '_update_config')
@mock.patch.object(mod, 'json')
@mock.patch.object(builtins, 'open')
def test_append(open_fn, json, _update_config):
s = mo... |
# coding=utf-8
from __future__ import absolute_import, unicode_literals, division
from puls.models.manufacturers import Manufacturer, MultiManufacturerField
from puls.models.suppliers import Supplier
from puls.models.targets import Target
from puls.models.classes import Class, MultiClassField
from puls.models.photos im... |
# coding: utf8
import hashlib
import datetime
import os.path
import random
import logging
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import user_passes_test
... |
#!/usr/bin/python3
################################
# File Name: ShippingLogic.py
# Class: CS 360
# Assignment: Lecture Examples
# Purpose: The shipping calculator
################################
class ShippingLogic:
""" Standard shipping costs
A small table is build in the constructor
to encode what each shi... |
#!/usr/bin/env python3
import argparse
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('tiles', type=int, nargs=3)
parser.add_argument('-v', '--verbose', action='store_true')
args = parser.parse_args()
X = args.tiles[0]
Y = args.tiles[1]
Z = args.tiles[2]
quads = [1,2,3,4,5,6,7,8]
state = ... |
# -*- coding: utf-8 -*-
import unittest
from mock import Mock, patch, NonCallableMock
from flask import Flask
from flask import request as flask_request
from werkzeug import exceptions
from werkzeug.wrappers import Request
from flask_restful.reqparse import Argument, RequestParser, Namespace
import six
import json
cl... |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... |
from __future__ import with_statement
__version__ = '0.31'
__license__ = 'MIT'
import re
import os
import sys
import finalseg
import time
import tempfile
import marshal
from math import log
import random
import threading
from functools import wraps
DICTIONARY = "dict.txt"
DICT_LOCK = threading.RLock()
trie = None # t... |
# coding: utf-8
"""
Create a chemical structure-searchable database for use with Common Groups.
This script creates a chemical database with ~720,000 structures from the
U.S. Environmental Protection Agency's CompTox Dashboard public dataset.
Set up the database so that it can be used for substructure searching via ... |
"""Unit test for Zookeeper helper - testing zk connection and leader election.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import unittest
import kazoo
import kazoo.client
import mock
from treadmil... |
"""
dt2000.py
Copyright (C) 2015 Anthony Rogers <EMAIL>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later... |
from dateutil import parser
from datetime import datetime
from lxml import etree
class XmlUtils:
def __init__(self, element=None):
self.element = element
def get_string_by_xpath(self, xpath):
if self.element is None:
return None
result = self.element.xpath(xpath)
i... |
#!/usr/bin/env python
# All the imports
from __future__ import print_function, division
from math import *
import random
import sys
import matplotlib.pyplot as plt
# TODO 1: Enter your unity ID here
__author__ = "latimko"
class O:
"""
Basic Class which
- Helps dynamic updates
- Pretty Prints
... |
import difflib
import os
import string
import sys
from collections import namedtuple
from difflib import unified_diff
from functools import partial
from inspect import getargspec
from pydtsxplode import DtsxExploder, DtsxComponent
from xmlxplode import BOM_MAP
from xmlxplode.fs.inmem import InMemFs
from contextlib imp... |
# -*- coding: utf-8 -*-
from os.path import join, dirname
from setuptools import setup
README = open(join(dirname(__file__), 'README.rst')).read()
setup(
name='pyoneall',
version='0.2.3',
packages=['pyoneall'],
install_requires=['future'],
license='MIT License, see LICENSE file',
description='... |
import os
import sys
from setuptools import setup, find_packages
from shutil import rmtree
from cartridge import __version__ as version
exclude = ["cartridge/project_template/dev.db",
"cartridge/project_template/project_name/local_settings.py"]
if sys.argv == ["setup.py", "test"]:
exclude = []
exclude ... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from astropy.utils.exceptions import AstropyWarning
__all__ = ["TargetAlwaysUpWarning", "TargetNeverUpWarning",
"OldEarthOrientationDataWarning", "PlotWarning",
"PlotBelowHorizonWarning",... |
from __future__ import print_function
import argparse
import torch
from torch import nn, optim
from torch.autograd import Variable
from torch.nn import functional as F
from config import params, data
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(params... |
import attr
from cached_property import cached_property
from navmazing import NavigateToAttribute
from navmazing import NavigateToSibling
from widgetastic.widget import View
from cfme.common import PolicyProfileAssignable
from cfme.common import Taggable
from cfme.common import TaggableCollection
from cfme.common impo... |
import gc
import sys
import os
import shutil
import git
import argparse
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='cmd', title='commands')
cmd = subparsers.add_parser('list', description='list all castles and their git urls')
cmd = subpars... |
"""
gen menu page for testing
"""
import os
import hashlib
from mako.template import Template
from mako import exceptions
def gen_menu(conf, tables):
file_type = conf["file_type"]
template_type =conf["template_type"]
tpl_path = os.sep.join([conf["TPL_ROOT"], "web", "%s_mako.%s" % (template_t... |
__author__ = 'Tom Schaul, <EMAIL>'
import socket
from captureplayer import CapturePlayer
from pybrain.rl.environments.twoplayergames import CaptureGame
# TODO: allow partially forced random moves.
class ClientCapturePlayer(CapturePlayer):
""" A wrapper class for using external code to play the capture game,
... |
import mysql.connector
from mysql.connector import errorcode
from logger import Logger
class DBConnector:
"""
Provides a way for table managers to connect to the parent mysql database.
"""
def __init__(self, db_name='INTEGRITY_DB', host='localhost', port='3306'):
"""
Set... |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'virt.views.home.index', name="home"),
# Node
url(r'^node/$', 'virt.views.node.index', name="node_get"),
url(r'^node/add/$', 'virt.views.node.add', name="node_add"),
url(r'^node/(\d+)/$', 'virt.views.node.edit', name="node_edit"... |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class which(ShutItModule):
def is_installed(self, shutit):
return shutit.file_exists('/root/shutit_build/module_record/' + self.module_id + '/built')
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/which')
shutit.se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# BASED ON THE <EMAIL> script:
"""
# Try to determine how much RAM is currently being used per program.
# Note the per program, not per process. So for example this script
# will report mem used by all httpd process together. In detail it reports:
# sum(all RSS for process... |
# -*- coding: utf-8 -*-
import os
import time
import shutil
# import random
__author__ = 'gree-gorey'
def copy(path, path_to_write, folder_limit, limit):
i = 0
# собираем все папки разных ресурсов
sources = []
for root, dirs, files in os.walk(path):
for source in dirs:
sources.ap... |
def verbing(s):
if len(s) >= 3:
if s[-3:] == 'ing':
s = s + 'ly'
else:
s = s + 'ing'
return s
# E. not_bad
# Given a string, find the first appearance of the
# substring 'not' and 'bad'. If the 'bad' follows
# the 'not', replace the whole 'not'...'bad' substring
# with 'good'.
# Return the res... |
import os
import sys
# Add lib to PYTHONPATH
lib_path = os.path.join(os.path.dirname(__file__), 'lib')
if lib_path not in sys.path:
sys.path.append(lib_path)
from model.test import extract_regions_and_feats as _extract_regions_and_feats
from model.test import extract_imfea as _extract_imfea
from math import ceil
... |
from selenium.webdriver.common.keys import Keys
from base_page_object import BasePageObject
from compose_box import ComposeBox
class MailPage(BasePageObject):
def __init__(self, context, timeout=10):
self._locators = {
'encrypted_flag': '.security-status__label--encrypted',
'unencr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import socket
import datetime
import json
messages = {
"required": "{} is required",
"email": "{} must be a valid email",
"min": {
'string': "{} must be more than {} characters",
'numeric': "{} must be higher than {... |
"""
The classes in this module enable random access to a variety of file formats
(BAM, bigWig, bigBed, BED) using a uniform syntax, and allow you to compute
coverage across many features in parallel or just a single feature.
Using classes in the :mod:`metaseq.integration` and :mod:`metaseq.minibrowser`
modules, you ca... |
#
# Tests to Project Euler solutions
# Philippe Legault
#
# https://github.com/Bathlamos/Project-Euler-Solutions
import importlib, time
def main():
total_time = 0.0 # In seconds
for (prob, expect_ans) in sorted(ANSWERS.items()):
module = importlib.import_module("solutions.p{:03d}".format(prob))
start_time = ti... |
# coding=utf-8
from django_filters import (FilterSet,
ChoiceFilter,
ModelChoiceFilter,
)
from popular_proposal.models import PopularProposal
from elections.models import Area
from django.conf import settings
from constance import config... |
import unittest
from os.path import join, dirname, abspath
import matplotlib.pyplot as plt
import numpy as np
import pystella as ps
__author__ = 'bakl'
class TestStellaLightCurves(unittest.TestCase):
def test_stella_curves(self):
name = 'cat_R500_M15_Ni006_E12'
path = join(dirname(abspath(__fil... |
import zmq, json
import sys
# import socket
# import thread
from datetime import datetime
import library
import library.constants as CO
import library.utils.utils as UT
from library.server.SrvHandler import SrvHandler
class Logger:
def __init__(self,logger):
self.logger = logger
self.buff = ""
def write(self,... |
# -*- coding: utf-8 -*-
import requests
import urllib
import time
import xbmc, xbmcgui
from meta.utils.text import to_utf8
from meta.gui import dialogs
from meta import plugin
from settings import *
from language import get_string as _
TCI = plugin.get_setting(SETTING_TRAKT_API_CLIENT_ID, str)
TCS = plugin.get_setti... |
from cachetools import cached
from celery import Celery
from flask import Flask, request
from flask.ext.sslify import SSLify
from raven import Client
from raven.contrib.celery import register_signal, register_logger_signal
from apollo.core import babel, cache, db, mail, sentry
from apollo.helpers import register_bluep... |
import bpy
#Define vertices, faces, edges
verts = [(0,0,0),(0,5,0),(5,5,0),(5,0,0),(0,0,5),(0,5,5),(5,5,5),(5,0,5)]
faces = [(0,1,2,3), (7,6,5,4), (0,4,5,1), (1,5,6,2), (2,6,7,3), (3,7,4,0)]
#Define mesh and object
#mymesh = bpy.data.meshes.new("Cube")
#Create mesh
#mymesh.from_pydata(verts,[],faces)
#mymesh.update... |
import time
from telemetry.util import image_util
class InspectorPage(object):
"""Class that controls a page connected by an inspector_websocket.
This class provides utility methods for controlling a page connected by an
inspector_websocket. It does not perform any exception handling. All
inspector_websocke... |
from gi.repository import Gtk
import unittest
try:
import unittest.mock as mock
except ImportError:
import mock
import os
from pyqso.printer import *
class TestPrinter(unittest.TestCase):
""" The unit tests for the Printer class. """
def setUp(self):
""" Set up the Printer object. """
... |
import os, sys
import unittest
# the testing module helps us import the pre-installed geos
from testing import geos
# ===========================================================================
class WKTWriterTestCase(unittest.TestCase):
def testWritePoint(self):
"""dump a point to WKT"""
gf = g... |
import Tkinter
from Tkinter import *
from ScrolledText import *
import tkFileDialog
import tkMessageBox
root = Tkinter.Tk(className = 'Welcome to my first editor')
textPad = ScrolledText(root, width = 100 , height = 80)
def open_command():
file = tkFileDialog.askopenfile(parent = root, mode = 'rb', title = 'Select ... |
import wave
import sys
import os
def traverseThroughFolder(current_path):
files_and_folders = os.listdir(current_path);
for file in files_and_folders:
file_path = current_path + '/' + file;
if(os.path.isdir(file_path)):
traverseThroughFolder(file_path,time_csv,hr_csv_dir)
else:
splitAudi... |
class BasePiece(object):
rotation = 0
rotations = ()
offset_top = 0
offset_left = 0
square_size = 3
def __init__(self):
self.offset_left = 0
self.offset_top = 0
def _get_next_rotation(self):
rotation = self.rotation + 1
if rotation >= len(self.rotations):... |
"""Test the for the BMW Connected Drive config flow."""
from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.bmw_connected_drive.config_flow import DOMAIN
from homeassistant.components.bmw_connected_drive.const import (
CONF_READ_ONLY,
CONF_USE... |
"""
Copyright (C) 2017 Quinn D Granfor <<EMAIL>>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT AN... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file ostap/tools/tests/test_tools_chopping.py
# Test for TMVA ``chopping''(k-fold cross-validation) machinery
# @author Vanya BELYAEV <EMAIL>
# @date 2015-10-25
# =======================... |
# -*- encoding: utf-8 -*-
import io
import steadycache
from os.path import dirname
from os.path import join
from setuptools import setup
def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
).read()
setup(
name="steadycache",... |
#!/usr/bin/python
## Massimiliano Patacchiola, Plymouth University 2016
#
# This code uses Self-Organizing Map (SOM) to classify different poses (pan, tilt) of a humanoid robot (NAO).
# It is possible to use a real ROBOT or a simulated one to visualise the Head movements in real time.
# For each epoch it is possible t... |
__all__ = [ ]
import sys
if sys.hexversion < 0x2050000:
sys.stderr.write('[SKIPPED] at least Python 2.5 is required\n')
# note: exiting is a bit harsh for a library module, but we really do
# require Python 2.5. this package isn't going to work otherwise.
# we're skipping this test, not failing, so exit with... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.