path
stringlengths
23
146
source_code
stringlengths
0
261k
data/adamlwgriffiths/Pyrr/pyrr/objects/quaternion.py
"""Represents a Quaternion rotation. The Quaternion class provides a number of convenient functions and conversions. :: import numpy as np from pyrr import Quaternion, Matrix33, Matrix44, Vector3, Vector4 q = Quaternion() q = Quaternion.from_x_rotation(np.pi / 2.0) q = Quaternion.from_matri...
data/OpenMDAO/OpenMDAO/openmdao/recorders/sqlite_recorder.py
"""Class definition for SqliteRecorder, which provides dictionary backed by SQLite""" from collections import OrderedDict from sqlitedict import SqliteDict from openmdao.recorders.base_recorder import BaseRecorder from openmdao.util.record_util import format_iteration_coordinate from openmdao.core.mpi_wrap import MPI...
data/Parsely/streamparse/examples/redis/src/spouts.py
from itertools import cycle from streamparse import Spout class WordSpout(Spout): outputs = ['word'] def initialize(self, stormconf, context): self.words = cycle(['dog', 'cat', 'zebra', 'elephant']) def next_tuple(self): word = next(self.words) self.emit([word])
data/Netflix/brutal/brutal/core/constants.py
OFF = 0 ON = 1 DISCONNECTED = 20 CONNECTED = 30 DEFAULT_EVENT_VERSION = 1 DEFAULT_ACTION_VERSION = 1
data/ReactiveX/RxPY/rx/disposables/singleassignmentdisposable.py
from .booleandisposable import BooleanDisposable class SingleAssignmentDisposable(BooleanDisposable): """Represents a disposable resource which only allows a single assignment of its underlying disposable resource. If an underlying disposable resource has already been set, future attempts to set the unde...
data/Julian/Condent/setup.py
from distutils.core import setup from condent import __version__ with open("README.rst") as readme: long_description = readme.read() classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independen...
data/JoelBender/bacpypes/samples/ReadWriteFile.py
""" ReadWriteFile.py This application presents a 'console' prompt to the user asking for commands. The 'readrecord' and 'writerecord' commands are used with record oriented files, and the 'readstream' and 'writestream' commands are used with stream oriented files. """ import sys from bacpypes.debugging import bacp...
data/IEEERobotics/bot/bot/interface/cli.py
"""Send commands to the bot through a CLI interface.""" import cmd import sys import os import bot.client.ctrl_client as ctrl_client_mod import bot.client.sub_client as sub_client_mod class CLI(cmd.Cmd): """CLI for interacting with the bot. Note that the architecture is that interfaces, like the Command ...
data/boto/boto/tests/integration/iam/__init__.py
data/ODM2/ODMToolsPython/odmtools/controller/frmAbout.py
__author__ = 'Stephanie' import wx from wx import AboutBox, AboutDialogInfo, ClientDC from wx.lib.wordwrap import wordwrap from odmtools.meta import data class frmAbout(wx.Dialog): def __init__(self, parent): self.parent = parent info = AboutDialogInfo() info.Name = data.app_name in...
data/MarkusH/django-dynamic-forms/dynamic_forms/migrations/0004_formmodel_recipient_email.py
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dynamic_forms', '0003_auto_20140916_1433'), ] operations = [ migrations.AddField( model_name='formmodel', name='recipient_em...
data/HewlettPackard/python-hpOneView/examples/scripts/define-profile-template.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from builtins import range from future import standard_library standard_library.install_aliases() import sys PYTHON_VERSION = sys.version_info[:3] PY2 = (PYTHON_VERSION[0...
data/OfflineIMAP/imapfw/imapfw/mmp/folder.py
from imapfw import runtime from .manager import Manager class FolderManager(Manager): def __init__(self): super(FolderManager, self).__init__() self.rascal = runtime.rascal
data/LibraryOfCongress/chronam/core/management/commands/index_pages.py
from django.core.management.base import BaseCommand from chronam.core.management.commands import configure_logging from chronam.core.index import index_pages configure_logging("index_pages_logging.config", "index_pages.log") class Command(BaseCommand): def handle(self, **options): index_pages()
data/WDR/WDR/lib/tests/wdrtest/manifest.py
import unittest import string import wdr from wdr.app import * from wdr.config import * from wdr.control import * from wdr.manifest import * from wdr.util import * from wdrtest.topology import topology ( AdminApp, AdminConfig, AdminControl, AdminTask, Help ) = wdr.WsadminObjects().getObjects() class Abstrac...
data/JamesPHoughton/pysd/tests/test-models-master/tests/exp/test_exp.py
from __future__ import division import numpy as np from pysd import functions def time(): return _t def flowa(): """ Type: Flow or Auxiliary """ return 0.1 def stocka(): return _state['stocka'] def _stocka_init(): return -5 def _dstocka_dt(): return flowa() def test_exp():...
data/Yelp/git-code-debt/git_code_debt/repo_parser.py
from __future__ import absolute_import from __future__ import unicode_literals import collections import contextlib import shutil import subprocess import tempfile from git_code_debt.util.iter import chunk_iter from git_code_debt.util.subprocess import cmd_output Commit = collections.namedtuple('Commit', ['sha', 'd...
data/WoLpH/python-statsd/statsd/client.py
import logging import statsd from . import compat class Client(object): '''Statsd Client Object :keyword name: The name for this client :type name: str :keyword connection: The connection to use, will be automatically created if not given :type connection: :class:`~statsd.connection.Conn...
data/QingdaoU/OnlineJudge/judge/spj_client.py
import os import judger WA = 1 AC = 0 SPJ_ERROR = -1 def file_exists(path): return os.path.exists(path) def spj(path, max_cpu_time, max_memory, in_path, user_out_path): if file_exists(in_path) and file_exists(user_out_path): result = judger.run(path=path, in_file=in_path, out_file="/tmp/spj.out", ...
data/KristianOellegaard/django-hvad/hvad/tests/query.py
import django from django.db import connection from django.db.models import Count from django.db.models.query_utils import Q from django.utils import translation from hvad.test_utils.data import NORMAL, STANDARD from hvad.test_utils.testcase import HvadTestCase, minimumDjangoVersion from hvad.test_utils.project.app.mod...
data/Juniper/py-junos-eznc/tests/functional/test_device_ssh.py
''' @author: rsherman ''' import unittest from nose.plugins.attrib import attr from jnpr.junos import Device @attr('functional') class TestDeviceSsh(unittest.TestCase): def tearDown(self): self.dev.close() def test_device_open_default_key(self): self.dev = Device('pabst.englab.juniper.net'...
data/adamlwgriffiths/PyGLy/pygly/examples/renderable_textured_quad.py
import textwrap import numpy from OpenGL import GL from pygly.shader import Shader, VertexShader, FragmentShader, ShaderProgram from pygly.vertex_buffer import VertexBuffer, BufferAttributes, GenericAttribute, VertexAttribute, TextureCoordAttribute from pygly.vertex_array import VertexArray from pyrr import geometry ...
data/Pylons/virginia/virginia/views.py
import os import mimetypes mimetypes.add_type('text/html', '.stx') mimetypes.add_type('application/pdf', '.pdf') from zope.structuredtext import stx2html from pyramid.response import Response from pyramid.httpexceptions import HTTPFound from pyramid.view import render_view_to_response from pyramid.view import view_...
data/OpenSlides/OpenSlides/openslides/users/migrations/0001_initial.py
from __future__ import unicode_literals from django.db import migrations, models import openslides.utils.models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0006_require_contenttypes_0002'), ] operations = [ migrations.CreateMo...
data/PyHDI/Pyverilog/tests/dataflow_test/test_dat_case_in_func.py
from __future__ import absolute_import from __future__ import print_function import os import sys from pyverilog.dataflow.dataflow_analyzer import VerilogDataflowAnalyzer from pyverilog.dataflow.optimizer import VerilogDataflowOptimizer from pyverilog.controlflow.controlflow_analyzer import VerilogControlflowAnalyzer ...
data/Net-ng/kansha/kansha/title/__init__.py
from .comp import EditableTitle from .import view
data/RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/orm/evaluator.py
import operator from ..sql import operators from .. import util class UnevaluatableError(Exception): pass _straight_ops = set(getattr(operators, op) for op in ('add', 'mul', 'sub', 'div', 'mod', 'truediv', ...
data/ImageEngine/gaffer/contrib/ops/convertAnimCache.py
import os import glob import IECore class convertAnimCache( IECore.Op ) : def __init__( self ) : IECore.Op.__init__( self, "Converts animation caches from an old skool format to a nice new one.", IECore.FileSequenceParameter( "result", "" ) ) self.parameters().addParameters( [ IECore.FileSequenceParam...
data/CouchPotato/CouchPotatoServer/libs/xmpp/dispatcher.py
""" Main xmpppy mechanism. Provides library with methods to assign different handlers to different XMPP stanzas. Contains one tunable attribute: DefaultTimeout (25 seconds by default). It defines time that Dispatcher.SendAndWaitForResponce method will wait for reply stanza before giving up. """ import simplexml,time,...
data/OneDrive/onedrive-sdk-python/src/onedrivesdk/request_builder_base.py
''' ------------------------------------------------------------------------------ Copyright (c) 2015 Microsoft Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,...
data/abusesa/abusehelper/abusehelper/bots/abusech/zeusccbot.py
""" abuse.ch Zeus C&C RSS feed bot. Maintainer: Lari Huttunen <mit-code@huttu.net> """ import re from abusehelper.core import bot from . import host_or_ip, resolve_level, split_description, AbuseCHFeedBot class ZeusCcBot(AbuseCHFeedBot): feed_malware = "zeus" feed_type = "c&c" feeds = bot.ListParam(de...
data/Nordeus/pushkin/pushkin/tests/test_server_json.py
import pytest from pushkin import pushkin_cli import tornado.web from pushkin import context from pushkin.database import database from pushkin.request.request_processor import RequestProcessor from pushkin.requesthandlers.events import JsonEventHandler from pushkin.requesthandlers.notifications import JsonNotification...
data/SuperCowPowers/workbench/workbench/clients/pe_peid.py
"""This client looks for PEid signatures in PE Files.""" import zerorpc import os import pprint import client_helper def run(): """This client looks for PEid signatures in PE Files.""" args = client_helper.grab_server_args() workbench = zerorpc.Client(timeout=300, heartbeat=60) workben...
data/MirantisWorkloadMobility/CloudFerry/cloudferry/lib/os/actions/remote_execution.py
from cloudferry.lib.base.action import action from cloudferry.lib.utils.ssh_util import SshUtil class RemoteExecution(action.Action): def __init__(self, cloud, host=None, int_host=None, config_migrate=None): self.cloud = cloud self.host = host self.int_host = int_host self.config_...
data/RoseOu/flasky/venv/lib/python2.7/site-packages/coverage/backward.py
"""Add things to old Pythons so I can pretend they are newer.""" import os, re, sys try: set = set except NameError: from sets import Set as set try: sorted = sorted except NameError: def sorted(iterable): """A 2.3-compatible implementation of `sorted`.""" lst = list(it...
data/Wtower/django-ninecms/ninecms/migrations/0004_auto_20150624_1131.py
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ninecms', '0003_auto_20150623_1731'), ] operations = [ migrations.AlterModelOptions( name='node', options={'permissions': ((...
data/Unidata/siphon/siphon/tests/test_ncss_dataset.py
import logging import xml.etree.ElementTree as ET from siphon.ncss_dataset import NCSSDataset, _Types from siphon.testing import get_recorder from siphon.http_util import urlopen log = logging.getLogger("siphon.ncss_dataset") log.setLevel(logging.WARNING) log.addHandler(logging.StreamHandler()) recorder = get_record...
data/OpenKMIP/PyKMIP/kmip/core/keys.py
from kmip.core.enums import Tags from kmip.core.primitives import Struct from kmip.core.primitives import ByteString from kmip.core.utils import BytearrayStream class RawKey(ByteString): def __init__(self, value=None): super(RawKey, self).__init__(value, Tags.KEY_MATERIAL) class OpaqueKey(ByteString)...
data/OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_set_defaults.py
""" Test for setting input variables back to their default values. """ import unittest from openmdao.main.api import Component, Assembly from openmdao.main.datatypes.api import Float, List, Array from numpy import array, zeros class MyDefComp(Component): f_in = Float(3.14, iotype='in') f_out = Float(ioty...
data/Yelp/pyleus/examples/apparent_temperature/apparent_temperature/humidity_generator.py
from __future__ import absolute_import import logging from collections import namedtuple import random from apparent_temperature.measure_generator import MeasureGeneratorSpout log = logging.getLogger('humidity_generator') HumidityMeasure = namedtuple( "HumidityMeasure", "id_sensor timestamp humidity") cl...
data/MacSysadmin/pymacadmin/lib/PyMacAdmin/SCUtilities/SCPreferences.py
""" SCPreferences.py: Simplified interaction with SystemConfiguration preferences TODO: * Refactor getvalue/setvalue code into generic functions for dealing with things other than proxies * Add get_proxy() to parallel set_proxy() """ import sys import os import unittest from SystemConfiguration import * class SCPre...
data/Orange-OpenSource/bagpipe-bgp/bagpipe/bgp/vpn/ipvpn/__init__.py
import logging import socket from bagpipe.bgp.common import utils from bagpipe.bgp.common import logDecorator from bagpipe.bgp.vpn.vpn_instance import VPNInstance from bagpipe.bgp.engine import RouteEvent from bagpipe.bgp.vpn.dataplane_drivers import DummyDataplaneDriver \ as _DummyDataplaneDriver from bagpipe...
data/adblockplus/gyp/test/compiler-override/gyptest-compiler-env-toolchain.py
""" Verifies that the user can override the compiler and linker using CC/CXX/NM/READELF environment variables. """ import TestGyp import os import copy import sys here = os.path.dirname(os.path.abspath(__file__)) if sys.platform == 'win32': sys.exit(0) for key in ['CC', 'CXX', 'LINK', 'CC_host', 'CXX_host'...
data/JetBrains/python-skeletons/numpy/core/__init__.py
from . import multiarray __all__ = []
data/NervanaSystems/neon/tests/test_pool_layer.py
""" Pooling layer tests """ import itertools as itt import numpy as np from neon import NervanaObject from neon.layers.layer import Pooling from tests.utils import allclose_with_out def pytest_generate_tests(metafunc): np.random.seed(1) if metafunc.config.option.all: bsz_rng = [32, 64] else: ...
data/OpenKMIP/PyKMIP/kmip/tests/unit/core/messages/payloads/test_discover_versions.py
from six.moves import xrange from testtools import TestCase from kmip.core import utils from kmip.core.messages.contents import ProtocolVersion from kmip.core.messages.payloads import discover_versions class TestDiscoverVersionsRequestPayload(TestCase): def setUp(self): super(TestDiscoverVersionsReque...
data/ProgVal/Limnoria/plugins/Owner/__init__.py
""" Provides commands useful to the owner of the bot; the commands here require their caller to have the 'owner' capability. This plugin is loaded by default. """ import supybot import supybot.world as world __version__ = "%%VERSION%%" __author__ = supybot.authors.jemfinch __contributors__ = {} from . import ...
data/SmartTeleMax/iktomi/tests/storage.py
__all__ = ['LocalMemStorageTest', 'MemcachedStorageTest'] import unittest from iktomi.storage import LocalMemStorage, MemcachedStorage class LocalMemStorageTest(unittest.TestCase): def test_set(self): '`LocalMemStorage` set method' s = LocalMemStorage() s.set('key', 'value') self....
data/MongoEngine/django-mongoengine/django_mongoengine/mongo_admin/templatetags/mongoadmintags.py
from django import template from django.conf import settings register = template.Library() class CheckGrappelli(template.Node): def __init__(self, var_name): self.var_name = var_name def render(self, context): context[self.var_name] = 'grappelli' in settings.INSTALLED_APPS return '' d...
data/VinF/deer/setup.py
from setuptools import setup, find_packages import deer NAME = 'deer' VERSION = '0.1' AUTHOR = "Vincent Francois-Lavet" AUTHOR_EMAIL = "v.francois@ulg.ac.be" URL = 'https://github.com/VinF/General_Deep_Q_RL' DESCRIPTION = 'Framework for deep reinforcement learning' with open('README.md') as f: LONG_DESCRIPTION = ...
data/Pylons/shootout/shootout/models.py
import cryptacular.bcrypt from sqlalchemy import ( Table, Column, ForeignKey, ) from sqlalchemy.orm import ( scoped_session, sessionmaker, relation, backref, column_property, synonym, joinedload, ) from sqlalchemy.types import ( Integer, Unicode, UnicodeTex...
data/achillean/shodan-python/shodan/cli/converter/__init__.py
from .csvc import * from .kml import *
data/LASACTF/LASACTF-Problems/Problems/Forensics/Rise-of-the-machines/challenge.py
from hacksport.problem import Challenge class Problem(Challenge): def setup(self): self.flag = '2b7639993c09f171d4c524b4433fc43d269b5a3af36be9caebb3ebf4a142200944bae1'
data/SheffieldML/GPy/GPy/kern/src/periodic.py
import numpy as np from .kern import Kern from ...util.linalg import mdot from ...util.decorators import silence_errors from ...core.parameterization.param import Param from paramz.transformations import Logexp class Periodic(Kern): def __init__(self, input_dim, variance, lengthscale, period, n_freq, lower, upper,...
data/IEEERobotics/bot/tests/test_servo.py
"""Test cases for servo abstraction class.""" from random import randint from os import path import bot.lib.lib as lib import bot.hardware.servo as s_mod import tests.test_bot as test_bot class TestPosition(test_bot.TestBot): """Test setting and checking the position of a servo.""" def setUp(self): ...
data/RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/tcpserver.py
"""A non-blocking, single-threaded TCP server.""" from __future__ import absolute_import, division, print_function, with_statement import errno import os import socket from tornado.log import app_log from tornado.ioloop import IOLoop from tornado.iostream import IOStream, SSLIOStream from tornado.netutil import bind_...
data/SpockBotMC/SpockBot/spockbot/plugins/helpers/physics.py
""" A Physics module built from clean-rooming the Notchian Minecraft client Collision detection and resolution is done by a Separating Axis Theorem implementation for concave shapes decomposed into Axis-Aligned Bounding Boxes. This isn't totally equivalent to vanilla behavior, but it's faster and Close Enough^TM AKA ...
data/WattTime/pyiso/tests/test_load.py
from pyiso import client_factory, BALANCING_AUTHORITIES from pyiso.base import BaseClient from pyiso.eu import EUClient from unittest import TestCase import pytz from datetime import datetime, timedelta class TestBaseLoad(TestCase): def setUp(self): bc = BaseClient() self.MARKET_CHOICES =...
data/Miserlou/django-zappa/manage.py
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings") from django.core.management import execute_from_command_line is_testing = 'test' in sys.argv if is_testing: import coverage cov = coverage.coverage(include="django_zappa/*...
data/Pirate-Crew/IPTV/iptv/Crawler.py
import urllib2 import google import time import pyprind import os import random from urlparse import urlparse """Crawler Class that handles the crawling process that fetch accounts on illegal IPTVs Authors: Claudio Ludovico (@Ludo237) Pinperepette (@Pinperepette) Arm4x (@Arm4x) """ class Crawler(object): ver...
data/JuanPotato/Legofy/legofy/legofy_gui.py
import os import legofy import tkinter as tk import tkinter.ttk as ttk from tkinter import filedialog import tkinter.messagebox as tkmsg LEGO_PALETTE = ('none', 'solid', 'transparent', 'effects', 'mono', 'all', ) class LegofyGui(tk.Tk): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs...
data/StackStorm/st2contrib/packs/circle_ci/sensors/webhook_sensor.py
import json from flask import Flask, request, abort from st2reactor.sensor.base import Sensor TRIGGER_REF = 'circle_ci.build_event' class CircleCIWebhookSensor(Sensor): def setup(self): self.host = self._config['host'] self.port = self._config['port'] self._endpoints = self._config['end...
data/adamchainz/django-mysql/tests/testapp/enum_default_migrations/0003_remove_some_fields.py
from __future__ import unicode_literals from django.db import migrations from django_mysql.models import EnumField class Migration(migrations.Migration): dependencies = [ ('testapp', '0002_add_some_fields'), ] operations = [ migrations.AlterField( model_name='EnumDefaultMod...
data/OpenMOOC/askbot-openmooc/askbotopenmooc/utils/openmooc-askbot-instancetool.py
""" Askbot instance administration tool for creating, disabling or destroying askbot instances """ import sys import os import time if sys.version_info < (2, 6, 0): print(' [WARNING] This script needs python 2.6. We don\'t guarantee it ' 'works on other python versions.') elif sys.version_info >= ...
data/SpockBotMC/SpockBot/spockbot/mcdata/windows.py
import sys import types from minecraft_data.v1_8 import windows as windows_by_id from minecraft_data.v1_8 import windows_list from spockbot.mcdata import constants, get_item_or_block from spockbot.mcdata.blocks import Block from spockbot.mcdata.items import Item from spockbot.mcdata.utils import camel_case, snake_cas...
data/SheffieldML/GPy/GPy/models/warped_gp.py
import numpy as np from ..util.warping_functions import * from ..core import GP from .. import likelihoods from GPy.util.warping_functions import TanhWarpingFunction_d from GPy import kern class WarpedGP(GP): def __init__(self, X, Y, kernel=None, warping_function=None, warping_terms=3): if kernel is None:...
data/RobotLocomotion/director/src/python/director/affordanceitems.py
import director import director.objectmodel as om from director import visualization as vis from director.visualization import PolyDataItem from director import filterUtils from director import ioUtils from director import meshmanager from director import transformUtils from director.uuidutil import newUUID from direct...
data/VisTrails/VisTrails/vistrails/db/versions/v0_7_0/persistence/xml/xml_dao.py
from __future__ import division from datetime import date, datetime from vistrails.core.system import strftime, time_strptime class XMLDAO: def __init__(self): pass def hasAttribute(self, node, attr): return node.hasAttribute(attr) def getAttribute(self, node, attr): try: ...
data/SumitBisht/RobotFrameworkTestAutomation/Ch4/seleniumTest/src/flaskApp/hello.py
from flask import Flask, request, render_template, flash, redirect, url_for app = Flask(__name__) app.secret_key = 'AXAPBswe4B' @app.route('/') def login(): return render_template('login.html') @app.route('/secure', methods=['POST']) def secured(): user = request.form['username'] password = request.form['password'...
data/ResilientScience/wot/wot/dimer.py
import sys import fileinput import itertools ALPHABET = ("A", "C", "G", "T") def sequence_count(string, wordlength): """Return a frequency count of all sequences of a given size found in a string. """ i = 0 wc = {} while i < len(string) - wordlength + 1: word = string[i:i+wordle...
data/StackStorm/st2/st2auth/st2auth/cmd/api.py
import eventlet import os import sys from oslo_config import cfg from eventlet import wsgi from st2common import log as logging from st2common.service_setup import setup as common_setup from st2common.service_setup import teardown as common_teardown from st2common.util.monkey_patch import monkey_patch from st2common....
data/SEED-platform/seed/setup.py
from setuptools import setup, find_packages setup( name='seed', version='0.1.0', packages=find_packages(), url='', license='revised BSD', author='Richard Brown', author_email='rebrown@lbl.gov', description='The SEED Platform is a web-based application that helps organizations easily man...
data/PyHDI/veriloggen/tests/core/systemtask/systemtask.py
from __future__ import absolute_import from __future__ import print_function import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) from veriloggen import * def mkLed(): m = Module('blinkled') width = m.Parameter('WIDTH', 8) ...
data/RoseOu/flasky/venv/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py
import os import platform from subprocess import Popen, STDOUT from selenium.common.exceptions import WebDriverException from selenium.webdriver.common import utils import time class FirefoxBinary(object): NO_FOCUS_LIBRARY_NAME = "x_ignore_nofocus.so" def __init__(self, firefox_path=None, log_file=None): ...
data/VisTrails/VisTrails/vistrails/core/console_mode.py
""" Module used when running vistrails uninteractively """ from __future__ import absolute_import, division import os.path import unittest from vistrails.core.application import is_running_gui from vistrails.core.configuration import get_vistrails_configuration import vistrails.core.interpreter.default import vistrai...
data/Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/router/nexus1000v/tabs.py
from django.utils.translation import ugettext_lazy as _ from horizon import tabs class NetworkProfileTab(tabs.Tab): name = _("Network Profile") slug = "network_profile" template_name = 'router/nexus1000v/network_profile/index.html' def get_context_data(self, request): return None class P...
data/StackStorm/st2contrib/packs/bitbucket/actions/lib/action.py
from st2actions.runners.pythonrunner import Action from bitbucket.bitbucket import Bitbucket class BitBucketAction(Action): def __init__(self, config): super(BitBucketAction, self).__init__(config) def _get_client(self, repo=None): if repo: bb = Bitbucket(username=self.config['use...
data/KunihikoKido/sublime-elasticsearch-client/commands/delete_document.py
import sublime from .base import DeleteBaseCommand class DeleteDocumentCommand(DeleteBaseCommand): command_name = "elasticsearch:delete-document" def is_enabled(self): return True def run_request(self, id=None): if not id: self.show_input_panel('Document Id: ', '', self.run) ...
data/IEEERobotics/bot/bot/follower/pid.py
class PID(object): def __init__(self): """initizes value for the PID""" self.kd = 0 self.ki = 0 self.kp = 1 self.previous_error = 0 self.integral_error = 0 def set_k_values(self, kp, kd, ki): self.kp = kp self.ki = ki self.kd = kd de...
data/UFAL-DSG/cloud-asr/cloudasr/master/lib.py
import zmq import time from collections import defaultdict from cloudasr import Poller from cloudasr.messages import HeartbeatMessage from cloudasr.messages.helpers import * def create_master(worker_address, frontend_address, monitor_address): poller = create_poller(worker_address, frontend_address) context =...
data/TwilioDevEd/appointment-reminders-flask/tests/base_test.py
import unittest from models.appointment import Appointment class BaseTest(unittest.TestCase): def setUp(self): from reminders import app, db self.app = app self.db = db self.celery = app.celery() self.test_client = app.flask_app.test_client() self.app.flask_app.conf...
data/STIXProject/python-stix/stix/core/__init__.py
import stix from stix.utils.deprecated import idref_deprecated from stix.campaign import Campaign from stix.coa import CourseOfAction from stix.exploit_target import ExploitTarget from stix.indicator import Indicator from stix.incident import Incident from stix.report import Report from stix.threat_actor import Thr...
data/SickRage/SickRage/lib/sqlalchemy/util/topological.py
"""Topological sorting algorithms.""" from ..exc import CircularDependencyError from .. import util __all__ = ['sort', 'sort_as_subsets', 'find_cycles'] def sort_as_subsets(tuples, allitems): edges = util.defaultdict(set) for parent, child in tuples: edges[child].add(parent) todo = set(allitem...
data/RDFLib/rdflib/test/test_graph_formula.py
import sys import os from tempfile import mkdtemp, mkstemp from rdflib import RDF, RDFS, URIRef, BNode, Variable, plugin from rdflib.graph import QuotedGraph, ConjunctiveGraph implies = URIRef("http://www.w3.org/2000/10/swap/log testN3 = """ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns @prefix rdfs: <htt...
data/adblockplus/gyp/test/win/gyptest-cl-function-level-linking.py
""" Make sure function-level linking setting is extracted properly. """ import TestGyp import sys if sys.platform == 'win32': test = TestGyp.TestGyp(formats=['msvs', 'ninja']) CHDIR = 'compiler-flags' test.run_gyp('function-level-linking.gyp', chdir=CHDIR) test.build('function-level-linking.gyp', test.ALL, ...
data/SMFOSS/CheesePrism/cheeseprism/event.py
from zope.interface import Attribute from zope.interface import Interface from zope.interface import implements class IIndexEvent(Interface): """ An lower level event involving the index """ class IIndexUpdate(Interface): """ An low level event involving the index """ class IPackageEvent(IInd...
data/Net-ng/kansha/kansha/alembic/versions/b740362087_adding_max_cards.py
"""adding max cards Revision ID: b740362087 Revises: 537fa16b46e7 Create Date: 2013-09-19 17:37:37.027495 """ revision = 'b740362087' down_revision = '537fa16b46e7' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('column', sa.Column('nb_max_cards', sa.Integer)) def downgrade(): ...
data/accumulo/pyaccumulo/version.py
__all__ = ("get_git_version") import os import sys import traceback from subprocess import Popen, PIPE def call_git_describe(abbrev=4): dot_git = os.path.join( os.path.dirname(os.path.abspath(__file__)), '.git') if not os.path.exists(dot_git): return None, None line = None ...
data/JeremyGrosser/supervisor/src/supervisor/medusa/test/test_11.py
import socket import string from supervisor.medusa import asyncore_25 as asyncore from supervisor.medusa import asynchat_25 as asynchat class test_client (asynchat.async_chat): ac_in_buffer_size = 16384 ac_out_buffer_size = 16384 total_in = 0 concurrent = 0 max_concurrent = 0 def __init_...
data/Immediatic/cmsplugin_vimeo/cmsplugin_vimeo/__init__.py
VERSION = (0,1,0,'final',1) __version__ = '.'.join(map(str, VERSION)) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: if VERSION[3] !...
data/PythonCharmers/python-future/tests/test_future/test_pasteurize.py
""" This module contains snippets of Python 3 code (invalid Python 2) and tests for whether they can be passed to ``pasteurize`` and immediately run under both Python 2 and Python 3. """ from __future__ import print_function, absolute_import import pprint from subprocess import Popen, PIPE import tempfile import os ...
data/Impactstory/total-impact-webapp/test/unit_tests/providers/test_provider.py
from totalimpact.providers import provider from totalimpact.providers.provider import Provider, ProviderFactory from totalimpactwebapp import app, db from nose.tools import assert_equals, nottest from xml.dom import minidom from test.utils import setup_postgres_for_unittests, teardown_postgres_for_unittests import si...
data/adblockplus/gyp/test/msvs/express/gyptest-express.py
""" Verifies that flat solutions get generated for Express versions of Visual Studio. """ import TestGyp test = TestGyp.TestGyp(formats=['msvs']) test.run_gyp('express.gyp', '-G', 'msvs_version=2005') test.must_contain('express.sln', '(base)') test.run_gyp('express.gyp', '-G', 'msvs_version=2008') test.must_contain...
data/adblockplus/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py
""" Verify that a hard_dependency that is exported is pulled in as a dependency for a target if the target is a static library and if the generator will remove dependencies between static libraries. """ import TestGyp test = TestGyp.TestGyp() if test.format == 'dump_dependency_json': test.skip_test('Skipping test;...
data/ReactiveX/RxPY/rx/linq/observable/blocking/toiterable.py
import threading from rx.blockingobservable import BlockingObservable from rx.internal import extensionmethod from rx.internal.enumerator import Enumerator @extensionmethod(BlockingObservable) def to_iterable(self): """Returns an iterator that can iterate over items emitted by this `BlockingObservable`. ...
data/OpenMDAO/OpenMDAO-Framework/openmdao.util/src/openmdao/util/filewrap.py
""" A collection of utilities for file wrapping. Note: This is a work in progress. """ import re from pyparsing import CaselessLiteral, Combine, OneOrMore, Optional, \ TokenConverter, Word, nums, oneOf, printables, \ ParserElement, alphanums from numpy import append, arra...
data/StackStorm/st2contrib/packs/st2/actions/kv_get_object.py
import json from lib.action import St2BaseAction __all__ = [ 'St2KVPGetObjectAction' ] class St2KVPGetObjectAction(St2BaseAction): def run(self, key): _key = self.client.keys.get_by_name(key) if _key: deserialized_value = json.loads(_key.value) return deserialized_va...
data/JamesRitchie/django-rest-framework-sav/rest_framework_sav/__init__.py
"""Package adding Session Authentication view to Django REST Framework.""" __all__ = [ 'views' ] __version__ = '0.1.0'
data/Pegase745/sqlalchemy-datatables/examples/flask_tut/flask_tut/scripts/initializedb.py
"""Initialize DB with fixtures.""" from time import sleep from flask import Flask from flask_tut.models import ( db, User, Address, ) app = Flask(__name__) with app.app_context(): db.create_all() i = 0 while i < 30: address = Address(description='Address db.session.add(address) user = Use...
data/NORDUnet/opennsa/test/test_ncsvpn.py
import os, datetime, json from twisted.trial import unittest from twisted.internet import defer, task from opennsa import config, nsa, database from opennsa.topology import nml from opennsa.backends import ncsvpn from . import common class NCSVPNBackendTest(unittest.TestCase): def setUp(self): self.c...