path
stringlengths
23
146
source_code
stringlengths
0
261k
data/Kinto/kinto/kinto/views/flush.py
from cornice import Service from pyramid import httpexceptions from pyramid.security import NO_PERMISSION_REQUIRED from kinto.events import ServerFlushed flush = Service(name='flush', description='Clear database content', path='/__flush__') @flush.post(permission=NO_PERMISSION_REQUIR...
data/PearsonEducation/bag-of-holding/project/boh/models.py
from datetime import date, timedelta import uuid import phonenumbers from django.conf import settings from django.db import models from django.core.validators import RegexValidator from django.utils import timezone from django.utils.translation import ugettext as _ from .behaviors import TimeStampedModel from . impo...
data/MaciekBaron/sublime-list-stylesheet-vars/stylevariables.py
import sublime, sublime_plugin, os, re class StyleSheetSetup: def __init__(self, extensions, regex, partials=None, index=None): if partials is None: self.partials = False else: self.partials = partials if index is None: self.index = False else: ...
data/T0ha/ezodf/tests/test_text.py
from __future__ import unicode_literals, print_function, division __author__ = "mozman <mozman@gmx.at>" try: import unittest2 as unittest except ImportError: import unittest from ezodf.xmlns import etree, CN from ezodf.base import GenericWrapper from ezodf.text import Paragraph, Span, Heading, NumberedPar...
data/Theano/Theano/theano/sandbox/gpuarray/opt.py
from __future__ import absolute_import, print_function, division import copy import numpy import logging from six.moves import xrange import theano from theano import tensor, scalar, gof from theano.compile import optdb from theano.compile.ops import shape_i from theano.gof import (local_optimizer, EquilibriumDB, Topo...
data/Juniper/py-junos-eznc/lib/jnpr/junos/factory/__init__.py
import yaml import os.path from jnpr.junos.factory.factory_loader import FactoryLoader __all__ = ['loadyaml', 'FactoryLoader'] def loadyaml(path): """ Load a YAML file at :path: that contains Table and View definitions. Returns a <dict> of item-name anditem-class definition. If you want to import t...
data/adieu/allbuttonspressed/blog/urlroutes.py
from .models import Blog, Post from .views import browse, show_post, latest_entries_feed from urlrouter.base import URLHandler class BlogRoutes(URLHandler): model = Blog def show(self, request, blog): if request.path == blog.get_internal_feed_url(): return latest_entries_feed(request, blog...
data/ImageEngine/gaffer/python/GafferTest/AddNode.py
import IECore import Gaffer class AddNode( Gaffer.ComputeNode ) : def __init__( self, name="AddNode" ) : Gaffer.ComputeNode.__init__( self, name ) p1 = Gaffer.IntPlug( "op1", Gaffer.Plug.Direction.In ) p2 = Gaffer.IntPlug( "op2", Gaffer.Plug.Direction.In ) self.addChild( Gaffer.BoolPlug( "enabled", defaul...
data/XiaoMi/minos/supervisor/superlance/tests/crashmail_test.py
import sys import unittest from StringIO import StringIO class CrashMailTests(unittest.TestCase): def _getTargetClass(self): from superlance.crashmail import CrashMail return CrashMail def _makeOne(self, *opts): return self._getTargetClass()(*opts) def setUp(self): imp...
data/Suor/handy/setup.py
from setuptools import setup setup( name='handy', version='0.5.4', author='Alexander Schepanovski', author_email='suor.web@gmail.com', description='A collection of tools to make your django life easier.', long_description=open('README.rst').read(), url='http://github.com/Suor/handy', l...
data/UDST/activitysim/setup.py
from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages setup( name='activitysim', version='0.1dev', description='Activity-Based Travel Modeling', author='contributing authors', author_email='', license='BSD-3', url='https://github.com/udst/activi...
data/StackStorm/st2contrib/packs/opscenter/actions/set_node_conf.py
import requests import yaml from lib.base import OpscenterAction class SetNodeConfAction(OpscenterAction): def run(self, node_ip, node_conf, cluster_id=None): if not cluster_id: cluster_id = self.cluster_id try: yaml.safe_load(node_conf) except: sel...
data/StackStorm/st2contrib/packs/rackspace/actions/create_loadbalancer.py
from lib.action import PyraxBaseAction __all__ = [ 'CreateLoadBalancerAction' ] class CreateLoadBalancerAction(PyraxBaseAction): def run(self, name, port, protocol): clb = self.pyrax.cloud_loadbalancers virtual_ipv4 = clb.VirtualIP(type="PUBLIC", ipVersion='IPV4') self.logger.info('C...
data/PythonProgramming/Beginning-Game-Development-with-Python-and-Pygame/Chapter 11/model3d.py
from OpenGL.GL import * from OpenGL.GLU import * import pygame import os.path class Material(object): def __init__(self): self.name = "" self.texture_fname = None self.texture_id = None class FaceGroup(object): def __init__(self): self.tri_indices = [] self.materi...
data/ImageEngine/gaffer/python/GafferUI/FileSystemPathPlugValueWidget.py
import Gaffer import GafferUI class FileSystemPathPlugValueWidget( GafferUI.PathPlugValueWidget ) : def __init__( self, plug, path=None, parenting=None ) : GafferUI.PathPlugValueWidget.__init__( self, plug, path, parenting = parenting ) self._updateFromPlug() self.__plugMetadataChange...
data/MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/log.py
import datetime import logging from logging import config from logging import handlers import os import sys from fabric import api from oslo_config import cfg import yaml from cloudferry.lib.utils import sizeof_format getLogger = logging.getLogger CONF = cfg.CONF class StdoutLogger(object): """ The wrapper of ...
data/aarongarrett/inspyred/docs/rastrigin.py
from random import Random from time import time from math import cos from math import pi from inspyred import ec from inspyred.ec import terminators def generate_rastrigin(random, args): size = args.get('num_inputs', 10) return [random.uniform(-5.12, 5.12) for i in range(size)] def evaluate_rastrigin(candid...
data/SuperCowPowers/workbench/workbench/workers/view.py
''' view worker ''' import zerorpc class View(object): ''' View: Generates a view for any file type ''' dependencies = ['meta'] def __init__(self): self.workbench = zerorpc.Client(timeout=300, heartbeat=60) self.workbench.connect("tcp://127.0.0.1:4242") def execute(self, input_data): ...
data/SOM-Research/Gitana/filter.py
__author__ = 'atlanmod' import simplejson as json import codecs from datetime import datetime class Filter(): FILTERED_RESOURCES = {} FILTERED_EXTENSIONS = [] def __init__(self, json_repo_path, json_filtered_repo_path, filtered_resources_path, filtered_extensions_path, type, logger): self.JSO...
data/PythonCharmers/python-future/src/libfuturize/fixes/fix_division.py
""" UNFINISHED For the ``future`` package. Adds this import line: from __future__ import division at the top so the code runs identically on Py3 and Py2.6/2.7 """ from libpasteurize.fixes.fix_division import FixDivision
data/IceCTF/ctf-platform/api/api/autogen.py
""" Problem Autogeneration Handler """ import api import random import imp import shutil import os from os import path from functools import partial from bson import json_util from api.common import InternalException, SevereInternalException log = api.logger.use(__name__) modifiable_problem_fields = ["description"]...
data/aerospike/aerospike-client-python/examples/client/select.py
from __future__ import print_function import aerospike import sys from optparse import OptionParser usage = "usage: %prog [options] key bin [bin ...]" optparser = OptionParser(usage=usage, add_help_option=False) optparser.add_option( "--help", dest="help", action="store_true", help="Displays this messa...
data/SalesforceFoundation/CumulusCI/ci/upload_test_results.py
import json import os import sys import requests def upload_test_results(): APEXTESTSDB_BASE_URL=os.environ.get('APEXTESTSDB_BASE_URL') APEXTESTSDB_USER_ID=os.environ.get('APEXTESTSDB_USER_ID') APEXTESTSDB_TOKEN=os.environ.get('APEXTESTSDB_TOKEN') PACKAGE=os.environ.get('PACKAGE') REPOSITORY_URL=o...
data/QingdaoU/OnlineJudge/contest/migrations/0011_contestrank.py
from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import utils.models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('contest', '0010_auto_20150922_1703'), ] ...
data/STIXProject/python-stix/stix/incident/contributors.py
from cybox.common import Contributor import stix import stix.utils import stix.bindings.incident as incident_binding class Contributors(stix.EntityList): _namespace = "http://stix.mitre.org/Incident-1" _binding = incident_binding _binding_class = _binding.ContributorsType _contained_type = Contribut...
data/StackStorm/st2contrib/packs/travis_ci/actions/list_hooks.py
from lib.action import TravisCI class ListHooksAction(TravisCI): def run(self): """ Getting Hooks for user, returns id, name and state of hook """ path = '/hooks' response = self._perform_request(path, method='GET', requires_auth=True) data = response.json() ...
data/adaptivdesign/django-sellmo/example/mailing/admin.py
from django.contrib import admin from sellmo.contrib.mailing.models import MailMessage class MailMessageAdmin(admin.ModelAdmin): list_display = ['delivered', 'message_type', 'send', 'send_to', 'message_reference', 'failure_message'] list_display_links = ['message_reference'] admin.site....
data/Kareeeeem/jpglitch/setup.py
from setuptools import setup setup( name='jpglitch', version='0.2', py_modules=['jpglitch'], install_requires=[ 'Click', 'Pillow', ], entry_points=''' [console_scripts] jpglitch=jpglitch:cli ''', )
data/Impactstory/total-impact-core/extras/profiling/run_profiling.py
import yappi import os from totalimpact import backend rootdir = "." logfile = '/tmp/total-impact.log' yappi.clear_stats() yappi.start() backend.main(logfile) yappi.stop() yappi.print_stats(sort_type=yappi.SORTTYPE_TTOT, limit=30, thread_stats_on=False)
data/Kilian/Trimage/src/trimage/filesize/__init__.py
from filesize import size from filesize import traditional, alternative, verbose, iec, si
data/Julian/PyVi/pyvi/editor.py
from pyvi import window from pyvi.modes import normal class Editor(object): _command = None active_tab = None def __init__(self, tabs=None, config=None, normal=normal): self.config = config self.mode = self.normal = normal self.count = None if tabs is None: t...
data/ImageEngine/gaffer/python/GafferCortexTest/classes/parameterChangedCallback/parameterChangedCallback-1.py
import IECore class parameterChangedCallback( IECore.Parameterised ) : def __init__( self ) : IECore.Parameterised.__init__( self, "" ) self.parameters().addParameters( [ IECore.IntParameter( "driver", "", 0 ), IECore.IntParameter( "driven", "", 0 ), ], ...
data/QuantEcon/QuantEcon.py/quantecon/compute_fp.py
""" Filename: compute_fp.py Authors: Thomas Sargent, John Stachurski Compute the fixed point of a given operator T, starting from specified initial condition v. """ import time import numpy as np def _print_after_skip(skip, it=None, dist=None, etime=None): if it is None: msg = "{i:<13}{d:<15}{t...
data/LettError/MutatorMath/Lib/mutatorMath/ufo/__init__.py
""" These are some UFO specific tools for use with Mutator. build() is a convenience function for reading and executing a designspace file. documentPath: filepath to the .designspace document outputUFOFormatVersion: ufo format for output verbose: True / False for lots or no feedback logPath: fil...
data/ImageEngine/gaffer/python/GafferRenderManTest/RenderManShaderTest.py
import os import unittest import IECore import Gaffer import GafferTest import GafferScene import GafferSceneTest import GafferRenderMan import GafferRenderManTest class RenderManShaderTest( GafferRenderManTest.RenderManTestCase ) : def setUp( self ) : GafferRenderManTest.RenderManTestCase.setUp( self ) Gaff...
data/Suor/funcy/tests/test_flow.py
from time import time import pytest from funcy.flow import * def test_silent(): assert silent(int)(1) == 1 assert silent(int)('1') == 1 assert silent(int)('hello') is None assert silent(str.upper)('hello') == 'HELLO' class MyError(Exception): pass def test_ignore(): assert ignore(Excepti...
data/IanLewis/kay/kay/ext/jsonrpc2/__init__.py
""" :Copyright: (c) 2009 Takashi Matsuo <tmatsuo@candit.jp>, Atsushi Odagiri <aodagx@gmail.com>, All rights reserved. :license: BSD, see LICENSE for more details. http://groups.google.com/group/json-rpc/web/json-rpc-2-0 errors: code message meaning -32700 Parse error Inva...
data/adlibre/Adlibre-TMS/adlibre_tms/apps/saasu_client/models/invoices.py
import xml_models from saasu_client import DEFAULT_GET_URL from saasu_client.models.base import BaseModel, CollectionField __all__ = ['ServiceInvoice', 'ServiceInvoiceItem', 'ItemInvoice', 'ItemInvoiceItem', 'ServicePurchase'] class ServiceInvoiceItem(BaseModel): """ Service Invoice Item Entity """ ...
data/VisTrails/VisTrails/vistrails/core/log/opm_graph.py
from __future__ import division from vistrails.db.domain import DBOpmGraph class OpmGraph(DBOpmGraph): """ Class that stores info for generating OPM Provenance. """ def __init__(self, *args, **kwargs): if 'log' in kwargs: self.log = kwargs['log'] del kwargs['log'] else...
data/IDSIA/sacred/sacred/config/config_summary.py
from __future__ import division, print_function, unicode_literals from sacred.utils import iter_prefixes, join_paths class ConfigSummary(dict): def __init__(self, added=(), modified=(), typechanged=(), ignored_fallbacks=()): super(ConfigSummary, self).__init__() self.added = set(...
data/PromyLOPh/pandora-apidoc/conf.py
import sys, os extensions = [] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'Unofficial Pandora API' copyright = u'' version = '' release = '' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme...
data/Rapptz/discord.py/discord/ext/commands/formatter.py
""" The MIT License (MIT) Copyright (c) 2015-2016 Rapptz 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, including without limitation the rights to use, copy, modify, merge, ...
data/USC-NSL/miniNExT/mininext/service.py
""" Service Helper for MiniNExT. """ import copy from mininext.mount import MountProperties from mininext.util import ParamContainer class Service(ParamContainer): "Basic service object that can be used by many nodes." def __init__(self, name, **kwargs): """Initializes a new service helper object ...
data/PMEAL/OpenPNM/OpenPNM/Geometry/__SGL10__.py
""" =============================================================================== SGL10 -- A geometry model for SGL10 type Gas Diffusion Layers =============================================================================== """ from OpenPNM.Geometry import models as gm from OpenPNM.Geometry import GenericGeometry ...
data/PyHDI/veriloggen/tests/extension/dataflow_/mul/test_dataflow_mul.py
from __future__ import absolute_import from __future__ import print_function import dataflow_mul expected_verilog = """ module test; reg CLK; reg RST; reg [32-1:0] xdata; reg xvalid; wire xready; reg [32-1:0] ydata; reg yvalid; wire yready; wire [32-1:0] zdata; wire zvalid; reg zready; main ...
data/Theano/Theano/theano/sandbox/cuda/tests/test_nnet.py
from __future__ import absolute_import, print_function, division from nose.plugins.skip import SkipTest import numpy import unittest import theano import theano.tensor as T import theano.tests.unittest_tools as utt import theano.sandbox.cuda as cuda if not cuda.cuda_available: raise SkipTest('Optional package cu...
data/LABHR/octohatrack/octohatrack/utils.py
import os import logging class AttrDict(dict): """Attribute Dictionary (set and access attributes 'pythonically')""" def __getattr__(self, name): if name in self: return self[name] raise AttributeError('no such attribute: %s' % name) def __setattr__(self, name, val): se...
data/Robot-Will/Stino/stino/pyarduino/base/pyserial/__init__.py
VERSION = '2.6' import sys import os if os.name == 'nt': from .serialwin32 import * elif os.name == 'posix': from .serialposix import * else: raise ImportError("Sorry: no implementation for your platform ('%s') available" % (os.name,)) protocol_handler_packages = [ 'serial.urlhandler', ...
data/PressLabs/gitfs/gitfs/repository.py
import os from collections import namedtuple from shutil import rmtree from stat import S_IFDIR, S_IFREG, S_IFLNK from pygit2 import (clone_repository, Signature, GIT_SORT_TOPOLOGICAL, GIT_FILEMODE_TREE, GIT_STATUS_CURRENT, GIT_FILEMODE_LINK, GIT_FILEMODE_BLOB, GIT_BRANCH_REMOTE...
data/PythonJS/PythonJS/regtests/threads/shared_dict_coop.py
''' threads shared dict ''' from time import time from time import sleep import threading def main(): if PYTHON=='PYTHONJS': pythonjs.configure( direct_operator='+' ) pass else: def l (f,a): threading._start_new_thread(f,a) threading.start_webworker = l seq = {} w1 = threading.start_webworker( worker, (...
data/LabPy/lantz/examples/backend_frontend/example3-cli2.py
""" lantz.action ~~~~~~~~~~~~ This example shows how to use a Backend with an embedded Backend. (and apps WITHOUT graphical user interface). :copyright: 2015 by Lantz Authors, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from lantz import Q_ from lantz.d...
data/boto/boto/tests/integration/glacier/__init__.py
data/SafeSlingerProject/SafeSlinger-AppEngine/safeslinger-messenger/python/cloudstorage/rest_api.py
"""Base and helper classes for Google RESTful APIs.""" __all__ = ['add_sync_methods'] import logging import os import random import time from . import api_utils try: from google.appengine.api import app_identity from google.appengine.ext import ndb except ImportError: from google.appengine.api import app_...
data/NORDUnet/opennsa/opennsa/protocols/nsi2/providerservice.py
""" Web Service Resource for OpenNSA. This module turns soap data into usefull data structures. Author: Henrik Thostrup Jensen <htj@nordu.net> Copyright: NORDUnet (2011-2015) """ import time from twisted.python import log, failure from opennsa import nsa, error from opennsa.shared import xmlhelper from opennsa.pro...
data/TheKevJames/packtex/packtex/commands/upgrade.py
from .. import (ctan, error, local_info) from . import (install, uninstall) def run(package): if isinstance(package, list): for pkg in package: run(pkg) return pkg = package.lower() error.installed('upgrade', pkg, fail=True) installed_version = local_info.get_data(pkg)[1]...
data/abhik/pebl/src/pebl/learner/exhaustive.py
"""Classes and functions for doing exhaustive learning.""" from pebl import prior, config, evaluator, result, network from pebl.learner.base import Learner from pebl.taskcontroller.base import Task class ListLearner(Learner): _params = ( config.StringParameter( 'listlearner.net...
data/Suor/funcy/drafts/intro.py
dict_of = lambda o: {k:getattr(o,k) for k in dir(o) if 'globals' not in k and not callable(getattr(o,k))} from django.db import connections def fetch(query, params=[], db='default'): cursor = connections[db].cursor() cursor.execute(query, params) return cursor.fetchall()
data/Kloudless/kloudless-python/tests/integration/test_cases/test_permissions.py
import unittest import utils import sdk change_file_permissions = ['gdrive'] change_folder_permissions = ['gdrive', 'box'] list_permissions = ['gdrive', 'box', 'sharepoint', 'onedrivebiz'] readonly_permissions = ['sharepoint', 'onedrivebiz'] class Permissions(unittest.TestCase): new_roles = {} @utils.allow...
data/PythonCharmers/python-future/src/tkinter/__init__.py
from __future__ import absolute_import import sys if sys.version_info[0] < 3: from Tkinter import * else: raise ImportError('This package should not be accessible on Python 3. ' 'Either you are trying to run from the python-future src folder ' 'or your installation o...
data/Microsoft/ApplicationInsights-Python/tests/applicationinsights_tests/channel_tests/TestSenderBase.py
import random import unittest import time import threading try: import BaseHTTPServer as HTTPServer except ImportError: import http.server as HTTPServer import sys, os, os.path rootDirectory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..') if rootDirectory not in sys.path: ...
data/Theano/Theano/theano/misc/pycuda_example.py
"""This file show how we can use Pycuda compiled fct in a Theano Op. Do no use those op in production code. See the TODO. You can use them as a guide to use your pycuda code into a Theano op. The PycudaElemwiseSourceModuleOp is a Theano op use pycuda code generated with pycuda.compiler.SourceModule Their is a test i...
data/Ivaylo-Popov/Theano-Lights/models/lm_gru.py
import theano import theano.tensor as T from theano.sandbox.rng_mrg import MRG_RandomStreams from theano.tensor.nnet.conv import conv2d from theano.tensor.signal.downsample import max_pool_2d from theano.tensor.shared_randomstreams import RandomStreams import numpy as np from toolbox import * from modelbase import * ...
data/Yelp/yelp-python/tests/obj/deal_test.py
import io import json from tests.testing import resource_filename from yelp.obj.deal import Deal def test_init_deal(): with io.open(resource_filename('json/business_response.json')) as biz: response = json.load(biz)['deals'][0] deal = Deal(response) assert deal.url == response['url']
data/Storj/dataserv/dataserv/config.py
import os import logging ONLINE_TIME = 5 if os.environ.get("DATASERV_MAX_PING"): MAX_PING = int(os.environ.get("DATASERV_MAX_PING")) else: MAX_PING = 60 if os.environ.get("DATASERV_DATABASE_URI"): SQLALCHEMY_DATABASE_URI = os.environ.get("DATASERV_DATABASE_URI") else: SQLALCHEMY_DATABASE...
data/SimpleFinance/pipewelder/pipewelder/translator.py
import json class PipelineDefinitionError(Exception): def __init__(self, msg, definition): full_msg = ( "Error in pipeline definition: %s\n" % msg) super(PipelineDefinitionError, self).__init__(full_msg) self.msg = msg self.definition = definition def api_to_definitio...
data/T0ha/ezodf/ezodf/const.py
from __future__ import unicode_literals, print_function, division __author__ = "mozman <mozman@gmx.at>" import sys VERSION = "0.1.0" GENERATOR = "http://pypi.python.org/pypi/ezodf/%s$Python%s" % (VERSION, sys.version) MIMETYPES = { 'odt': "application/vnd.oasis.opendocument.text", 'ott': "application/vnd.oas...
data/VitaliyRodnenko/geeknote/tests/storageTest.py
import unittest from sqlalchemy.engine import create_engine from sqlalchemy.orm.session import sessionmaker from geeknote import storage import pickle def hacked_init(self): '''Hack for testing''' engine = create_engine('sqlite:///:memory:', echo=False) storage.Base.metadata.create_all(engine) Session...
data/MinerKasch/HadoopWithPython/pig/udfs/string_funcs.py
from pig_util import outputSchema @outputSchema('word:chararray') def reverse(word): """ Return the reverse text of the provided word """ return word[::-1] @outputSchema('length:int') def num_chars(word): """ Return the length of the provided word """ return len(word)
data/JinnLynn/beautifulsoup/bs4/doc/__init__.py
"""Executable documentation about beautifulsoup."""
data/Zolomon/reversi-ai/game/piece.py
import sys from game.settings import * from game import color as clr __author__ = 'bengt' class Piece(object): """Pieces are laid out on the board on an 8x8 grid.""" def __init__(self, x, y, colour): self.x = x self.y = y self.state = 'BOARD' self.flipped = False self...
data/agiliq/Dinette/dinette/migrations/0007_profile_last_sessiom.py
from south.db import db from django.db import models from dinette.models import * class Migration: def forwards(self, orm): db.add_column('dinette_dinetteuserprofile', 'last_session_activity', orm['dinette.dinetteuserprofile:last_session_activity']) def backwar...
data/StackStorm/st2/st2common/st2common/models/db/reactor.py
from st2common.models.db.rule import (ActionExecutionSpecDB, RuleDB) from st2common.models.db.sensor import SensorTypeDB from st2common.models.db.trigger import (TriggerDB, TriggerTypeDB, TriggerInstanceDB) __all__ = [ 'ActionExecutionSpecDB', 'RuleDB', 'SensorTypeDB', 'TriggerTypeDB', 'TriggerDB',...
data/RoseOu/flasky/venv/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py
import errno import logging from socket import error as SocketError, timeout as SocketTimeout import socket try: from queue import LifoQueue, Empty, Full except ImportError: from Queue import LifoQueue, Empty, Full import Queue as _ from .exceptions import ( ClosedPoolError, ConnectTimeoutErr...
data/VisTrails/VisTrails/vistrails/db/versions/v0_9_4/translate/v0_9_3.py
from __future__ import division import copy from vistrails.db.versions.v0_9_4.domain import DBVistrail, DBAction, DBTag, DBModule, \ DBConnection, DBPortSpec, DBFunction, DBParameter, DBLocation, DBAdd, \ DBChange, DBDelete, DBAnnotation, DBPort, DBGroup, \ DBWorkflow, DBLog, DBAbstraction def update_work...
data/ThaWeatherman/scrapers/pastes/paste/paste.py
""" Contains a base Site class for pastebin-like sites. Each child class only needs to specify a base url, the relative url to the public pastes archive, and a lambda function to get the paste links out of the page. """ import logging import re from urllib.parse import urljoin from bs4 import BeautifulSoup import requ...
data/adieu/allbuttonspressed/docutils/statemachine.py
""" A finite state machine specialized for regular-expression-based text filters, this module defines the following classes: - `StateMachine`, a state machine - `State`, a state superclass - `StateMachineWS`, a whitespace-sensitive version of `StateMachine` - `StateWS`, a state superclass for use with `StateMachineWS`...
data/PMEAL/OpenPNM/setup.py
import os import sys from distutils.util import convert_path try: from setuptools import setup except ImportError: from distutils.core import setup sys.path.append(os.getcwd()) main_ = {} ver_path = convert_path('OpenPNM/__init__.py') with open(ver_path) as f: for line in f: if line.startswith...
data/OpenMDAO/OpenMDAO-Framework/openmdao.test/src/openmdao/test/plugins/foo2/setup.py
""" A small example plugin """ from setuptools import setup __author__ = 'Your Name Here' setup( name='foo', version='1.4', description=__doc__, author=__author__, packages=[], py_modules=['foo'], entry_points=""" [openmdao.dumbplugins] foo.Comp1Plugin = foo:Comp1Plugin foo.Com...
data/LabPy/lantz/lantz/processors.py
""" lantz.processors ~~~~~~~~~~~~~~~~ :copyright: 2015 by Lantz Authors, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import warnings from . import Q_ from .log import LOGGER as _LOG from stringparser import Parser class DimensionalityWarning(Warning): pass d...
data/VisTrails/VisTrails/contrib/SciPy/DSP.py
import core.modules import core.modules.module_registry from core.modules.vistrails_module import Module, ModuleError from SciPy import SciPy from Matrix import * import scipy from scipy import sparse, fftpack import numpy class DSP(SciPy): def compute(self): pass class FFT(DSP): def compute(self): ...
data/KunihikoKido/sublime-elasticsearch-client/commands/base.py
import json import threading import sublime import sublime_plugin import analytics import uuid from elasticsearch import Elasticsearch from elasticsearch_connections import CustomHeadersConnection from abc import ABCMeta, abstractmethod from ..panel import IndexListPanel from ..panel import DocTypeListPanel from ..pa...
data/VisTrails/VisTrails/vistrails/core/modules/utils.py
from __future__ import division from vistrails.core.system import _defaultPkgPrefix, \ get_vistrails_basic_pkg_id, get_module_registry def load_cls(cls_item, prefix=None): path = None if isinstance(cls_item, basestring): (path, cls_name) = cls_item.split(':')[:2] elif isinstance(cls_item, tupl...
data/SublimeText/ColdFusion/functioncompletions.py
import sublime import sublime_plugin import re, os completions = [] SETTINGS = sublime.load_settings('ColdFusion.sublime-settings') def add_methods(cfc_file, hint_text): with open(cfc_file, 'r') as f: read_data = f.read() methods = [] method_lines = re.findall('function\s[^{]+', read_data) f...
data/Workiva/furious/furious/_pkg_meta.py
version_info = (1, 5, 0) version = '.'.join(map(str, version_info))
data/adlibre/Adlibre-DMS/adlibre_dms/apps/mdtui/templatetags/revisions_tags.py
""" Module: Template rendering helpers for MDTUI Project: Adlibre DMS Copyright: Adlibre Pty Ltd 2012 License: See LICENSE for license information Author: Iurii Garmash """ from django import template register = template.Library() @register.simple_tag(takes_context=True) def set_rev_item(context, rev): """retur...
data/ImageEngine/gaffer/python/GafferCortexUI/ToolParameterValueWidget.py
import GafferUI import GafferCortexUI class ToolParameterValueWidget( GafferCortexUI.ParameterValueWidget ) : def __init__( self, parameterHandler, parenting = None ) : GafferCortexUI.ParameterValueWidget.__init__( self, GafferUI.ToolPlugValueWidget( parameterHandler.plug() ), parameterHandler, parent...
data/StackStorm/st2/st2common/tests/unit/test_rbac_resolvers_rule_enforcement.py
__all__ = [ 'RuleEnforcementPermissionsResolverTestCase' ] import bson from st2common.triggers import register_internal_trigger_types from st2common.rbac.types import PermissionType from st2common.rbac.types import ResourceType from st2common.persistence.auth import User from st2common.persistence.rbac import Rol...
data/PressLabs/gitfs/tests/cache/test_commits.py
from datetime import datetime from mock import MagicMock, call from pygit2 import GIT_SORT_TIME from gitfs.cache.commits import Commit, CommitCache class TestCommit(object): def test_commit(self): commit = Commit(1, 1, 1) new_commit = Commit(2, 2, "21111111111") assert new_commit > com...
data/JeffHoogland/qutemtgstats/Code/EventWindow.py
import os from PySide.QtGui import * from PySide.QtCore import * from ui_Event import Ui_Event '''"ID":eventId, "Place":eventPlace, "Type":eventType, "Players":eventPlayers, ...
data/Yelp/mrjob/mrjob/logs/task.py
"""Parse "task" logs, which are the syslog and stderr for each individual task and typically appear in the userlogs/ directory.""" import posixpath import re from mrjob.util import file_ext from .ids import _add_implied_task_id from .ids import _to_job_id from .log4j import _parse_hadoop_log4j_records from .wrap impor...
data/Vassius/ttrss-python/ttrss/auth.py
from requests.auth import AuthBase import requests import json from ttrss.exceptions import raise_on_error class TTRAuth(AuthBase): def __init__(self, user, password, http_auth): self.user = user self.password = password self.http_auth = http_auth self.sid = None def response_...
data/MediaMath/t1-python/terminalone/metadata.py
__author__ = 'Prasanna Swaminathan' __copyright__ = 'Copyright 2015, MediaMath' __license__ = 'BSD' __version__ = '1.1.6' __maintainer__ = 'MediaMath Developer Relations' __email__ = 'developers@mediamath.com' __status__ = 'Stable'
data/ODM2/ODMToolsPython/odmtools/view/clsDataFilters.py
import wx import wx.xrc import wx.lib.masked as masked class clsDataFilters(wx.Dialog): def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Data Filter", pos=wx.Point(599, 384), size=wx.Size(382, 500), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZ...
data/Shopify/shopify_python_api/shopify/resources/customer_group.py
from .customer_saved_search import CustomerSavedSearch class CustomerGroup(CustomerSavedSearch): pass
data/Yelp/paasta/paasta_tools/cli/cmds/emergency_scale.py
from paasta_tools.cli.utils import execute_paasta_serviceinit_on_remote_master from paasta_tools.cli.utils import figure_out_service_name from paasta_tools.cli.utils import lazy_choices_completer from paasta_tools.cli.utils import list_instances from paasta_tools.cli.utils import list_services from paasta_tools.utils i...
data/Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/test/api_tests/vpnaas_tests.py
from openstack_dashboard import api from openstack_dashboard.test import helpers as test from neutronclient.v2_0 import client neutronclient = client.Client class VPNaasApiTests(test.APITestCase): @test.create_stubs({neutronclient: ('create_vpnservice',)}) def test_vpnservice_create(self): vpnservic...
data/admire93/mmcq.py/mmcq/math_.py
from math import sqrt __all__ = 'euclidean', def euclidean(p1, p2): return sqrt(pow(p2[0] - p1[0], 2) + pow(p2[1] - p1[1], 2) + pow(p2[2] - p1[2], 2) )
data/StackStorm/st2contrib/packs/kubernetes/actions/lib/action.py
from st2actions.runners.pythonrunner import Action class BaseAction(Action): def __init__(self, config): super(BaseAction, self).__init__(config)
data/Lujeni/matterllo/scripts/helper.py
""" scripts.init_webhook ~~~~~~~~~~~~~~~~~~~~ A simple script to manage the webhook. :copyright: (c) 2016 by Lujeni. :license: BSD, see LICENSE for more details. """ import argparse import sys from trello import TrelloClient from slugify import slugify from matterllo.utils import config from mat...
data/ProgVal/Limnoria/plugins/Filter/config.py
import supybot.conf as conf import supybot.registry as registry from supybot.i18n import PluginInternationalization, internationalizeDocstring _ = PluginInternationalization('Filter') Filter = conf.registerPlugin('Filter') conf.registerGroup(Filter, 'spellit') conf.registerGlobalValue(Filter.spellit, 'replaceLette...