content stringlengths 4 20k |
|---|
import datetime
import json
import requests
from django.test.utils import override_settings
from django.utils.timezone import now
from requests.models import Response
import pytest
from mock import patch
from shuup.admin.modules.system import SystemModule
from shuup.admin.views.dashboard import DashboardView
from shu... |
'''
This module provides a basic "weak method" implementation. It is necessary
because the weakref module does not support weak methods (in the sense that,
counter-intuitively, a user who creates a weakref.ref(obj.method), a reasonable
action, get a weak ref that is None.
:copyright: Copyright 2006-2009 by Oliver Sch... |
import datetime
from django.db import DJANGO_VERSION_PICKLE_KEY, models
from django.utils import six
from django.utils.translation import ugettext_lazy as _
def standalone_number():
return 1
class Numbers(object):
@staticmethod
def get_static_number():
return 2
class PreviousDjangoVersionQuer... |
import os
import tempfile
class PrettyPatch(object):
# FIXME: PrettyPatch should not require checkout_root.
def __init__(self, executive, checkout_root):
self._executive = executive
self._checkout_root = checkout_root
def pretty_diff_file(self, diff):
# Diffs can contain multiple ... |
"""
PushBullet platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.pushbullet/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA, ATTR_TARGET, ATTR_TITLE, ATTR_TITLE... |
"""
################################################################################
# Copyright (c) 2003, Pfizer
# Copyright (c) 2001, Cayce Ullman.
# Copyright (c) 2001, Brian Matthews.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provid... |
from django.contrib.auth import models as auth
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
# No related name is needed here, since symmetrical relations are not
# explicitly reversible.
@python_2_unicode_compatible
class SelfRefer(models.Model):
name = models.CharFie... |
from __future__ import unicode_literals
from django.test import TestCase
from django.utils import six
from .models import (
A, B, C, Building, Chick, Child, Class, Client, ClientStatus, Connection,
Country, Device, Enrollment, Hen, Item, Organizer, Person, Port,
SpecialClient, State, Student, TUser,
)
c... |
#coding:utf-8
import glob
from xml.etree import ElementTree
desc=""
def print_node(node):
'''''打印结点基本信息'''
print node.text
def read_xml(text):
'''''读xml文件'''
# 加载XML文件(2种方法,一是加载指定字符串,二是加载指定文件)
# root = ElementTree.parse(r"D:/test.xml")
root = ElementTree.fromstring(text)
... |
#!/usr/bin/env python3
import os
import sys
from streamlink import __version__ as streamlink_version
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolu... |
"""
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_diabetes
from .base import load_digits
from .base import load_files
from .base import load_iris
from .... |
from nox.webapps.webservice import webservice
from nox.lib.config import version
from nox.lib.core import *
import simplejson
#
# Verifies that component name exists
#
class WSPathExistingComponent(webservice.WSPathComponent):
def __init__(self, component):
webservice.WSPathComponent.__init__(self)
... |
from __future__ import unicode_literals
import logging
import sys
import types
from django import http
from django.conf import settings
from django.core import urlresolvers
from django.core import signals
from django.core.exceptions import MiddlewareNotUsed, PermissionDenied, SuspiciousOperation
from django.db import... |
# xml.etree test for cElementTree
from test import support
from test.support import precisionbigmemtest, _2G
import unittest
cET = support.import_module('xml.etree.cElementTree')
# cElementTree specific tests
def sanity():
r"""
Import sanity.
>>> from xml.etree import cElementTree
Issue #6697.
... |
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
os.path.split(parent_dir)[1] == 'pygame')
if not is_pygame_pkg:
sys.path.inser... |
from core.util import nonone, dedupe
from .base import DocumentGUIObject
from ..model.completion import CompletionList
class CompletableEdit(DocumentGUIObject):
def __init__(self, mainwindow):
super().__init__(mainwindow.document)
self.mainwindow = mainwindow
self._attrname = ''
se... |
from gnuradio import gr, gr_unittest
import math
class test_interleave (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_int_001 (self):
lenx = 64
src0 = gr.vector_source_f (range (0, lenx, 4))
src1 = ... |
"""
Eniro Sweden (Denmark) map service plugin. Opens place in kartor.eniro.se
"""
#------------------------------------------------------------------------
#
# python modules
#
#------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.tr... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# http://binux.me
# Created on 2015-01-18 11:10:27
import os
import copy
import time
import httpbin
import unittest2 as unittest
import logging
import logging.config
logging.config.fileConfig("pyspider/logging.co... |
import argparse
import math
import re
class Experiment(object):
def __init__(self, commit, params):
self.commit = commit
self.params = dict([
tuple(kv.split('=')) for kv in params.split(',')
])
self.outputs = []
class Results(dict):
def __init__(self, *args, **kwarg... |
"""The tests for Humidifier device triggers."""
import datetime
import pytest
import voluptuous_serialize
import homeassistant.components.automation as automation
from homeassistant.components.humidifier import DOMAIN, const, device_trigger
from homeassistant.const import ATTR_SUPPORTED_FEATURES, STATE_OFF, STATE_ON
... |
# Python imports
# Don't add any from __future__ imports here. This code should execute
# against standard Python.
import unittest
import datetime
import mmap
import os
import resource
# Project imports
import posix_ipc
# Hack -- add tests directory to sys.path so Python 3 can find base.py.
import sys
sys.path.insert(... |
import os
import logging
from collections import defaultdict
from common import checkFileExists
from defaultValues import DefaultValues
from seqUtils import readSeqStats
from greedy import Greedy, Contig, Core, readContigIdtoBinId
from genomicSignatures import GenomicSignatures
from distributions import Distribu... |
from __future__ import absolute_import
__all__ = ['Parser']
# python imports
import struct
import zlib
import logging
# kaa imports
#import kaa
# use strutils instead of kaa
from .. import strutils as kaa
# import kaa_metadata.image core
from . import core
# get logging object
log = logging.getLogger('metadata')
... |
import logging
from airflow.hooks import HiveServer2Hook, MySqlHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from tempfile import NamedTemporaryFile
class HiveToMySqlTransfer(BaseOperator):
"""
Moves data from Hive to MySQL, note that for now the data is loa... |
from hachoir_py3.field import Field, FieldError
from hachoir_py3.stream import InputStream
from hachoir_py3.core.endian import BIG_ENDIAN, LITTLE_ENDIAN, MIDDLE_ENDIAN
from hachoir_py3.core.event_handler import EventHandler
class ParserError(FieldError):
"""
Error raised by a field set.
@see: L{FieldErro... |
'''
Copyright (c) 2015, Laura Eckman
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, publish, distribute, ... |
import errno
import os
import socket
import sys
import time
import warnings
import eventlet
from eventlet.hubs import trampoline, notify_opened, IOClosed
from eventlet.support import get_errno, six
__all__ = [
'GreenSocket', '_GLOBAL_DEFAULT_TIMEOUT', 'set_nonblocking',
'SOCKET_BLOCKING', 'SOCKET_CLOSED', 'CO... |
from operator import itemgetter
import threading
import time
import traceback
import uuid
from CodernityDB.database import RecordDeleted
from couchpotato import get_db
from couchpotato.api import addApiView, addNonBlockApiView
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encodin... |
from distutils.core import setup
setup(name='ConnPlotter',
version='0.7a',
description=('ConnPlotter is a tool to create ' +
'connectivity pattern tables'),
author='Hans Ekkehard Plesser (Idea: Eilen Nordlie)',
author_email='<EMAIL>',
url='https://www.nest-simulator.org... |
import re
from openerp.osv import orm, fields
class AbstractConfigSettings(orm.AbstractModel):
_name = 'abstract.config.settings'
_description = 'Abstract configuration settings'
# prefix field name to differentiate fields in company with those in config
_prefix = 'setting_'
# this is the class n... |
"""Common routines to use CuDNN."""
import atexit, ctypes, os
import numpy
from chainer import cuda
import libcudnn
enabled = int(os.environ.get('CHAINER_CUDNN', '1')) != 0
available = True
def get_ptr(x):
return ctypes.c_void_p(x.ptr)
class Auto(object):
"""Object to be destoryed automatically."""
def... |
from __future__ import absolute_import
from mock import patch
from django.test import TestCase
from track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase):
def setUp(self):
super(TestMongoBackend, self).setUp()
self.mongo_patcher = patch('track.backends.mongodb.MongoClient'... |
"""JSONAlchemy errors."""
class JSONAlchemyException(Exception):
"""Base exception."""
pass
class FieldParserException(JSONAlchemyException):
"""Raised when some error happens parsing field definitions."""
pass
class ModelParserException(JSONAlchemyException):
"""Raised when some error ha... |
import base64
import md5
import cPickle as pickle
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class SessionManager(models.Manager):
def encode(self, session_dict):
"""
Returns the given session dictionary pickled and encode... |
# -*- coding: utf-8 -*-
"""
Capacity scaling minimum cost flow algorithm.
"""
__author__ = """ysitu <<EMAIL>>"""
# Copyright (C) 2014 ysitu <<EMAIL>>
# All rights reserved.
# BSD license.
__all__ = ['capacity_scaling']
from itertools import chain
from math import log
import networkx as nx
from ...utils import Binary... |
"""
The Health check interface
"""
class HealthCheck(object):
"""
All healthcheck plugins should inherit this class
"""
def __init__(self, script, plugin_config=None):
"""
Init function of the class
Args:
script - The health check script
... |
import os
import bpy
from ..properties.nodes import AppleseedOSLNode
from ..utils import util
class ASTEX_OT_convert_textures(bpy.types.Operator):
"""
Converts base textures into mipmapped .tx textures for rendering
"""
bl_label = "Convert Textures"
bl_description = "Convert textures"
bl_idn... |
import cStringIO
import difflib
import os
import sys
import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
sys.path.append(BUILD_TOOLS_DIR)
import easy_template
class EasyTemplateTestCase(unittest.TestCase):
def _RunTest(self, template, expected, temp... |
"""
Enable HipChat notifications of build execution.
:Parameters:
* **enabled** *(bool)*: general cut off switch. If not explicitly set to
``true``, no hipchat parameters are written to XML. For Jenkins HipChat
plugin of version prior to 0.1.5, also enables all build results to be
reported in HipChat roo... |
#: E501
a = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
#: E501
a = '1234567890123456789012345678901234567890123456789012345678901234567890' or \
6
#: E501
a = 7 or \
'1234567890123456789012345678901234567890123456789012345678901234567890' or \
6
#: E501 E501
a = 7 or ... |
"""
Robust linear estimator fitting
===============================
Here a sine function is fit with a polynomial of order 3, for values
close to zero.
Robust fitting is demoed in different situations:
- No measurement errors, only modelling errors (fitting a sine with a
polynomial)
- Measurement errors in X
- M... |
"""
SOAP support for twisted.web.
Requires SOAPpy 0.10.1 or later.
Maintainer: Itamar Shtull-Trauring
Future plans:
SOAPContext support of some kind.
Pluggable method lookup policies.
"""
# SOAPpy
import SOAPpy
# twisted imports
from twisted.web import server, resource, client
from twisted.internet import defer
... |
import orange
import numpy
import scipy.special
import scipy.optimize
import scipy.stats
from pylab import *
def sqrtm(mat):
""" Retruns the square root of the matrix mat """
U, S, V = numpy.linalg.svd(mat)
D = numpy.diag(numpy.sqrt(S))
return numpy.dot(numpy.dot(U,D),V)
def standardize(mat):
""... |
from opencampus.common.db import db
from opencampus.common.models import Campus
from opencampus.module.lecture.models import Lecture, LectureAnalogue
def load_student_ids(campus_id):
page = 0
student_ids = []
while True:
lectures = Lecture.objects(campus_id=campus_id).skip(20*page).limit(20)
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GdalAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************... |
from telemetry.core import util
from telemetry.core.backends.chrome import inspector_timeline
from telemetry.unittest import tab_test_case
class InspectorTimelineTabTest(tab_test_case.TabTestCase):
"""Test case that opens a browser and creates and then checks an event."""
def _WaitForAnimationFrame(self):
""... |
import supriya.exceptions
from supriya import CalculationRate
from supriya.realtime.ServerObject import ServerObject
class BusGroup(ServerObject):
"""
A bus group.
::
>>> server = supriya.Server.default().boot()
>>> bus_group = supriya.BusGroup(bus_count=4)
>>> bus_group
... |
microcode = '''
# FXAM
''' |
from bpy import data, types, context
from .. import logger
def _camera(func):
"""
:param func:
"""
def inner(name, *args, **kwargs):
"""
:param name:
:param *args:
:param **kwargs:
"""
if isinstance(name, types.Camera):
camera = name
... |
from __future__ import division
from whoosh.compat import b, u
from whoosh.query import qcore, terms, compound, wrappers
from whoosh.util.times import datetime_to_long
class RangeMixin(object):
# Contains methods shared by TermRange and NumericRange
def __repr__(self):
return ('%s(%r, %r, %r, %s, %s... |
# ------------------------------------------------------------------------------------------ #
# Description : Python implementation of ray tracing equations stated in PhD thesis of Rice (1997)
# Electron/proton stratification according to Yabroff (1961) + IRI model available
# Geometry... |
import atexit
import collections
import contextlib
import ctypes
import logging
import os
import platform
import re
import socket
import struct
import subprocess
import sys
import time
import zipfile
from telemetry.core import exceptions
from telemetry.core.platform import desktop_platform_backend
from telemetry.core.... |
# coding: utf-8
from __future__ import with_statement
import os
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import translation
class ContentTypeTests(TestCase):
def test_verbose_name(self):
... |
from oedes import *
from oedes.fvm import mesh1d
from oedes.models import BaseModel, Poisson, AppliedVoltage
L = 100e-9
v0 = 1.
v1 = -1.
mesh = mesh1d(L)
def run_poisson(bc):
b = BaseModel()
b.poisson = Poisson(mesh)
b.poisson.bc = bc
params = {'T': 300., 'electrode0.voltage': v0, 'electrode1.voltage'... |
"""Filter out tests based on file differences compared to merge target branch"""
from __future__ import print_function
import re
import six
from subprocess import check_output
class TestSuite:
"""
Contains label to identify job as belonging to this test suite and
triggers to identify if changed files are rele... |
"""
Module for abstract serializer/unserializer base classes.
"""
from django.db import models
from django.utils import six
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class SerializationError(Exception):
"""Something bad happened during serialization."""
... |
from grow.pods import pods
from grow.server import main
from grow.testing import testing
import unittest
import webapp2
class PodHandlerTestCase(unittest.TestCase):
def test_request(self):
self.dir_path = testing.create_test_pod_dir()
pod = pods.Pod(self.dir_path)
# When serving a pod, s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os
from ansible.errors import AnsibleError, AnsibleParserError, AnsibleAssertionError
from ansible.module_utils.six import iteritems, binary_type, text_type
from ansible.playbook.attribute import FieldAtt... |
import os
filename = os.path.join (os.path.dirname (__file__), 'mesh_indices.h')
class_names = ['VertexIndex', 'HalfEdgeIndex', 'EdgeIndex', 'FaceIndex']
################################################################################
f = open (filename, 'w')
f.write ('/*\n')
f.write (' * Software License Agreem... |
from oslo_serialization import jsonutils
import webob
def webob_factory(url):
"""Factory for removing duplicate webob code from tests."""
base_url = url
def web_request(url, method=None, body=None):
req = webob.Request.blank("%s%s" % (base_url, url))
if method:
req.content_ty... |
"""Implementation of DPLL algorithm
Further improvements: eliminate calls to pl_true, implement branching rules,
efficient unit propagation.
References:
- http://en.wikipedia.org/wiki/DPLL_algorithm
- http://bioinformatics.louisville.edu/ouyang/MingOuyangThesis.pdf
"""
from __future__ import print_function, divis... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class hr_recruitment_partner_create(osv.osv_memory):
_name = 'hr.recruitment.partner.create'
_description = 'Create Partner from job application'
_columns = {
'close': fields.boolean('Close job request'),
}
... |
import json
from normalizer.modules.basenormalizer import BaseNormalizer
class DionaeaCaptures(BaseNormalizer):
channels = ('dionaea.capture', 'dionaea.capture.anon', 'dionaea.captures')
def normalize(self, data, channel, submission_timestamp, ignore_rfc1918=True):
o_data = self.parse_record_data(dat... |
from __future__ import absolute_import
from __future__ import unicode_literals
from setuptools import setup, find_packages
setup(
name="lamprey",
version="0.1.0a1",
description='Lamprey is a Yesql-inspired wrapper around mysqlclient',
license='MIT',
keywords='lamprey mysql mysqlclient mariadb datab... |
import DirectILL_common as common
import ILL_utilities as utils
from mantid.api import (AlgorithmFactory, DataProcessorAlgorithm, InstrumentValidator, ITableWorkspaceProperty,
MatrixWorkspaceProperty, Progress, PropertyMode, WorkspaceProperty, WorkspaceUnitValidator)
from mantid.kernel import (C... |
{
'name': 'Claims Management',
'version': '1.0',
'category': 'Customer Relationship Management',
'description': """
Manage Customer Claims.
=======================
This application allows you to track your customers/suppliers claims and grievances.
It is fully integrated with the email gateway so that... |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
AUTHOR = 'Alexis Métaireau'
SITENAME = "Alexis' log"
SITEURL = 'http://blog.notmyidea.org'
TIMEZONE = 'UTC'
GITHUB_URL = 'http://github.com/ametaireau/'
DISQUS_SITENAME = "blog-notmyidea"
PDF_GENERATOR = False
REVERSE_CATEGORY_ORDER = True... |
import multiprocessing
import os
import SimpleHTTPServer
class LocalHTTPServer(object):
"""Class to start a local HTTP server as a child process."""
def __init__(self, serve_dir):
parent_conn, child_conn = multiprocessing.Pipe()
self.process = multiprocessing.Process(target=_HTTPServerProcess,
... |
#This file was originally generated by PyScripter's unitest wizard
import unittest
from gol01 import Gol01
def dummy():
""" Dummy function for comparison of the return values """
return
# tdd = test first
# input -> output
# Ich moechte testen, ob ein Feld 0 Nachbarn hat
# Ich teste die Nachbarn ... |
import unittest
# pylint: disable=F0401
import mojo.embedder
from mojo.bindings import messaging
from mojo import system
class _ForwardingConnectionErrorHandler(messaging.ConnectionErrorHandler):
def __init__(self, callback):
self._callback = callback
def OnError(self, result):
self._callback(result)
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from zope.interface import implementer
from scrapy.interfaces import ISpiderLoader
from scrapy.utils.misc import walk_modules
from scrapy.utils.spider import iter_spider_classes
@implementer(ISpiderLoader)
class SpiderLoader(object):
"""
SpiderL... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
class pos_details(report_sxw.rml_parse):
def _get_invoice(self, inv_id):
res={}
if inv_id:
self.cr.execute("select number from account_invoice as ac where id = %s", (inv_id,))
res = self.cr.fetch... |
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.core.hardware import *
from awlsim.core.operators import AwlOperator
from awlsim.core.datatypes import AwlOffset
class HardwareInterface(AbstractHardwareInterface):
name = "debug"
para... |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class perl_XML_RegExp(test.test):
"""
Autotest module for testing basic functionality
of perl_XML_RegExp
@author Ramya BS <<EMAIL>> ... |
CHAR_MAX = 127
CHAR_MIN = -128
DBL_MAX = 1.7976931348623157e+308
DBL_MIN = 2.2250738585072014e-308
FLT_MAX = 3.4028234663852886e+38
FLT_MIN = 1.1754943508222875e-38
INT_MAX = 2147483647
INT_MIN = -2147483648
LLONG_MAX = 9223372036854775807
LLONG_MIN = -9223372036854775808
LONG_MAX = 2147483647
LONG_MIN = -21... |
import re
from sqlalchemy import Column, TIMESTAMP, func, text, String
from sqlalchemy.dialects import postgresql
from sqlalchemy.ext.declarative import declared_attr
from decaf_storage.json_base import JsonEncodedDict
__author__ = ''
class TimestampMixin(object):
created_at = Column(TIMESTAMP, default=func.no... |
# imports - standard imports
import os, shutil
from distutils.command.clean import clean as Clean
from setuptools import setup, find_packages
import re, ast
# get version from __version__ variable in frappe/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('requirements.txt') as f:
install_r... |
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
# Contest: Google Code Jam - 2014 Round 1C
# Problem: B. Reordering Train Cars
# URL: https://code.google.com/codejam/contest/3004486/dashboard#s=p1
# Strategy:
# permutatable_count()
# aaa, a, abba のように先頭と末尾が同じ文字の car が n 個以上出てくる場合は、
# それぞれの順番は入れ替えが可能なので、n!... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from jinja2.exceptions import TemplateNotFound
from tekton import router
from tekton.gae.middleware.response import ResponseBase
from tekton.gae.middleware import Middleware
from config import template
class TemplateResponse(ResponseBa... |
#!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... |
from django.contrib import admin
from django import forms
from django.db import models
from django.conf import settings
from academic.people.models import *
class PersonAdmin(admin.ModelAdmin):
filter_horizontal = [
'affiliation',]
list_display_links = (
'photo',
'first_name',
... |
# -*- encoding: utf-8 -*-
from nose.tools import *
from nose import SkipTest
import networkx as nx
from networkx.utils import *
def test_is_string_like():
assert_true(is_string_like("aaaa"))
assert_false(is_string_like(None))
assert_false(is_string_like(123))
def test_iterable():
assert_false(iterable... |
from __future__ import absolute_import
from __future__ import print_function
import re
import textwrap
from twisted.internet import defer
from twisted.internet import reactor
from zope.interface import implementer
from buildbot import util
from buildbot.interfaces import IRenderable
from buildbot.process import buil... |
from django.db import connection, models
from django.db.backends.utils import truncate_name
from django.test import TestCase
from .models.article import Article, Site
from .models.publication import Publication
class Advertisement(models.Model):
customer = models.CharField(max_length=100)
publications = mode... |
__docformat__ = 'reStructuredText'
'''
Doc...
:Author: kmu
:Created: 08. June 2010
'''
import os
import logging
from datetime import timedelta, datetime
execfile(os.path.join(os.path.dirname(__file__), "set_pysenorge_path.py"))
from pysenorge.tools.date_converters import iso2datetime
scriptname = "wind_1... |
from django.db import connection
from django.contrib.gis.gdal import GDAL_VERSION
from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite
from django.utils import unittest
test_srs = ({'srid' : 4326,
'auth_name' : ('EPSG', True),
'auth_srid' : 4326,
'srt... |
"""Deploy the Dependency Graph Viewer to Firebase hosting."""
import shutil
import subprocess
import tempfile
from pathlib import Path
FIREBASE_PROJECT = 'chromium-dependency-graph'
JS_DIR = Path(__file__).parent / 'js'
def _Prompt(message):
"""Prompt the user with a message and request affirmative outcome."""... |
"""distutils.pypirc
Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import os
from ConfigParser import ConfigParser
from distutils.cmd import Command
DEFAULT_PYPIRC = """\
[distutils]
index-servers =
pypi
[pypi]
username:%s
passwor... |
# -*- coding: utf-8 -*-
"""
Weixin OAuth2 backend
"""
from requests import HTTPError
from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthCanceled, AuthUnknownError
class WeixinOAuth2(BaseOAuth2):
"""Weixin OAuth authentication backend"""
name = 'weixin'
ID_KEY = 'openid'
AU... |
from enum import Enum
import pyglet
from pyglet.gl import GLubyte, glFlush
import numpy as np
from ctypes import POINTER
# Setting this env variable was needed to let pyglet find libc:
# export DYLD_FALLBACK_LIBRARY_PATH=/usr/lib
class DKWMRenderer(object):
""" A renderer for the DKWM gym.
Holds and dis... |
"""Unit test for Google Test's --gtest_list_tests flag.
A user can ask Google Test to list all tests by specifying the
--gtest_list_tests flag. This script tests such functionality
by invoking gtest_list_tests_unittest_ (a program written with
Google Test) the command line flags.
"""
__author__ = '<EMAIL> (Patrick H... |
from __future__ import division
"""
test_vamp_probit.py: tests for ML-VAMP for probit estimation
"""
# Add the path to the vampyre package and import it
import env
env.add_vp_path()
import vampyre as vp
# Add other packages
import numpy as np
import unittest
def debias_mse(zhat,ztrue):
"""
If zhat and ztrue... |
import lru
class ormcache(object):
""" LRU cache decorator for orm methods,
"""
def __init__(self, skiparg=2, size=8192, multi=None, timeout=None):
self.skiparg = skiparg
self.size = size
self.method = None
self.stat_miss = 0
self.stat_hit = 0
self.stat_err ... |
import pandas as pd
import numpy as np
class TS(object):
"""
The TS class represents the base object of a time series.
"""
def __init__(self, gpi, lon, lat, data, metadata):
"""
Initialization of the time series object.
Parameters
----------
lon : float
... |
import os
from xen.xend import uuid
from xen.xend.XendLogging import log
from xml.dom import minidom
from xml.dom import Node
class XendStateStore:
"""Manages persistent storage of Xend's internal state, mainly
relating to API objects.
It stores objects atomically in the file system as flat XML files
... |
from oslo_config import cfg
from nova.network.security_group import neutron_driver
from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
def fake_get(*args, **kwargs):
nova_group = {}
nova_group['... |
# <pep8-80 compliant>
bl_info = {
"name": "RoR Importer",
"author": "ulteq",
"version": (0, 0, 2),
"blender": (2, 82, 0),
"category": "RoR",
}
import bpy
import json
import bmesh
from bpy.props import StringProperty
from bpy_extras.io_utils import ImportHelper
def register():
bpy.context.pref... |
#!/env/python
# -*- encoding: utf-8 -*-
"""
@version: 0.1
@author: wenzhiquan
@contact: <EMAIL>
@site: http://github.wenzhiquan.com
@software: PyCharm
@file: userQuality.py
@time: 16/5/19 下午3:50
@description: null
"""
from datetime import datetime
from config import config
from lib import stdLib
def userQuality(func... |
"""Home Assistant command line scripts."""
import argparse
import asyncio
import importlib
import logging
import os
import sys
from typing import List, Optional, Sequence, Text
from homeassistant import runner
from homeassistant.bootstrap import async_mount_local_lib_path
from homeassistant.config import get_default_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.