code stringlengths 1 199k |
|---|
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import Project
from sentry.testutils import TestCase, PermissionTestCase
from sentry.utils.http import absolute_uri
class CreateProjectPermissionTest(PermissionTestCase):
def setUp(self):
super(CreateProje... |
import json
from nose.tools import eq_
from kitsune.forums.tests import post, thread
from kitsune.questions.tests import question
from kitsune.search.tests.test_es import ElasticTestCase
from kitsune.sumo.urlresolvers import reverse
from kitsune.wiki.tests import document, revision
class SearchApiTests(ElasticTestCase)... |
"""
Unit tests for ./preprocessing.py
"""
import numpy as np
from theano import config
import theano
from pylearn2.utils import as_floatX
from pylearn2.datasets import dense_design_matrix
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.datasets.preprocessing import (GlobalContrastNorma... |
"""Compressed Sparse Row matrix format"""
from __future__ import division, print_function, absolute_import
__docformat__ = "restructuredtext en"
__all__ = ['csr_matrix', 'isspmatrix_csr']
import numpy as np
from scipy._lib.six import xrange
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
get... |
"""
"""
def test_data(*paths):
from os.path import dirname, join, abspath
return abspath(join(dirname(abspath(__file__)), 'test-data', *paths)) |
'''
VGDL example: the windy gridworld is a classical RL benchmark.
Here: a deterministic and a stochastic version.
@author: Tom Schaul
'''
windy_level = """
wwwwwwwwwwww
w w
w ...... w
w ...--. w
wA ...-G. w
w ...--. w
w ...--. w
w ...--. w
wwwwwwwwwwww
"""
windymaze_game = """
BasicGame
LevelMa... |
from __future__ import division, print_function, absolute_import
__all__ = ['solve', 'solve_triangular', 'solveh_banded', 'solve_banded',
'solve_toeplitz', 'inv', 'det', 'lstsq', 'pinv', 'pinv2', 'pinvh']
import numpy as np
from .flinalg import get_flinalg_funcs
from .lapack import get_lapack_funcs
from .mis... |
from __future__ import with_statement
import collections
import errno
import filecmp
import os.path
import re
import tempfile
import sys
class memoize(object):
def __init__(self, func):
self.func = func
self.cache = {}
def __call__(self, *args):
try:
return self.cache[args]
except KeyError:
... |
"""
Convenience interface to N-D interpolation
.. versionadded:: 0.9
"""
import numpy as np
from interpnd import LinearNDInterpolator, NDInterpolatorBase, \
CloughTocher2DInterpolator, _ndim_coords_from_arrays
from scipy.spatial import cKDTree
__all__ = ['griddata', 'NearestNDInterpolator', 'LinearNDInterpolator',... |
import sys
import json
from collections import OrderedDict
fname = sys.argv[1]
f = open(fname, "r", encoding="utf-8")
spec = json.load(f, object_pairs_hook=OrderedDict)
f.close()
campos = spec.get('campos')
for campo in list(campos.values()):
campo_nome = campo.get('nome')
campo_formato = campo.get('formato')
... |
import os
import sys
import pytest
class TestExec:
__tmp__ = True
config = (
"""
templates:
global:
set:
temp_dir: '__tmp__'
accept_all: yes
tasks:
replace_from_entry:
mock:
- {title: 'replace'}
... |
class Parent():
def __init__(self, last_name, eye_color):
print "Parent constructor called"
self.last_name = last_name
self.eye_color = eye_color
def show_info(self):
print 'Last Name: ' + self.last_name
print 'Eye Color: ' + self.eye_color
class Child(Parent):
def __... |
from __future__ import unicode_literals
import unittest
import os
import warnings
from pymatgen.analysis.ewald import EwaldSummation, EwaldMinimizer
from pymatgen.io.vasp.inputs import Poscar
import numpy as np
test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..",
'test_files')
cl... |
{
"A location that specifies the geographic area for this region. This can be a location from the location hierarchy, or a 'group location', or a location that has a boundary for the area.": "ទីតាំងដែលបញ្ជាក់ផ្ទៃភូមិសាស្ត្រសម្រាប់តំបន់នេះ ។ វាអាចជាទីតាំងមកពីឋានានុក្រមទីតាំង ឬ 'ក្រុមទីតាំង' ឬទីតាំងដែលមានព... |
"""Create n-up SVG layouts"""
import sys, inkex
try:
import xml.etree.ElementTree as ElementTree
except:
try:
from lxml import etree as ElementTree
except:
try:
from elementtree.ElementTree import ElementTree
except:
sys.stderr.write("""Requires ElementTree mo... |
from distutils import sysconfig
from distutils.core import setup
from distutils.command.build import build
import subprocess
import ctypes.util
import os
import sys
import shutil
import re
VERSION_PY = """
__version__ = '%s'
"""
def update_version():
"""Grab the version number out of git. If we are not in
git, ... |
from offlineimap.repository.Base import BaseRepository
from offlineimap import folder, imaputil, imapserver, OfflineImapError
from offlineimap.folder.UIDMaps import MappedIMAPFolder
from offlineimap.threadutil import ExitNotifyThread
from threading import Event
import os
from sys import exc_info
import netrc
import err... |
"""
***************************************************************************
GeometryByExpression.py
-----------------------
Date : October 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
*******************************... |
'''
This is a solution to the below problem given the content we have
discussed in class. It is not necessarily the best solution to the problem.
In other words, I generally only use things we have covered up to this point
in the class (with some exceptions which I will usually note).
Python for Network Engineers
http... |
import os
import gi
gi.require_version('WebKit2', '4.0')
from gi.repository import WebKit2
from gi.repository import Gio
from sugar3 import env
def _get_current_language():
locale = os.environ.get('LANG')
return locale.split('.')[0].split('_')[0].lower()
class Browser():
def __init__(self, toolbar):
... |
"""
.. currentmodule:: pele.angleaxis
Angle Axis Systems (`pele.angleaxis`)
============================================
This module implements routines for treating angle axis systems. An angle axis
system can be a system with non-spherical potentials or a rigid body system,
where rigid objects are treated as a collec... |
DOCUMENTATION = '''
---
module: bigpanda
author: BigPanda
short_description: Notify BigPanda about deployments
version_added: "1.8"
description:
- Notify BigPanda when deployments start and end (successfully or not). Returns a deployment object containing all the parameters for future module calls.
options:
compon... |
from modules.OsmoseTranslation import T_
from .Analyser_Osmosis import Analyser_Osmosis
sql10 = """
SELECT
ways3.id,
ST_AsText(ST_Centroid(ways3.linestring))
FROM
{0}buildings AS buildings
JOIN {1}buildings AS ways3 ON
ST_Intersects(buildings.polygon_proj, ways3.polygon_proj) AND
ways3.i... |
import os
import re
import sys
import urllib
import generic
import datetime
import sickbeard
import exceptions
from lib import requests
from xml.sax.saxutils import escape
from sickbeard import db
from sickbeard import logger
from sickbeard import tvcache
from sickbeard.exceptions import ex
from sickbeard.common import... |
print "Content-type: text/html"
print
print "<html><head><title>students data</title></head>"
print "<body>"
print "<h1>students details</h1>"
print "<ul>"
import MySQLdb as mdb
con = mdb.connect('localhost','user58','user58','batch58')
cur = con.cursor()
cur.execute("select * from student")
for i in range(cur.rowcount... |
from pele.transition_states import InterpolatedPathDensity
__all__ = ["smoothPath", "smooth_path"]
def smooth_path(path, mindist, density=5., interpolator=None):
"""return a smooth (interpolated) path
useful for making movies. Especially for min-ts-min pathways
returned by DoubleEndedConnect.
Parameter... |
from rest_framework import serializers
from appointment.models.users import CalendarUser, CalendarUserProfile
from agent.models import AgentProfile
class CalendarUserProfileSerializer(serializers.ModelSerializer):
"""
**Read**:
CURL Usage::
curl -u username:password -H 'Accept: application/j... |
"""
Discussion API forms
"""
import six.moves.urllib.error
import six.moves.urllib.parse
import six.moves.urllib.request
from django.core.exceptions import ValidationError
from django.forms import BooleanField, CharField, ChoiceField, Form, IntegerField
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys ... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from jsonfield.fields import JSONField
from shoop.core.fields import InternalIdentifierField
from shoop.notify.base import Event
from shoop.notify.enums import StepNext
@python_2_unicode_co... |
import os
import pytest
import spack
from spack.util.module_cmd import (
get_path_args_from_module_line,
get_path_from_module_contents,
module,
path_from_modules,
)
test_module_lines = ['prepend-path LD_LIBRARY_PATH /path/to/lib',
'setenv MOD_DIR /path/to',
'set... |
"""Conversion pipeline templates.
The problem:
------------
Suppose you have some data that you want to convert to another format,
such as from GIF image format to PPM image format. Maybe the
conversion involves several steps (e.g. piping it through compress or
uuencode). Some of the conversion steps may require that... |
import iris.tests as tests
from .gallerytest_util import (
add_gallery_to_path,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)
class TestGlobalMap(tests.GraphicsTest):
"""Test the hovmoller gallery code."""
def test_plot_hovmoller(self):
with fail_any_deprecation_warnings()... |
"""Sparse tensors."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.framework import composite_tensor
from tensorflow.python.framework import dtypes
from tensorflow.py... |
__author__ = 'arobres'
import requests
from commons.configuration import TENANT_NAME, USER, PASSWORD, KEYSTONE_URL
def get_token():
body = '{"auth": {"tenantName": "%s", "passwordCredentials":{"username": "%s", "password": "%s"}}}' \
% (TENANT_NAME, USER, PASSWORD)
headers = {'content-type': 'applica... |
"""
IO/concurrency helpers for `tqdm.contrib`.
"""
from __future__ import absolute_import
from collections import deque
from concurrent.futures import ThreadPoolExecutor
from ..auto import tqdm as tqdm_auto
__author__ = {"github.com/": ["casperdcl"]}
__all__ = ['MonoWorker']
class MonoWorker(object):
"""
Suppor... |
from datetime import datetime, timedelta
from google.appengine.ext import db
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
from django.core.cache import cache
from django_ae_utils.sessions.models import Session
class SessionStore(SessionBase):
"""
A google appeng... |
__all__ = ['add_dep', 'add_react', 'Dep', 'React', 'add_event']
import networkx as nx
from solar.core.log import log
from solar.dblayer.solar_models import Resource
from solar.events.controls import Dep
from solar.events.controls import React
def create_event(event_dict):
etype = event_dict['etype']
kwargs = {'... |
import httplib as http
import logging
from flask import request
from framework.exceptions import HTTPError
from framework.auth.utils import privacy_info_handle
from framework.auth.decorators import must_be_logged_in
from framework.flask import redirect
from addons.wiki.utils import to_mongo_key
from addons.wiki import ... |
import json
import logging
import re
import urlparse
from datetime import datetime
from django.utils.formats import localize_input
from django.utils.translation import ugettext as _
from jobsub.parameterization import find_variables
LOG = logging.getLogger(__name__)
JSON_FIELDS = ('parameters', 'job_properties', 'files... |
import sys, struct
class MZSignatureError(Exception):
pass
class PESignatureError(Exception):
pass
class RichSignatureError(Exception):
pass
class DanSSignatureError(Exception):
pass
class PaddingError(Exception):
pass
class RichLengthError(Exception):
pass
class FileReadError(Exception):
pa... |
import time
import hashlib
import hmac
try:
import simplejson as json
except ImportError:
import json # NOQA
from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import urlencode
from libcloud.common.base import ConnectionUserAndKey, JsonResponse
from libcloud.common.types import InvalidCredsError, L... |
"""
Example of a Beta distribution
------------------------------
Figure 3.17.
This shows an example of a beta distribution with various parameters.
We'll generate the distribution using::
dist = scipy.stats.beta(...)
Where ... should be filled in with the desired distribution parameters
Once we have defined the di... |
"""
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.sparse import issparse
from .base import Bas... |
from unittest import main
from qiita_pet.test.tornado_test_base import TestHandlerWebSocketBase
from json import dumps, loads
from tornado.testing import gen_test
from tornado.gen import coroutine, Return
class TestSelectedSocketHandler(TestHandlerWebSocketBase):
@coroutine
def _mk_client(self):
c = yie... |
"""
Tests of the neo.core.spiketrainlist.SpikeTrainList class
"""
import sys
import unittest
import warnings
from copy import deepcopy
import numpy as np
from numpy.testing import assert_array_equal
import quantities as pq
from neo.core.spiketrain import SpikeTrain
from neo.core.spiketrainlist import SpikeTrainList
fro... |
""" Supplies a class for working with fingerprints from databases
"""
from rdkit import DataStructs
from rdkit.VLib.Node import VLibNode
import pickle
class DbFpSupplier(VLibNode):
"""
new fps come back with all additional fields from the
database set in a "_fieldsFromDb" data member
"""
def __i... |
""" Django-Markdown supports markdown in Django. """
__version__ = "0.8.4"
__project__ = "django-markdown"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "GNU LGPL" |
__author__ = 'Steven' |
string = "hello"
reversedstring = []
index = len(string)
print(index)
for i in string:
reversedstring.append(string[index-1])
index = index - 1
print(reversedstring) |
import os
import ycm_core
from clang_helpers import PrepareClangFlags
compilation_database_folder = ''
flags = [
'-g',
'-Wall',
'-pthread',
'-fno-strict-aliasing',
'-I/usr/include/glib-2.0',
'-I/usr/lib/x86_64-linux-gnu/glib-2.0/include',
'-pthread',
'-I../kernel-module/',
'-D_GNU_SOURCE',
'-D__DEBUG=1',
'-DRTPENGINE_V... |
""" ProxyManager is the implementation of the ProxyManagement service
in the DISET framework
"""
__RCSID__ = "$Id$"
import types
from DIRAC.Core.DISET.RequestHandler import RequestHandler
from DIRAC import gLogger, S_OK, S_ERROR
from DIRAC.FrameworkSystem.DB.ProxyDB import ProxyDB
from DIRAC.Core.Security import Pr... |
import pytest
@pytest.fixture(autouse=True)
def revision(request, clear_cache):
"""Sets up the cached revision counter for each test call."""
from pootle.core.models import Revision
from pootle_store.models import Unit
if request.node.get_marker('django_db'):
Revision.set(Unit.max_revision()) |
from __future__ import print_function
from schlib import *
import argparse
class CheckComponent(object):
def __init__(self, component):
self.component = component
self.prerequisites_ok = False
self.header_printed = False
self.pinsL = component.filterPins(direction='L')
self.p... |
class CompressorError(Exception):
"""
A general error of the compressor
"""
pass
class UncompressableFileError(Exception):
"""
This exception is raised when a file cannot be compressed
"""
pass
class FilterError(Exception):
"""
This exception is raised when a filter fails
"""... |
from network import receive_config, send_config, TCPConfigure
from data_generator import prepare_data
def check_config(max_height, max_width, max_framerate, height, width, framerate):
if height <= 0 or height > max_height:
return False, "height cannot be higher than {}. Current: {}.".format(max_height, heig... |
'''common mavproxy utility functions'''
import math
import os
import platform
has_wxpython = False
if platform.system() == 'Windows':
# auto-detection is failing on windows, for an unknown reason
has_wxpython = True
else:
import imp
try:
imp.find_module('wx')
has_wxpython = True
exce... |
from Products.Archetypes.atapi import *
from Products.ATContentTypes.content.folder import ATBTreeFolder as BaseClass
from Products.ATContentTypes.content.folder import ATBTreeFolderSchema as DefaultSchema
from Products.ATContentTypes.content.base import registerATCT
from ubify.coretypes.config import PROJECTNAME,appli... |
from scrapy_proj.loaders.act import *
from scrapy_proj.loaders.contact import * |
from ._daterange import DateRange
from ._generalslice import OPEN_CLOSED, CLOSED_OPEN, OPEN_OPEN, CLOSED_CLOSED
from ._util import datetime_to_ms, ms_to_datetime
from ._util import string_to_daterange, to_pandas_closed_closed, to_dt
from ._mktz import mktz, TimezoneError |
"""
The category package contains code to categorize torrents and filter the categories according to filter preferences.
""" |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetLikedMediaForUser(Choreography):
def __init__(self, temboo_session):
"""
Crea... |
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.db import transaction
from assopy import models
from assopy import settings
if settings.GENRO_BACKEND:
from assopy.clients import genro
import logging
log = logging.getLogger('assopy.auth')
class _AssopyBac... |
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import math
with file("cython.dat") as fd:
r = list()
for line in fd:
r.append(filter(None, line.split(' ')))
x = np.array(
[
[float(_[1]) for _ in r],
[float(_[2]) for _ in ... |
from textwrap import dedent
import pytest
from bokeh.models import CustomJSTransform, Slider
pscript = pytest.importorskip("pscript")
def test_customjstransform_from_py_func_no_args():
def cosine():
from pscript import window
return window.Math.cos(x) # noqa
def v_cosine():
from pscript ... |
"""
==================================
Reading epochs from a raw FIF file
==================================
This script shows how to read the epochs from a raw file given
a list of events. For illustration, we compute the evoked responses
for both MEG and EEG data by averaging all the epochs.
"""
import mne
from mne i... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from django.conf i... |
from common.chrome_proxy_benchmark import ChromeProxyBenchmark
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests import chrome_proxy_pagesets as pagesets
from telemetry import benchmark
DESKTOP_PLATFORMS = ['mac', 'linux', 'win', 'chromeos']
WEBVIEW_PLATFORMS = ['android-web... |
"""Util funtions for XBMC server settings."""
from maraschino.tools import using_auth, get_setting_value
from maraschino.models import Module, Setting, XbmcServer
def server_settings():
"""Get settings for active XBMC server instance"""
# query all configured XBMC servers from the db
servers = XbmcServer.qu... |
import os
import signal
import unittest
from test import support
from test.support import script_helper
@unittest.skipUnless(os.name == "posix", "only supported on Unix")
class EINTRTests(unittest.TestCase):
@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()")
def test_all(self):
#... |
import os
import subprocess
import textwrap
from mock import patch, Mock
import pytest
from pretend import stub
import pip
from pip.exceptions import (InstallationError, RequirementsFileParseError)
from pip.download import PipSession
from pip.index import PackageFinder
from pip.req.req_install import InstallRequirement... |
"""QGIS Unit tests for QgsExpression.
.. note:: 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.
"""
__author__ = 'Nathan Woodrow... |
"Demonstrates molecular dynamics for isolated particles."
from ase.calculators.emt import EMT
from ase.cluster.cubic import FaceCenteredCubic
from ase.optimize import QuasiNewton
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution, \
Stationary, ZeroRotation
from... |
import miasm2.expression.expression as m2_expr
jok1 = m2_expr.ExprId("jok1")
jok2 = m2_expr.ExprId("jok2")
jok3 = m2_expr.ExprId("jok3")
jok_small = m2_expr.ExprId("jok_small", 1)
def __ExprOp_cond(op, arg1, arg2):
"Return an ExprOp standing for arg1 op arg2 with size to 1"
ec = m2_expr.ExprOp(op, arg1, arg2)
... |
from analysis_base import *
from vector_map import *
from matrix_map import *
from mechanism import *
from scaling import * |
import avango.osg
import avango.script
from _SliderMouseInteractor import *
from os.path import dirname, join
datapath = join(dirname(__file__), 'data')
print_destruction_of_menu_objects = False
enable_debug_output = False
panel_transition_duration = 0.5 # time for rotation of submenu navigation
panel_title = 'Avango N... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
from OpenGL.raw.GLES2 import _types as _cs
from OpenGL.raw.GLES2._types import *
from OpenGL.raw.GLES2 import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GLES2_INTEL_performance_que... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import remove_start
class CBSNewsIE(InfoExtractor):
IE_DESC = 'CBS News'
_VALID_URL = r'http://(?:www\.)?cbsnews\.com/(?:[^/]+/)+(?P<id>[\da-z_-]+)'
_TESTS = [
{
'url': 'http://ww... |
import netaddr
from oslo.config import cfg
import six
import webob.exc
from nova.api.openstack import extensions
from nova import exception
from nova.i18n import _
from nova import objects
CONF = cfg.CONF
CONF.import_opt('default_floating_pool', 'nova.network.floating_ips')
CONF.import_opt('public_interface', 'nova.net... |
"""Utility functions for FlatBuffers.
All functions that are commonly used to work with FlatBuffers.
Refer to the tensorflow lite flatbuffer schema here:
tensorflow/lite/schema/schema.fbs
"""
import copy
import random
import re
import flatbuffers
from tensorflow.lite.python import schema_py_generated as schema_fb
from ... |
"""Tests for SavedModel."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf import meta_graph_pb2
from tensorflow.python.client import session
from tensorflow.python.frame... |
import pytest
from tests.providers.google.cloud.utils.gcp_authenticator import GCP_AUTOML_KEY
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest, provide_gcp_context
@pytest.mark.backend("mysql", "postgres")
@pytest.mark.credential_file(GCP_AUTOML_KEY)
@pytest.mark.long_running
class Aut... |
import webob.dec
from keystone.common import wsgi
from keystone import config
from keystone.openstack.common import log
from keystone.openstack.common import timeutils
from keystone.openstack.common import versionutils
CONF = config.CONF
LOG = log.getLogger('access')
APACHE_TIME_FORMAT = '%d/%b/%Y:%H:%M:%S'
APACHE_LOG_... |
"""Parsing Ops."""
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import gen_parsing_ops
from tensorflow.python.ops import math_ops
from tensorflow... |
"""
Drivers for CloudSigma API v1.0 and v2.0.
"""
import re
import time
import copy
import base64
try:
import simplejson as json
except:
import json
from libcloud.utils.py3 import b
from libcloud.utils.py3 import httplib
from libcloud.utils.misc import str2dicts, str2list, dict2str
from libcloud.common.base imp... |
from __future__ import generators
class Repository(object):
"""
Base class for a repository provided by a version control system.
"""
def __init__(self, authz):
self.authz = authz or Authorizer()
def close(self):
"""
Close the connection to the repository.
"""
... |
from sympy import Symbol, exp, log, oo, Rational, I, sin, gamma, loggamma, S, \
atan, acot, pi, cancel, E, erf, sqrt, zeta, cos, digamma, Integer, Ei, EulerGamma
from sympy.functions.elementary.hyperbolic import cosh, coth, sinh, tanh
from sympy.series.gruntz import compare, mrv, rewrite, mrv_leadterm, gruntz, \
... |
import operator
from collections import Counter, defaultdict
from functools import partial, reduce
from itertools import chain
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import query_utils, signals, sql
class ProtectedError(IntegrityError):
d... |
from .data_calc import DataCalc
class GearCalc(DataCalc):
def __init__(self):
self.initialize_data()
def initialize_data(self):
self.gears = ['neutral', 'first', 'second', 'third', 'fourth',
'fifth', 'sixth' ]
self.data = self.gears[0]
self.name = 'transmission_ge... |
from __future__ import absolute_import
from .job import ImageInferenceJob
__all__ = ['ImageInferenceJob'] |
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.common import Backend
from lib.core.common import randomStr
from lib.core.common import safeSQLIdentificatorNaming
from lib.core.common import unsafeSQLIdentificatorNaming
from lib.core... |
import mock
from oslotest import mockpatch
import ceilometer.tests.base as base
class TestPollsterBase(base.BaseTestCase):
def setUp(self):
super(TestPollsterBase, self).setUp()
self.inspector = mock.Mock()
self.instance = mock.MagicMock()
self.instance.name = 'instance-00000001'
... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zilencer', '0003_add_default_for_remotezulipserver_last_updated_field'),
]
operations = [
migrations.RemoveField(
model_name='deployment',
name='realms',
),
migr... |
from nova import test
from lxml import etree
import nova.tests.virt.libvirt.fakelibvirt as libvirt
def get_vm_xml(name="testname", uuid=None, source_type='file',
interface_type='bridge'):
uuid_tag = ''
if uuid:
uuid_tag = '<uuid>%s</uuid>' % (uuid,)
return '''<domain type='kvm'>
<na... |
"""Contains object representations of the JSON data for components."""
import re
import time
from googlecloudsdk.core import config
from googlecloudsdk.core import log
from googlecloudsdk.core.util import platforms
from googlecloudsdk.core.util import semver
class Error(Exception):
"""Base exception for the schemas m... |
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtkStructPtsWRT(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._writer... |
import subprocess
import sys
import setup_util
def start(args, logfile, errfile):
setup_util.replace_text("tapestry/hello/src/main/webapp/WEB-INF/resin-web.xml", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")
try:
subprocess.check_call("mvn clean compile war:war", shell=True, cwd="tapestry/hell... |
from .version import __version__ |
"""
Find Squares in image by finding countours and filtering
"""
import math
import cv2.cv as cv
def angle(pt1, pt2, pt0):
"calculate angle contained by 3 points(x, y)"
dx1 = pt1[0] - pt0[0]
dy1 = pt1[1] - pt0[1]
dx2 = pt2[0] - pt0[0]
dy2 = pt2[1] - pt0[1]
nom = dx1*dx2 + dy1*dy2
denom = mat... |
from __future__ import print_function, division, unicode_literals, absolute_import
from builtins import zip, next, range, str
from ....pipeline import engine as pe
from ....interfaces import utility as niu
from ....interfaces import fsl
from ....interfaces import ants
def cleanup_edge_pipeline(name='Cleanup'):
"""
... |
import rmc.emails.sender as sender
def title_renderer(user):
return 'Don\'t forget to enroll in courses!'
def body_renderer(user):
email_body = \
"""If you're on co-op:
Class enrollment appointments for Spring 2013 is happening this week: February 4th - 9th
Open class enrollment begins next ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.