content stringlengths 4 20k |
|---|
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models import Count
from .apps import spectator_apps
class CreatorManager(models.Manager):
def by_publications(self):
"""
The Creators who have been most-read, ordered by number of read
pub... |
"""Base Manager class.
Managers are responsible for a certain aspect of the system. It is a logical
grouping of code relating to a portion of the system. In general other
components should be using the manager to make changes to the components that
it is responsible for.
For example, other components that need to d... |
"""
The GeometryProxy object, allows for lazy-geometries. The proxy uses
Python descriptors for instantiating and setting Geometry objects
corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
from django.contrib.gis import memoryview
from django.utils impor... |
import boto
from boto.compat import json
from boto.connection import AWSQueryConnection
from boto.regioninfo import RegionInfo
from boto.exception import JSONResponseError
from boto.cloudhsm import exceptions
class CloudHSMConnection(AWSQueryConnection):
"""
AWS CloudHSM Service
"""
APIVersion = "2014... |
# Hackery: find the ip address that gets you to Google's DNS
# Trickiness because you might have multiple IP addresses (Virtualbox), or Windows.
# we used to not like giving ip 127.0.0.1 to h2o?
import sys, socket, os, getpass
import h2o_args
# print "h2o_get_ip"
# copied here from h2o_test.py to eliminate a circular... |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import D... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from __future__ import absolute_import, unicode_literals
from ..compat import socketserver
from ..compat import SimpleHTTPServer
from ..base import cv2
import time
import socket
import re
import threading
__all__ = [
'JpegStreamHandler', 'J... |
"""Import voting statements from a CSV file."""
import csv
import datetime
from django.core.management.base import BaseCommand
from django.utils.text import slugify
from ...models import Statement
class Command(BaseCommand):
"""Import voting statements from a CSV file."""
help = "Import voting statements f... |
import time
from threading import Thread
from mock import Mock
from golem.clientconfigdescriptor import ClientConfigDescriptor
from golem.docker.image import DockerImage
from golem.docker.task_thread import DockerTaskThread
from golem.task.taskcomputer import TaskComputer
from golem.tools.ci import ci_skip
from test_... |
#!/usr/bin/python3
__author__ = "Guillaume Bonamis"
__license__ = "MIT"
__copyright__ = "2015, ESRF"
__date__ = "09/07/2020"
import logging
from os.path import dirname, abspath
from freesas.align import InputModels, AlignModels
from freesas.sas_argparser import SASParser
base = dirname(dirname(abspath(__file__)))
lo... |
from template_tests.test_response import test_processor_name
from django.template import RequestContext
from django.template.backends.django import DjangoTemplates
from django.template.library import InvalidTemplateLibrary
from django.test import RequestFactory, ignore_warnings, override_settings
from django.utils.dep... |
'''This file generates shell code for the setup.SHELL scripts to set environment variables'''
from __future__ import print_function
import argparse
import copy
import errno
import os
import platform
import sys
CATKIN_MARKER_FILE = '.catkin'
system = platform.system()
IS_DARWIN = (system == 'Darwin')
IS_WINDOWS = (sy... |
import logging
import re
from autotest.client.shared import utils, error
from virttest import env_process
@error.context_aware
def run(test, params, env):
"""
Check smbios table :
1) Run the qemu command as nobody
2) check the process is same as the user's
:param test: QEMU test object.
:para... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.module_util... |
# -*- coding: utf-8 -*-
import argparse
import json
import os
import signal
import socket
import sys
import threading
import time
import traceback
import urllib2
import uuid
from collections import defaultdict, OrderedDict
from multiprocessing import Process, Event
from .. import localpaths
import sslutils
from wptse... |
"""recent connections"""
import datetime
import fnmatch
import os
from xml.dom import minidom, Node
from flumotion.common import log, common, xdg
from flumotion.common.connection import PBConnectionInfo, parsePBConnectionInfo
from flumotion.common.errors import OptionError
from flumotion.configure import configure
fr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
import struct
class JavaNativeType(object):
class ParseException(Exception): pass
def __init__(self, data):
pass
def __call__(self):
return self._value
def value(self):
return self._value
def get(self):
return self.value()
@staticmethod
def size():
raise Exception("Unimplemented!... |
from m5.params import *
from MemObject import MemObject
class ExternalSlave(MemObject):
type = 'ExternalSlave'
cxx_header = "mem/external_slave.hh"
port = SlavePort("Slave port")
addr_ranges = VectorParam.AddrRange([], 'Addresses served by'
' this port\'s external agent')
port_type = Par... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 3 12:16:17 2017
@author: zhanglu01
"""
import json
import pandas as pd
import matplotlib.pyplot as plot
import ziroomAnalysis.geohash as geohash
def line_json_load(filename):
with open(filename, 'r', encoding='utf-8') as f:
lines = f.readlines()
df =... |
"""Utility to compare (Numpy) version strings.
The NumpyVersion class allows properly comparing numpy version strings.
The LooseVersion and StrictVersion classes that distutils provides don't
work; they don't recognize anything like alpha/beta/rc/dev versions.
"""
from __future__ import division, absolute_import, pri... |
import atexit
import fcntl
import grp
import logging as std_logging
from logging import handlers
import os
import pwd
import signal
import sys
from oslo_log import log as logging
from neutron.common import exceptions
from neutron.i18n import _LE, _LI
LOG = logging.getLogger(__name__)
DEVNULL = object()
# Note: We ... |
"""End-to-end benchmark for batch normalization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import time
from tensorflow.python.client import session as session_lib
from tensorflow.python.framework import constant_op
from ... |
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.goal.task_registrar import TaskRegistrar as task
from pants.contrib.node.subsystems.resolvers.node_preinstalled_module_resolver import (
NodePreinstalledModuleResolver,
)
from pants.contrib.node.subsystems.resolvers.npm_resolver import Np... |
'''
Author: S.T. Castle
Created: 2015-03-15
'''
#import math
import numpy as np
from scipy import ndimage
from scipy import stats
import scipy.ndimage.filters
import scipy.linalg
#import skimage.feature
import cv2
from matplotlib import pyplot as plt
def main():
'''
Run the explicit coherence enhancing filt... |
import grp
import syslog
import platform
class Group(object):
"""
This is a generic Group manipulation class that is subclassed
based on platform.
A subclass may wish to override the following action methods:-
- group_del()
- group_add()
- group_mod()
All subclasses MUST define ... |
"""NS-like base classes."""
import cStringIO
import dns.exception
import dns.rdata
import dns.name
class NSBase(dns.rdata.Rdata):
"""Base class for rdata that is like an NS record.
@ivar target: the target name of the rdata
@type target: dns.name.Name object"""
__slots__ = ['target']
def __ini... |
import string
def build_sql_insert(table, hash_name, items):
""" This statement builds a sql statement for an insert
of 'items' into "table" indexed by "hash_name"
"""
sql = "insert into %s ( %s, %s ) values ( :p0, %s )" % (
table, hash_name,
string.join([a[0] for a in items], ", "... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
from collections import defaultdict
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock
from ansible.template.safe_eval import safe_eval
class TestSafeEval(unittest.TestCas... |
from boto.regioninfo import RegionInfo
class RDSRegionInfo(RegionInfo):
def __init__(self, connection=None, name=None, endpoint=None):
from boto.rds import RDSConnection
RegionInfo.__init__(self, connection, name, endpoint,
RDSConnection) |
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
import werkzeug
import datetime
import time
from openerp.tools.translate import _
class sale_quote(http.Controller):
@http.route([
"/quote/<int:order_id>",
"/quote/<int:order_id>/<token... |
"""Volume snapshot interface (1.1 extension)."""
import six
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from cinderclient import base
class Snapshot(base.Resource):
"""A Snapshot is a point-in-time snapshot of an openstack volume."""
def __repr__(self):
... |
# coding: utf-8
from __future__ import division, unicode_literals
"""
This module implements an XRD pattern calculator.
"""
from six.moves import filter
from six.moves import map
from six.moves import zip
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__mai... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script transfers pages from a source wiki to a target wiki.
It also copies edit history to a subpage.
-tolang: The target site code.
-tosite: The target site family.
-prefix: Page prefix on the new site.
-overwrite: Existing pages... |
from .module import Module, interact
from copy import copy
import time
class Stepper(Module):
# target modes
_MODE_COMPLIANT = 11
_MODE_POWER = 10
_MODE_ROT_SPEED = 8
_MODE_ROT_POSITION = 7
_MODE_TRANS_SPEED = 6
_MODE_TRANS_POSITION = 5
# report modes
_ROTATION_POSITION = 4
_ROT... |
"""
.. dialect:: mssql+pymssql
:name: pymssql
:dbapi: pymssql
:connectstring: mssql+pymssql://<username>:<password>@<freetds_name>/?\
charset=utf8
:url: http://pymssql.org/
pymssql is a Python module that provides a Python DBAPI interface around
`FreeTDS <http://www.freetds.org/>`_. Compatible builds ... |
from datetime import datetime, timedelta
import logging
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from sentry.client.base import SentryClient
from leapfrog.models import *
from leapfrog.poll import facebook
from leapfrog.poll import flickr
from leapfrog.poll ... |
from builtins import str
from past.builtins import basestring
from datetime import datetime
from contextlib import closing
import sys
from sqlalchemy import create_engine
from airflow.hooks.base_hook import BaseHook
from airflow.exceptions import AirflowException
class DbApiHook(BaseHook):
"""
Abstract base... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import inspect
import logging
import unittest
from flask.blueprints import Blueprint
from flask_admin import BaseView
from flask_admin.menu import MenuLink, MenuView
fr... |
"""Object Tree.
Based on a source tree that contains only PIDs and queries, maintain the object
tree that is browsed through the ONEDrive filesystem.
Cache the information on disk between runs of ONEDrive.
"""
import logging
import pickle
import d1_onedrive.impl.clients.onedrive_d1_client
import d1_onedrive.impl.c... |
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
from openerp import pooler, tools
from openerp.report import report_sxw
from openerp.report.interface import report_rml, toxml
from openerp.tools.translate import _
one_week = relativedelta(days=7)
num2day = ['Monday', 'Tuesday... |
"""
Create the numpy.core.umath namespace for backward compatibility. In v1.16
the multiarray and umath c-extension modules were merged into a single
_multiarray_umath extension module. So we replicate the old namespace
by importing from the extension module.
"""
from . import _multiarray_umath
from ._multiarray_umat... |
__author__ = 'keyvan'
from random import randrange, random as rand
def new_offspring(parent):
return type(parent)(parent=parent)
def new_individual(population):
return population.type_of_individuals(population=population)
class IndividualBase(object):
"""
An individual object should be a collection ... |
import os
import sys
import unittest
import ConfigParser
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
from selenium.common import exceptions
from wptserve import server
from wptserve.router import any_method
from wptserve.handlers import basic_auth_handler
class WebDriverAuthT... |
from __future__ import absolute_import
import inspect
from django.utils import six
def getargspec(func):
if six.PY2:
return inspect.getargspec(func)
sig = inspect.signature(func)
args = [
p.name for p in sig.parameters.values()
if p.kind == inspect.Parameter.POSITIONAL_OR_KEYWOR... |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.core.serialize... |
import sys, os, time, glob, shutil
from optparse import OptionParser
import subprocess
# -----------------------------------------------------------------------
vm_paths = {
# the standard path on Mac OS X
'/Library/Application Support/VMware Fusion/vmrun': 'fusion',
# the standard path on Linux
'/usr... |
"Implementation of tzinfo classes for use with datetime.datetime."
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import smart_unicode, smart_str, DEFAULT_LOCALE_ENCODING
class FixedOffset(tzinfo):
"Fixed offset in minutes east from UTC."
def __init__(self, offset):
if i... |
from subprocess import Popen, PIPE
import paramiko
from host import Host
# For use with the 'with' python feature.
class _sshGroup(object):
@classmethod
def closeAll(cls, clients):
if len(clients) == 0:
return
try:
clients[0].close()
finally:
cls.c... |
#!/usr/bin/env python
# coding=utf-8
###############################################################################
import os
import sys
import inspect
import traceback
import optparse
import logging
import configobj
try:
# python 2.6
import unittest2 as unittest
except ImportError:
import unittest
try:... |
import time
import logging
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
class Retry(object):
""" Retry configuration.
Each retry attempt will create a new Re... |
import unittest
from .support import LoggingResult
class Test_FunctionTestCase(unittest.TestCase):
# "Return the number of tests represented by the this test object. For
# TestCase instances, this will always be 1"
def test_countTestCases(self):
test = unittest.FunctionTestCase(lambda: None)
... |
# obsolete - should be deleted if there are no objections.
__author__ = 'Thomas Rueckstiess, <EMAIL>'
from pybrain.utilities import abstractMethod
import threading
class Renderer(threading.Thread):
""" The general interface for a class displays what is happening in an environment.
The renderer is execute... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
from pyghmi.ipmi import command
except ImportError:
command = None
from ansible.module_utils.basic import *
def main():
module = AnsibleModule(
argumen... |
"""
Test the lms/staticbook views.
"""
import textwrap
import mock
import requests
from django.test.utils import override_settings
from django.core.urlresolvers import reverse, NoReverseMatch
from courseware.tests.modulestore_config import TEST_DATA_MIXED_MODULESTORE
from student.tests.factories import UserFactory,... |
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0)
t.write("file.jam", """\
actions quietly .a.
{
echo [$(<:B)] 0
echo [$(<:B)] 1
echo [$(<:B)] 2
}
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
.a. subtest_b : subtest ;
DEPENDS all : subtest_a subtest_b ;
""")
t.run_build_... |
from burp import IBurpExtender
from burp import IHttpListener
from burp import IProxyListener
import re
import sys
import os
urls_in_scope=['testblah.com','qa.ooboob.com']
#Adding directory to the path where Python searches for modules
module_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/Git/WebAppse... |
import os
import sys
import signal
from multiprocessing import util, process
__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close', 'ForkingPickler']
#
# Check that the current thread is spawning a child process
#
def assert_spawning(self):
if not Popen.thread_is_spawning():
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from rest_framework import serializers
from models import Category, Post, Announcement
# initiate logger
logging.getLogger(__name__)
class CategorySerializer(serializers.HyperlinkedModelSerializer):
"""
CategorySerializer
"... |
from __future__ import absolute_import, division, print_function
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
]
__title__ = "packaging"
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packagin... |
#! /usr/bin/python2
import qi
def add(a, b):
return a + b
def fail():
assert(False)
def err():
raise RuntimeError("sdsd")
def test_async_fun():
f = qi.async(add, 21, 21)
assert(f.value() == 42)
def test_async_error():
f = qi.async(err)
assert(f.hasError() == True)
assert(f.error(... |
"""DoMapping generates Elasticsearch mappings from JSON Schemas."""
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
readme = open('README.rst').read()
history = open('CHANGES.rst').read()
tests_require = [
'check-manifest>=0.25',
'cove... |
"""
SDSS Galaxy Colors
------------------
The function :func:`fetch_sdss_galaxy_colors` used below actually queries
the SDSS CASjobs server for the colors of the 50,000 galaxies. Below we
extract the :math:`u - g` and :math:`g - r` colors for 5000 stars, and
scatter-plot the results
"""
# License: BSD
# The figure i... |
"""Redirects for legacy URLs."""
from __future__ import absolute_import, print_function
from datetime import datetime
from functools import wraps
from elasticsearch.exceptions import NotFoundError
from flask import Blueprint, abort, current_app, flash, redirect, \
render_template, request, url_for, jsonify
from ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_ut... |
import sys
import os
import moose
SIMDT = 1e-5
GLDT = 1e-2
RUNTIME = 1000e-3
morphs_dir = '../../../DEMOS/gl-demo/morphologies/'
models = {'CA1':'ca1passive.p',
'Mitral': 'mit.p',
'Purkinje1': 'psmall.p',
'Purkinje2': 'Purk2M9s.p',
'Purkinje3': 'Purkinje4M9.p'
}
CONTEXT = moose.PyMooseBase.getContext... |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for haystack.reverse.structure."""
from __future__ import print_function
import logging
import unittest
from haystack.reverse import re_string
__author__ = "Loic Jaquemet"
__copyright__ = "Copyright (C) 2012 Loic Jaquemet"
__license__ = "GPL"
__maintainer__ = "... |
"""Remote control for MacOS FontLab.
initFontLabRemote() registers a callback for appleevents and
runFontLabRemote() sends the code from a different application,
such as a Mac Python IDE or Python interpreter.
"""
from robofab.world import world
if world.inFontLab and world.mac is not None:
from Carbon import AE as ... |
from pykickstart.version import RHEL6
from pykickstart.base import KickstartCommand
from pykickstart.options import KSOptionParser
class RHEL6_UnsupportedHardware(KickstartCommand):
removedKeywords = KickstartCommand.removedKeywords
removedAttrs = KickstartCommand.removedAttrs
def __init__(self, writePrio... |
#!/usr/bin/env python3
import re, subprocess, sys
DEBUG = False
DRY_RUN = False
NUM_KEEP_PER_BOARD = 4
def main():
ssh_machine = sys.argv[1]
ssh_firmware_dir = sys.argv[2]
# SSH to get list of existing files.
p = subprocess.run(
["ssh", ssh_machine, "find", ssh_firmware_dir, "-name", "\\*-... |
from enigma import iPlayableService
from Source import Source
from Components.PerServiceDisplay import PerServiceBase
from enigma import eDVBResourceManager
class FrontendInfo(Source, PerServiceBase):
def __init__(self, service_source = None, frontend_source = None, navcore = None):
self.navcore = None
Source.__i... |
import uuid
import datetime
from sqlalchemy import Column, MetaData, ForeignKey
from sqlalchemy import types
from sqlalchemy.ext.declarative import declarative_base
from ckan.lib.base import model
log = __import__('logging').getLogger(__name__)
Base = declarative_base()
metadata = MetaData()
"""CANCEL state is equi... |
import unittest
import json
from autosportlabs.racecapture.config.rcpconfig import CANChannels, CANChannel, CANMapping
CAN_CHANNEL_1 = '{"nm":"CHAN1", "ut": "UNITS1", "min":-55, "max":55,"prec":2,"sr":25, "bm": false, "type":0, "bus":0, "id":1234, "idMask":0, "offset":23, "len":19, "subId":-1, "mult":1.23, "div":3.45,... |
import gnubg
def playMatchSeries(statsFile=None, # log file
matchLength=7,
noOfMatches=100,
sgfBasePath=None, # optional
matBasePath=None): # optional
"""Starts noOfMatches matchLength pointers. For every match
the running scor... |
"""Facilities for automatically determining files' correct metadata.
"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from beets import logging
from beets import config
# Parts of external interface.
from .hooks import AlbumInfo, TrackInfo, AlbumMatch, ... |
"""
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.
"""
from __future__ import division, absolute_import, print_function
import sys
import operator
import warnings
from nose.plugins.skip import SkipTest
import numpy as np
from numpy... |
import logging
import unittest
class ImportTest(unittest.TestCase):
def test_import(self):
from namespaced_example_pb2 import NamespacedExample
namespaced_example = NamespacedExample()
namespaced_example.value = "hello"
# Dummy assert, important part is namespaced example was impor... |
import hashlib
import os
from pip._vendor.lockfile import FileLock
from ..cache import BaseCache
def _secure_open_write(filename, fmode):
# We only want to write to this file, so open it in write only mode
flags = os.O_WRONLY
# os.O_CREAT | os.O_EXCL will fail if the file already exists, so we only
... |
import numpy as np
from random import randrange
def eval_numerical_gradient(f, x, verbose=False, h=0.00001):
"""
a naive implementation of numerical gradient of f at x
- f should be a function that takes a single argument
- x is the point (numpy array) to evaluate the gradient at
"""
fx = f(x) # evalua... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
try:
import botocore
except ImportError:
pass # will be detected by i... |
import itertools
class LRUDict(object):
def __init__(self, n):
self.n = n
self.inner = {}
self.counter = itertools.count()
def get(self, key, default=None):
if key in self.inner:
x, value = self.inner[key]
self.inner[key] = self.counter.next(), value
... |
import threading
from openerp.osv import fields, osv
class procurement_compute_all(osv.osv_memory):
_name = 'procurement.order.compute.all'
_description = 'Compute all schedulers'
_columns = {
'automatic': fields.boolean('Automatic orderpoint',help='Triggers an automatic procurement for all produ... |
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
from selenium.common import exceptions
from selenium.webdriver.support import wait
class AlertsTest(base_test.WebDriverBaseTest):
def setUp(self):
self.wait = wait.WebDriverWait(self.... |
from spack import *
class Pangomm(AutotoolsPackage):
"""Pangomm is a C++ interface to Pango."""
homepage = "http://www.pango.org/"
url = "https://ftp.gnome.org/pub/GNOME/sources/pangomm/2.14/pangomm-2.14.1.tar.gz"
version('2.43.1', sha256='00483967b4ed0869da09dc0617de45625b9ab846c7b07aa25dfc940... |
import gedit
import gtk
import gnomevfs
import os.path
class ExtractPartialPlugin(gedit.Plugin):
ui_str = """
<ui>
<menubar name="MenuBar">
<menu name="EditMenu" action="Edit">
<placeholder name="EditOps_6">
<menuitem action="ExtractPartial"/>
</placeholder>
... |
from rest_framework import serializers
from callcenter.models import Queue
class QueueSerializer(serializers.HyperlinkedModelSerializer):
"""
**Create**:
CURL Usage::
curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "queue name"}' htt... |
"""Spawn a command with pipes to its stdin, stdout, and optionally stderr.
The normal os.popen(cmd, mode) call spawns a shell command and provides a
file interface to just the input or output of the process depending on
whether mode is 'r' or 'w'. This module provides the functions popen2(cmd)
and popen3(cmd) which r... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 6 16:52:06 2015
@author: hugobowne-anderson
"""
#http://zetcode.com/db/sqlitepythontutorial/
import sqlite3 as lite
import sys
import json
import unicodedata
###########MAKE LIST OF TWEETS:################
##set deirectory here:
tweets_data_path = '/Users/hugobowne-a... |
from distutils import log, dir_util
import os
from setuptools import Command
from setuptools.archive_util import unpack_archive
import pkg_resources
class install_egg_info(Command):
"""Install an .egg-info directory for the package"""
description = "Install an .egg-info directory for the package"
user_... |
"""Tests for gmock.scripts.generator.cpp.gmock_class."""
__author__ = '<EMAIL> (Neal Norwitz)'
import os
import sys
import unittest
# Allow the cpp imports below to work when run as a standalone script.
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from cpp import ast
from cpp import gmock_class
... |
"""A Compute InstanceTemplate.
See:
https://cloud.google.com/compute/docs/reference/latest/instanceTemplates
"""
from google.cloud.security.common.gcp_type import key
class InstanceTemplate(object):
"""Represents InstanceTemplate resource."""
def __init__(self, **kwargs):
"""InstanceTemplate reso... |
from __future__ import print_function
__authors__ = "Heng Luo"
from pylearn2.testing.skip import skip_if_no_gpu
skip_if_no_gpu()
import numpy as np
from theano.compat.six.moves import xrange
from theano import shared
from theano.tensor import grad, constant
from pylearn2.sandbox.cuda_convnet.filter_acts import Filte... |
r"""Utilities to compile possibly incomplete Python source code.
This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:
- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise Sy... |
from thrift.Thrift import *
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class TBase(object):
__slots__ = []
def __repr__(self):
L = ['%s=%r' % (key, getattr(self, key))
for key in ... |
import logging
from threading import Thread
import time
from odoo.addons.hw_drivers.main import drivers, interfaces, iot_devices
_logger = logging.getLogger(__name__)
class InterfaceMetaClass(type):
def __new__(cls, clsname, bases, attrs):
new_interface = super(InterfaceMetaClass, cls).__new__(cls, clsn... |
{
"name": "Croatia - RRIF 2012 COA",
"description": """
Croatian localisation.
======================
Author: Goran Kliska, Slobodni programi d.o.o., Zagreb
http://www.slobodni-programi.hr
Contributions:
Tomislav Bošnjaković, Storm Computers: tipovi konta
Ivan Vađić, Slobodni programi: tipovi kont... |
# $Id: arp.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Address Resolution Protocol."""
from __future__ import absolute_import
from . import dpkt
# Hardware address format
ARP_HRD_ETH = 0x0001 # ethernet hardware
ARP_HRD_IEEE802 = 0x0006 # IEEE 802 hardware
# Protocol address format
ARP_PRO_IP =... |
"""
Form classes
"""
from __future__ import unicode_literals
import copy
from collections import OrderedDict
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.forms.fields import Field, FileField
# pretty_name is imported for backwards compatibility in Django 1.9
from django.forms.util... |
"""
Unit tests for instructor_dashboard.py.
"""
import ddt
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.test.utils import override_settings
from courseware.tabs import get_course_tab_list
from courseware.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.