content string |
|---|
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^viewtrn/(?P<trnshort>.+)$', viewtrn),
url(r'^managetrn$', managetrn),
url(r'^manageswar$', manageswar),
url(r'^api/tournament$', tournament_all),
url(r'^api/tournament/(?P<id_trn>[0-9]+)$', tournament_one),
url(r'^api/... |
neuron_list = [['Large','CTT3219F'],
['Large','LWS9287A'],
['Large','LWS9287Q'],
['Large','LWS9287R'],
['MediumComplex','CTT1209A'],
['MediumComplex','CTT3219B'],
['MediumComplex','CTT3219G'],
['MediumComplex','CTT3... |
import hashlib
import markup.csstester as testendpoint_css
import markup.markuptester as testendpoint_markup
import scripting as testendpoint_js
from . import register_test
from .. import unicodehelper
from ..constants import *
FLAGGED_FILES = set([".DS_Store", "Thumbs.db", "desktop.ini",
"_vti_... |
# -*- coding: utf-8 -*-
# imports
import subprocess
import sys
import re
# mtsh class
class mtsh:
# main constructor
def __init__ (self, servers):
# initialze the server list
self.servers = servers
# validate ourselves
self.validate()
# validate passed info
# meant to... |
"""Test non-minimization recognition"""
import urllib
from nose.tools import eq_
from routes import url_for
from routes.mapper import Mapper
def test_basic():
m = Mapper(explicit=False)
m.minimization = False
m.connect('/:controller/:action/:id')
m.create_regs(['content'])
# Recognize
e... |
#!/usr/bin/python
import os
import stat
import shutil
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--testdir', dest = 'test_dir',
required = False, default = '')
parser.add_argument('--jobs', dest = 'jobs', required = False, default = 1)
parser.add_argu... |
# -*- coding: utf-8 -*-
'''
:copyright: (c) 2015 by Allenta Consulting S.L. <<EMAIL>>.
:license: BSD, see LICENSE.txt for more details.
'''
from __future__ import absolute_import
import logging
from abc import ABCMeta
from django.contrib import auth, messages
from django.contrib.auth.decorators import login_required
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
from htext.ja import kana
DATA = [
("コーリャ", "こーりゃ"),
("アレクセイ・カラマーゾフ", "あれくせい・からまーぞふ"),
]
def test_invalid():
def func(input, expected):
output = kana.to_hiragana(input)
assert isinstance(output, six.text_type) and... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from doct import Document
from jsonschema import validate as js_validate
from bson import ObjectId
from .core import DatumNotFound
import os.path
def doc_or_oid_to_oid(doc_or_oid):
try:
... |
"""Utilities to compute saliency for a TF1 model using the occlusion method."""
from .base import TF1CoreSaliency
from ..core import occlusion as core_occlusion
class Occlusion(TF1CoreSaliency):
r"""A TF1CoreSaleincy class that computes saliency masks using occlusion."""
def __init__(self, graph, session, y, x):... |
"""
The script tests the Littlewood-Richardson homotopies on some
relatively big problem in G(4,8). The ten problems were formulated
by Frank Sottile at an AIM squares meeting in the Fall of 2015.
(0) [3 6 7 8]^7*[4 6 7 8]^2 = 231
(1) [2 5 6 8]*[3 6 7 8]*[4 5 7 8]*[4 6 7 8]^7 = 294
(2) [2 4 7 8]*[3 6 7 8]^2*[4 6 7 8]^... |
# coding: utf-8
from leancloud import Object
from leancloud import User
from leancloud import Query
from leancloud import ACL
from leancloud import LeanCloudError
from flask import Blueprint
from flask import request
from flask import redirect
from flask import url_for
from flask import render_template
from flask impo... |
# local Django
from pom.pages.basePage import BasePage
from pom.locators.shiftDetailsPageLocators import ShiftDetailsPageLocators
from pom.pages.eventsPage import EventsPage
from pom.pageUrls import PageUrls
class ShiftDetailsPage(BasePage):
shift_list_page = PageUrls.shift_list_page
live_server_url = ''
... |
import logging
from scap.Model import Model
logger = logging.getLogger(__name__)
class FileBehaviors(Model):
MODEL_MAP = {
'attributes': {
'max_depth': {'type': 'Integer', 'default': -1},
'recurse_direction': {'enum': ['none', 'up', 'down'], 'default': 'none'},
'recurs... |
from qtpy.QtWidgets import (QMainWindow, QWidget, QSpacerItem, QLabel, QHBoxLayout, QVBoxLayout, QApplication,
QSizePolicy)
from qtpy import QtCore
# from pyqtgraph.dockarea import *
import pyqtgraph as pg
import numpy as np
# from ibeatles.interfaces.ui_binningWindow import Ui_MainWindow ... |
"""GNR Compute Node"""
import cPickle as pickle
import logging
import sys
import uuid
import click
import jsonpickle
from gnr.renderingenvironment import BlenderEnvironment, \
LuxRenderEnvironment
from gnr.task.blenderrendertask import BlenderRenderTaskBuilder
from gnr.task.luxrendertask import LuxRenderTaskBuil... |
#! /usr/bin/env python
from __future__ import print_function
"""
This project is about developing a dynamic CMD class based on cmd.CMD.
We assume the following directory structure::
./shell.py
./plugins/foo.py
./plugins/bar.py
./plugins/activate.py
We have provided examples of the classes in this document
fo... |
"""Channels models"""
from uuid import uuid4
import base36
from bitfield import BitField
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.po... |
from time import sleep
from random import shuffle
from datetime import timedelta
from ciso8601 import parse_datetime_as_naive
from requests.exceptions import RequestException
from django.contrib.gis.geos import Point, Polygon
from django.contrib.gis.db.models import Extent
from django.utils import timezone
from busstop... |
import unittest
from datetime import datetime, timedelta
from random import randint
from flask_bcrypt import Bcrypt
import os
from webtest import TestApp
from dataactcore.logging import configure_logging
from dataactvalidator.health_check import create_app
from dataactcore.interfaces.db import GlobalDB
from dataactco... |
'''
This program sets up the sentence input files to the HDF5 converter from S2S from VEN
Uses splits from split_dir
Uses individual annotations from ann_path
Writes out sents_split_lc_nopunc.txt annotation files ready for HDF5 conversion
'''
import numpy as np
import json
import os
import math
from os import listdi... |
"""A linter for docstrings following the google docstring format."""
import ast
from collections import deque
import sys
from enum import Enum
from typing import (
Callable,
Iterator,
List,
Set,
Tuple,
Optional,
Union,
Type,
Any,
)
from .analysis.analysis_visitor import (
Analys... |
import pytest
from spack.main import SpackCommand
providers = SpackCommand('providers')
@pytest.mark.parametrize('pkg', [
('mpi',),
('mpi@2',),
('mpi', 'lapack'),
('',) # Lists all the available virtual packages
])
def test_it_just_runs(pkg):
providers(*pkg)
@pytest.mark.parametrize('vpkg,pro... |
from itertools import dropwhile
from itertools import takewhile
from django import template
from django.template.loader import select_template
from django_mc.utils.functional import flatten
register = template.Library()
class HintedIncludeNode(template.Node):
"""
Syntax::
{% hinted_include <templa... |
# functions that are important for the general usage of TARDIS
def run_tardis(
config,
atom_data=None,
packet_source=None,
simulation_callbacks=[],
virtual_packet_logging=False,
log_state=None,
specific=None,
):
"""
This function is one of the core functions to run TARDIS from a gi... |
from collections import OrderedDict
from typing import Dict, Type
from .base import BigtableTableAdminTransport
from .grpc import BigtableTableAdminGrpcTransport
from .grpc_asyncio import BigtableTableAdminGrpcAsyncIOTransport
# Compile a registry of transports.
_transport_registry = OrderedDict() # type: Dict[str,... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from future.utils import python_2_unicode_compatible
import logging
import textwrap
import requests
from copy import deepcopy
from functools import lru_cache
from protmapper.api import ProtMapper, default_site_map
fr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import transaction
from rest_framework import status
from rest_framework.generics import GenericAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.renderers impor... |
# -*- coding: utf-8 -*-
"""
Apple strings file handler/compiler
"""
from __future__ import absolute_import
import codecs, os, re, chardet
from transifex.txcommon.log import logger
from transifex.resources.models import SourceEntity, Template
from transifex.resources.formats.utils.decorators import *
from transifex.re... |
"""Tests for functions inside import_helper module.
"""
import unittest
import copy
import random
from ggrc import app # noqa - this is neede for imports to work
from ggrc.converters import import_helper
class TestSplitArry(unittest.TestCase):
"""Class for testing the split array function
"""
def test_sigle... |
from floatdelegate import FloatDelegate
class CurrencyDelegate(FloatDelegate):
"""Custom delegate for currency values"""
pass |
import getpass
import logging
import requests
from prompt_toolkit import prompt
from prompt_toolkit.history import InMemoryHistory
logger = logging.getLogger(__name__)
history = InMemoryHistory()
# class PyborgCommandSuggest(AutoSuggest):
# "NB: for pt v2"
# def __init__(self):
# super(PyborgCommandS... |
#!/usr/bin/env python3.3
# sudo apt-get instal libpcre3-dev libaio-dev zlib1g-dev
# sudo apt-get install imagemagick libmagickcore4 libmagickwand-dev libmagickwand4
# curl -o magick.lua https://raw.github.com/leafo/magick/e58a0b3becfac35bfbbff5fca71af119fbdd1474/magick/init.lua
try:
from urllib.parse import urlpar... |
import bpy
from bpy.props import FloatVectorProperty, BoolProperty, IntProperty, FloatProperty, FloatVectorProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import (zip_long_repeat, updateNode)
from sverchok.utils.pulga_physics_modular_core import SvVortexForce
class SvPulgaVor... |
import pandas as pd
import os
import subprocess as sub
import re
import sys
from Bio import SeqUtils
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from scipy import stats as st
import matplotlib as mpl
#
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica'... |
import subprocess
from jimmy.lib.api import BaseGroovyModule
class Gerrit(BaseGroovyModule):
source_tree_path = 'jenkins.gerrit'
def update_dest(self, source, jenkins_url, jenkins_cli_path, **kwargs):
data = self._tree_read(source, self.source_tree_path)
servers = data["servers"]
for ... |
from unittest import TestCase
import parameters as pars
class ParameterTests(TestCase):
def setUp(self):
self.test_journal = 'APJ'
self.test_num_articles = "10" # input from web app is via a form, so is a string
def test_input_validation_fails_for_wrong_journal(self):
value = pars.valid("mnras", self.tes... |
"""Let's Encrypt client API."""
import logging
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
import OpenSSL
import zope.component
from acme import client as acme_client
from acme import jose
from acme import messages
from letsencrypt impo... |
from keystoneclient import exceptions as ksexception
import mock
from ironic.common import exception
from ironic.common import keystone
from ironic.tests import base
class FakeCatalog:
def url_for(self, **kwargs):
return 'fake-url'
class FakeClient:
def __init__(self, **kwargs):
self.servic... |
# -*- coding: utf-8 -*-
import sys
import time
import logging
import multiprocessing
import gearman
from django.core.management.base import BaseCommand
import django_gearman_commands.settings as dgc_settings
log = logging.getLogger(__name__)
class HookedGearmanWorker(gearman.GearmanWorker):
"""GearmanWorker w... |
import os
import sys
from flask import render_template
# load a bunch of environment
DEBUG = os.getenv('DEBUG') in ['True', 'true', '1', 'yes']
if DEBUG:
SQLALCHEMY_ECHO = True
TESTING = os.getenv('TESTING') in ['True', 'true', '1', 'yes']
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI') or os.gete... |
import logging
from flask import jsonify, request
import flask_login
import os
from server import app
from server.util.request import api_error_handler
from server.auth import user_mediacloud_client
from server.util.request import form_fields_required
import server.views.topics.apicache as apicache
from server.views.p... |
import os
import sys
import rulediff
import traceback
from common import *
def run_cpython(test):
return launch(cpython_executable, test)
def run_ipython(test):
return launch(ipython_executable, test)
def get_sbs_tests():
not_run_tests = [ ]
if sys.implementation.name == "ironpython":
... |
import numpy as np
import pandas as pd
class QLearningTable:
def __init__(self, actions, learning_rate=0.01, reward_decay=0.9, e_greedy=0.9):
self.actions = actions # a list
self.lr = learning_rate
self.gamma = reward_decay
self.epsilon = e_greedy
self.q_table = pd.DataFra... |
#!/usr/bin/env python
#encoding: utf-8
import sys
from pprint import pprint
class Limit():
def __init__(self, warn_lvl='', crit_lvl='',
cmp_func=None,
min_value='', max_value='',
uom=''):
self.warn_lvl = warn_lvl
self.crit_lvl = crit_lvl
... |
# encoding: utf-8
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
from Frame import Frame
class AspectFrame(Frame):
"""
Obje... |
"""delete signature summaries
Revision ID: 07c6633fa1b6
Revises: afc2f95a298b
Create Date: 2017-08-31 17:33:19.969807
"""
from alembic import op
from socorro.lib.migrations import load_stored_proc
# revision identifiers, used by Alembic.
revision = '07c6633fa1b6'
down_revision = 'afc2f95a298b'
def upgrade():
#... |
from django.db import models
from django.core.validators import MinLengthValidator
from django.utils.translation import ugettext_lazy as _
class AgencyTypeESIA(models.CharField):
description = 'AgencyTypeESIA'
DEFAULT_MAX_LENGTH = DEFAULT_MIN_LENGTH = 6
FEDERAL_EXECUTIVE = '10.FED'
STATE_OFF_BUDGET_F... |
from __future__ import division,print_function,unicode_literals
import os
from sys import stdin,stdout,stderr
import argparse
import hashlib
import subprocess
import json,codecs
try:
from urllib.request import Request,urlopen
except:
from urllib2 import Request,urlopen
# External tools (can be overridden using... |
from __future__ import with_statement
import optparse
import os.path
import shutil
import subprocess
import sys
import time
import traceback
ARCH_MAP = {
'32': {
'gyp_arch': 'ia32',
'scons_platform': 'x86-32',
},
'64': {
'gyp_arch': 'x64',
'scons_platform': 'x86-64',
... |
from abc import ABCMeta, abstractmethod
import numpy.random as rd
from complexism.element import Event, StepTicker
from ..modifier import GloRateModifier, LocRateModifier, BuffModifier, NerfModifier
from .behaviour import PassiveModBehaviour, ActiveModBehaviour
from .trigger import StateTrigger
__author__ = 'TimeWz667'... |
from flask import Flask, jsonify
import ConfigParser
import os
import random
import json
app = Flask(__name__)
mock_location_file = 'mock_locations.json'
#--------------------Flask APp starts here-------------------------------
@app.route("/nuage/api/v5_0/enterprises/<enterpriseId>/gatewayslocations", methods=['GET'... |
import renpy.display
import contextlib
import time
def color(c):
"""
This function returns a color tuple, from a hexcode string or a
color tuple.
"""
if isinstance(c, tuple) and len(c) == 4:
return c
if c is None:
return c
if isinstance(c, basestring):
if c[0] == ... |
import struct
import i2cMock
from i2cMock import I2CDevice
from threading import Timer
from utils import call
class Payload(I2CDevice):
def __init__(self, gpio_driver, pin):
super(Payload, self).__init__(0b0110000, "Payload")
self.interrupt_pin = pin
self.gpioDriver = gpio_dri... |
import network
import machine
import ssd1306
import utime
import gc
gc.enable()
"""import network,machine, ssd1306,utime."""
class DisplayWifi:
def __init__(self,pin1='5',pin2='4'):
"""initialize the function with the pins 5,4 if you don't choice else
fill pin,pin in when calling the function.
... |
import mock
import testtools
from sahara import exceptions as ex
from sahara.service.validations import clusters as c_val
from sahara.tests.unit.service.validation import utils as u
from sahara.tests.unit import testutils as tu
class TestClusterDeleteValidation(u.ValidationTestCase):
def setUp(self):
sup... |
import platform
import sys
import os
from spack import *
import llnl.util.tty as tty
class Namd(MakefilePackage, CudaPackage):
"""NAMDis a parallel molecular dynamics code designed for
high-performance simulation of large biomolecular systems."""
homepage = "http://www.ks.uiuc.edu/Research/namd/"
url... |
"""
Django settings for autoerp project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
#... |
"""
Check whether Basket is accessible and working.
If everything's okay, prints a message and exits with success status.
If not, prints a message and exits with failure status.
"""
from django.core.management.base import BaseCommand, CommandError
from basket import BasketException, lookup_user
from basket.errors impo... |
"""Add namespaced groups
Revision ID: 29c20e85e5fe
Revises: 236df7dfaf3d
Create Date: 2015-06-22 18:01:04.749508
"""
# revision identifiers, used by Alembic.
revision = '29c20e85e5fe'
down_revision = '236df7dfaf3d'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Al... |
"""Beautiful Soup bonus library: Unicode, Dammit
This class forces XML data into a standard format (usually to UTF-8 or
Unicode). It is heavily based on code from Mark Pilgrim's Universal
Feed Parser. It does not rewrite the XML or HTML to reflect a new
encoding; that's the tree builder's job.
"""
import codecs
from... |
from typing import Union, Tuple
class SizeConvert:
SUFFIXES = 'KMGTPEZY'
BIN_BASE = 10 ** 3
BIN = 'B'
I_BIN_BASE = 2 ** 10
I_BIN = 'iB'
_binary: str
_base: int
def __init__(self, binary: bool = True):
self.set_binary(binary)
def set_binary(self, binary: bool):
if ... |
class ProviderInterface(object):
"""
Base Interface for GittiGidiyor RESTLIKE API.
Every service provider must implement this interface. Services can be anonymous
or community services. Services that implements this interface are;\n
* Application service
* Category service
* City s... |
from datetime import datetime
from validr import T
from . import case
@case({
T.datetime: [
(datetime(2016, 7, 9), '2016-07-09T00:00:00.000000Z'),
(datetime(2016, 7, 9, 14, 47, 30, 123), '2016-07-09T14:47:30.000123Z'),
('2016-07-09T00:00:00.000000Z', '2016-07-09T00:00:00.000000Z'),
... |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_noop, ugettext as _
from djangular.views.mixins import JSONResponseMixin, allow_remote_invocation
from corehq import privileges
from corehq.apps.app_manager.models import Application
... |
from msrest.serialization import Model
class Product(Model):
"""
The product documentation.
"""
_required = []
_attribute_map = {
'display_names': {'key': 'display_names', 'type': '[str]'},
'capacity': {'key': 'capacity', 'type': 'int'},
'image': {'key': 'image', 'type': ... |
import os
from pkg_resources import Requirement, resource_filename
def _get_abs_path(fname):
return resource_filename(Requirement.parse('HlaTools'),'/pbhla/data/%s' % fname)
def get_genomic_fasta():
return _get_abs_path('genomic.fasta')
def get_cDNA_fasta():
return _get_abs_path('cDNA.fasta')
def get_ex... |
import numpy as np
import shm
from auv_math.quat import Quaternion
from auv_python_helpers.angles import abs_heading_sub_degrees
from conf.vehicle import cameras
def get_camera(results_group):
direction = results_group.camera.decode('utf-8')
if direction not in cameras:
# TODO Maybe exceptions are be... |
"""Command to activate named configuration."""
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.config import completers
from googlecloudsdk.core import log
from googlecloudsdk.core import named_configs
class Activate(base.SilentCommand):
"""Activates an existing named configuration."""
... |
"""Default configuration values."""
from __future__ import absolute_import, print_function
ACCESSREQUESTS_CONFIRMLINK_EXPIRES_IN = 5*24*60*60
"""Number of seconds after the email confirmation link expires."""
ACCESSREQUESTS_RECORDS_UI_ENDPOINTS = dict(
recid_access_request=dict(
pid_type='recid',
... |
import os
import sys
from colorlog import ColoredFormatter
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(BASE_DIR, "apps"))
ALLOWED_HOSTS = ['*',]
SITE_ID = 1
INSTALLED_APPS = (
'django.contrib.admin',
'djan... |
from application_configuration import *
import re
from script_settings import *
__author__ = '<EMAIL>'
# Settings
STRING_FILE_INFO_REGEX_FORMAT = 'VALUE\s+"%s"\s*,\s+(.+)'
COPYRIGHT_REGEX = STRING_FILE_INFO_REGEX_FORMAT % ("LegalCopyright")
PRODUCT_NAME_REGEX = STRING_FILE_INFO_REGEX_FORMAT % ("ProductName")
COMPANY_NA... |
#!python
import re
# classe que define como as expressoes regulares serao usadas
class Regex(object):
# cria um regex que da match se o texto comeca ou contem a
# palavra begin
@staticmethod
def createBeginWith(begin):
return r'(^[ \t]*|(?<=[\r\n])[ \t]*)%(begin)s\b' % {'begin': begin}
# return r'^[%(begi... |
# Standard imports
import unittest
import json
import logging
from datetime import datetime, timedelta
# Our imports
from emission.core.get_database import get_db, get_mode_db, get_section_db
from emission.core.wrapper.user import User
import emission.tests.common
from emission.clients.data import data
logging.basicC... |
# -*- encoding: utf-8 -*-
from typing import List
from dominate.tags import html_tag
from scriptorium.elementor import AbstractElement, GenericElement
from dominate import tags
class Paragraph(AbstractElement):
def build(self):
ele = self.tag('p')
self.transfer(ele)
return ele
class Item... |
#!/usr/bin/env python
import roslib
import sys
import rospy
import numpy as np
from uav_utils import ThermalRise
from mathutils import saturation, quat2Reb
from math import floor
from last_letter.msg import SimStates, SimSensor, Environment
####################### Altimeter Class ###################################... |
import logging
log = logging.getLogger(__name__)
from rhombus.lib.utils import cerr, cout
from rhombus.views.generics import error_page
from genaf.views import *
import json
import sqlalchemy.exc, transaction
@roles( PUBLIC )
def index(request):
dbh = get_dbhandler()
q = dbh.Sample.query(dbh.session()).... |
#!/usr/bin/env python
'Unit test for trepan.processor.command.pdef'
import unittest
from trepan import debugger
from trepan.processor.command import pdef as Mp
class TestPDef(unittest.TestCase):
"""Tests PCommand class"""
def setUp(self):
self.errors = []
self.msgs = []
return
d... |
"""
Use futures to waste CPU cycles in parallel.
example:
python3 parallel.py -r -m 100 -n 1000000
"""
import click
import random
from concurrent import futures
from stats import mean, sd
def identity(x):
return x
def from_a_hundred_to(n):
return random.randint(100,n)
def sample_stats(n):
"""
Co... |
#!/usr/bin/env python
from __future__ import division
import numpy, math, warnings
from cogent.maths.scipy_optimize import fmin_bfgs, fmin_powell, fmin, brent
__author__ = "Peter Maxwell and Gavin Huttley"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Peter Maxwell", "Gavin Huttley"]
__lic... |
import pytest
from tests.lib import _create_test_package, path_to_url
from tests.lib.direct_url import get_created_direct_url
def test_install_find_links_no_direct_url(script, with_wheel):
result = script.pip_install_local("simple")
assert not get_created_direct_url(result, "simple")
def test_install_vcs_e... |
from msrest.serialization import Model
class RegenerateCredentialParameters(Model):
"""The parameters used to regenerate the login credential.
:param name: Specifies name of the password which should be regenerated --
password or password2. Possible values include: 'password', 'password2'
:type name... |
from dlrn.db import Commit
from dlrn.drivers.pkginfo import PkgInfoDriver
from dlrn.repositories import getdistrobranch
from dlrn.repositories import getsourcebranch
from dlrn.repositories import refreshrepo
from dlrn.utils import run_external_preprocess
import logging
import os
import sh
from distroinfo import query... |
#!/usr/bin/env python
import vtk
import numpy as np
from vmtk import vmtkscripts
import argparse
import copy
# create an interactor test on a surface
def pick_points(args):
print("pick stuff")
reader = vmtkscripts.vmtkSurfaceReader()
reader.InputFileName = args.surface
reader.Execute()
Surfac... |
import unittest
from game.gameboard import GameBoard
from game.gamemanager import GameManager
class MyTestCase(unittest.TestCase):
def test_initialize(self):
game = GameManager()
game.initialize()
board = game.getBoard()
# Test to see if we have the case of 2 numbers that are either 2 or 4
self.assertTrue... |
#------------------------------------------------------------------------------
# Get similar image/print swatches in the catalog for a user uploaded image.
# POST /v1/catalog/{catalog_name}/print_search
# params - print_count,image_max_dimension,max_number_of_results
#--------------------------------------------------... |
import gtk
import gtk.gdk
import code
import sys
import pango
import __builtin__
import __main__
import debug
banner = """GTK Interactive Python Console
%s
""" % sys.version
class Completer:
"""
Taken from rlcompleter, with readline references stripped, and a local dictionary to use.
"""
def __init__(self, ... |
from flask.ext.wtf import Form
from wtforms import RadioField
from wtforms.fields.html5 import TelField
from wtforms.validators import Required
from wtformsparsleyjs import (StringField, PasswordField, BooleanField,
SelectField)
class LoginForm(Form):
username = StringField('Username... |
__all__ = [
"BaseRegistry",
"PacketRegistry",
]
import threading
try:
import bidict
except ImportError:
HAVE_BIDICT = False
else:
HAVE_BIDICT = True
from . import packet
class BaseRegistry(object):
"""
Basic registry class.
Supports smart conversions between the integer, str... |
# Python
import pytest
import mock
# DRF
from rest_framework import status
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied
# AWX
from awx.api.generics import (
ParentMixin,
SubListCreateAttachDetachAPIView, SubListAttachDetachAPIView,
DeleteLastUnattachL... |
from Arlo import Arlo
from datetime import timedelta, date
import datetime
import sys
def writeVideoFile(arlo, recording, videofilename):
""" Get video as a chunked stream; this function returns a generator. """
stream = arlo.StreamRecording(recording['presignedContentUrl'])
with open(videofilename, 'wb') ... |
from gevent import monkey
monkey.patch_all()
from collections import defaultdict
from datetime import datetime
import functools
from mongoom import connect, Subscriber, Event, fire, Document, Field
from pprint import pprint
from random import choice
from time import sleep
from threading import Thread
class Asset(Docu... |
from django.utils.translation import ugettext_lazy as _
from weblate.trans.checks.base import TargetCheck, CountingCheck
class BeginNewlineCheck(TargetCheck):
'''
Checks for newlines at beginning.
'''
check_id = 'begin_newline'
name = _('Starting newline')
description = _('Source and translati... |
"""
Player
The player class is an extension of the default Django user class,
and is customized for the needs of Evennia.
We use the Player to store a more mud-friendly style of permission
system as well as to allow the admin more flexibility by storing
attributes on the Player. Within the game we should normally us... |
from sympy.mpmath import *
from sympy.mpmath.calculus.optimization import Secant, Muller, Bisection, Illinois, \
Pegasus, Anderson, Ridder, ANewton, Newton, MNewton, MDNewton
def test_findroot():
# old tests, assuming secant
mp.dps = 15
assert findroot(lambda x: 4*x-3, mpf(5)).ae(0.75)
assert findr... |
#############################################################################
#
# Pyro Utilities
#
# This is part of "Pyro" - Python Remote Objects
# which is (c) Irmen de Jong - <EMAIL>
#
#############################################################################
from __future__ import with_statement
import os, sys... |
import os
import platform
import signal
import subprocess
import sys
import mozinfo
import mozleak
from mozprocess import ProcessHandler
from mozprofile import FirefoxProfile, Preferences
from mozprofile.permissions import ServerLocations
from mozrunner import FirefoxRunner
from mozrunner.utils import get_stack_fixer_... |
import math
import IECore
import Gaffer
import GafferUI
QtCore = GafferUI._qtImport( "QtCore" )
QtGui = GafferUI._qtImport( "QtGui" )
## The Slider class allows a user to specify a number of positions on a scale of 0.0 at one end
# of the Widget and 1.0 at the other. Positions off the ends of the widget are mapped
... |
# -*- coding: utf-8 -*-
"""
HTCAP - htcap.org
Author: <EMAIL>
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 2 of the License, or (at your option) any later
version.
"""
import sys... |
import os
import sys
import unittest
from itertools import dropwhile
from urwid import vterm
from urwid.main_loop import SelectEventLoop
from urwid import signals
from urwid.compat import B, PYTHON3
class DummyCommand(object):
QUITSTRING = B('|||quit|||')
def __init__(self):
self.reader, self.writer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.