content string |
|---|
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Order.refunded_time'
db.add_column('shoppingcart_order', 'refunded_time',
... |
"""DNS Result Codes."""
import dns.exception
NOERROR = 0
FORMERR = 1
SERVFAIL = 2
NXDOMAIN = 3
NOTIMP = 4
REFUSED = 5
YXDOMAIN = 6
YXRRSET = 7
NXRRSET = 8
NOTAUTH = 9
NOTZONE = 10
BADVERS = 16
_by_text = {
'NOERROR' : NOERROR,
'FORMERR' : FORMERR,
'SERVFAIL' : SERVFAIL,
'NXDOMAIN' : NXDOMAIN,
'NO... |
from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import HttpResponse, Http404
from django.template import loader, TemplateDoesNotExist, RequestContext
from django.utils import feedgenera... |
from pants.backend.jvm.targets.exportable_jvm_library import ExportableJvmLibrary
from pants.backend.jvm.targets.junit_tests import JUnitTests
class JavaLibrary(ExportableJvmLibrary):
"""A Java library.
Normally has conceptually-related sources; invoking the ``compile`` goal
on this target compiles Java ... |
from odoo.tests import Form
from odoo.tests.common import TransactionCase
class TestOnchangeProductId(TransactionCase):
"""Test that when an included tax is mapped by a fiscal position, the included tax must be
subtracted to the price of the product.
"""
def setUp(self):
super(TestOnchangePro... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
get_element_by_attribute,
clean_html,
)
class TechTalksIE(InfoExtractor):
_VALID_URL = r'https?://techtalks\.tv/talks/[^/]*/(?P<id>\d+)/'
_TEST = {
'url': 'http://techtalks.tv/talks/lea... |
"""
Tests for the data directory support.
"""
from __future__ import division, absolute_import
try:
from twisted.python import _appdirs
except ImportError:
_appdirs = None
from twisted.trial import unittest
class AppdirsTests(unittest.TestCase):
"""
Tests for L{_appdirs}.
"""
if not _appdir... |
"""
==========================
GitSuperRepository Package
==========================
The GitSuperRepository package provides the GitSuperRepository class, which
presents an Python interface to a git repository. This repository may contain
submodules which are stored upstream in various version control systems
includin... |
"""This file provides the opening handshake processor for the WebSocket
protocol version HyBi 00.
Specification:
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00
"""
# Note: request.connection.write/read are used in this module, even though
# mod_python document says that they should be used only i... |
#!/usr/bin/env python
import sys, time
# sys.path.append('gen-py')
from ThriftSecureEventTransmissionService import ThriftSecureEventTransmissionService
from ThriftSecureEventTransmissionService.ttypes import *
from thrift import Thrift
from thrift.transport import TSSLSocket
from thrift.transport import TTransport
... |
from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
def execute(filters=None):
if not filters: filters = {}
columns = get_columns(filters)
data = get_entries(filters)
return columns, data
def get_columns(filters):
if not filters.get("doc_type"):
msgprint(_("Please select t... |
import sys
import numpy as np
import matplotlib.pyplot as plt
def ssdwpfunc(individuals, frequencies):
"""
Returns the sums squares deviation within populations from the population frequencies.
individuals[pop] = counts
frequencies[pop, haplotype] = freq
"""
ssdwp = 0.0
n_pop = frequencie... |
import os
os.environ['CUDA_VISIBLE_DEVICES'] = ''
import paddle.fluid as fluid
import sys
def generate_spec(filename):
with open(filename, 'w') as f:
ops = fluid.core._get_use_default_grad_op_desc_maker_ops()
for op in ops:
f.write(op + '\n')
def read_spec(filename):
with open(... |
# coding: utf-8
"""
Acceptance tests for Studio's Setting pages
"""
from __future__ import unicode_literals
from nose.plugins.attrib import attr
from base_studio_test import StudioCourseTest
from bok_choy.promise import EmptyPromise
from ...fixtures.course import XBlockFixtureDesc
from ..helpers import create_user_par... |
import random
params = {}
def run(graph, setup, params):
"""
Color a graph using min-conflicts:
First generate a random coloring for the graph.
Until there are no conflicts in the graph,
choose a random node in the graph, and change it to have the color
which reduces the number of co... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_move_line_reconcile_select(osv.osv_memory):
_name = "account.move.line.reconcile.select"
_description = "Move line reconcile select"
_columns = {
'account_id': fields.many2one('account.account', 'Account', \
... |
"""
.. module:: editor_subscribe_label_deleted
The **Editor Subscribe Label Deleted** Model.
PostgreSQL Definition
---------------------
The :code:`editor_subscribe_label_deleted` table is defined in the MusicBrainz Server as:
.. code-block:: sql
CREATE TABLE editor_subscribe_label_deleted
(
editor... |
import os.path
import tornado.auth
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=int)
define("facebook_api_key", help="your Facebook application... |
from __future__ import division, absolute_import, print_function
import os
import sys
import warnings
__all__ = ['PackageLoader']
class PackageLoader(object):
def __init__(self, verbose=False, infunc=False):
""" Manages loading packages.
"""
if infunc:
_level = 2
else... |
"""return a jumbled version of a string. eg, the lazy hamster is jumping becomes the lzay hmasetr si jmunipg
shuffles insides of words.
"""
import random
#okay, so this will be the jmuble algorythim
#variables, passed
#string_to_jumble = "" #yeah
#jumble_mode = true # do u switch words of two letters
d... |
import cuttsum.events
import cuttsum.corpora
from cuttsum.pipeline import InputStreamResource
from cuttsum.classifiers import NuggetRegressor
import cuttsum.judgements
import pandas as pd
import numpy as np
from datetime import datetime
from cuttsum.misc import event2semsim
from sklearn.cluster import AffinityPropagat... |
import analytic
import purchase_requisition
import hr
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from oslo_config import cfg
import six
from six.moves.urllib import parse as urlparse
from sahara.utils.openstack import base as clients_base
CONF = cfg.CONF
SWIFT_INTERNAL_PREFIX = "swift://"
SWIFT_URL_SUFFIX_START = '.'
SWIFT_URL_SUFFIX = SWIFT_URL_SUFFIX_START + 'sahara'
def retrieve_auth_url():
"""This fu... |
"""Operators for concise TensorFlow parameter specifications.
This module is used as an environment for evaluating expressions
in the "params" DSL.
Specifications are intended to assign simple numerical
values. Examples:
--params "n=64; d=5" --spec "(Cr(n) | Mp([2, 2])) ** d | Fm"
The random parameter primitive... |
"""Truncation utility module"""
__author__ = "Jens Thomas, and Felix Simkovic"
__date__ = "10 Jul 2018"
__version__ = "1.0"
import collections
from enum import Enum
import logging
import os
import sys
from ample.ensembler._ensembler import model_core_from_fasta
from ample.util import ample_util, pdb_edit, theseus
lo... |
from django.core.urlresolvers import reverse_lazy
from django.template import Context, Template, TemplateSyntaxError
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import View
from braces.views import LoginRequiredMixin, AjaxResponseM... |
from django.contrib.auth.management.commands.createsuperuser import *
from django.db.models.signals import pre_save, post_save
class Command(Command):
def handle(self, *args, **options):
username = options.get('username', None)
email = options.get('email', None)
interactive = options.get('... |
"""Weather component that handles meteorological data for your location."""
from datetime import timedelta
import logging
from homeassistant.const import PRECISION_TENTHS, PRECISION_WHOLE, TEMP_CELSIUS
from homeassistant.helpers.config_validation import ( # noqa
PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE)
from homeass... |
from otp.ai.AIBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal
import random
from toontown.suit import SuitDNA
import CogDisguiseGlobals
from toontown.toonbase.ToontownBattleGlobals import getInvasionMultiplier
MeritMultiplier = 0.5
class PromotionManagerAI:
notify = DirectNotifyGlobal.direct... |
import pickle
import matplotlib.pyplot as plt
from datetime import datetime
criteriaA = 4.0
criteriaB = 4.0
criteriaC = 10.0
dirName = r'F:\simulations\asphaltenes\production\longtime\athInHeptane\nvt\analysis\fullmatrix/'
# dirName = r'F:\simulations\asphaltenes\production\longtime\athInHeptane-illite\nvt\a... |
"""Miscellaneous helper functions ported from Compass.
See: http://compass-style.org/reference/compass/helpers/
This collection is not necessarily complete or up-to-date.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import math
import os.path
import six
from . i... |
"""Support for UK Met Office weather service."""
import logging
import voluptuous as vol
from homeassistant.components.sensor.metoffice import (
CONDITION_CLASSES, ATTRIBUTION, MetOfficeCurrentData)
from homeassistant.components.weather import PLATFORM_SCHEMA, WeatherEntity
from homeassistant.const import (
C... |
from PureTransformer import PureTransformer
class LineSplit(PureTransformer):
"""Split each message into its separate lines and send them on as separate messages"""
def processMessage(self, msg):
splitmsg = msg.split("\n")
for line in splitmsg:
self.send(line, "outbox")
__kamae... |
#!/usr/bin/env python
# coding=utf8
from __future__ import absolute_import
EMPTY_LIST = []
class AnnoSpan(object):
"""
A span of text with an annotation applied to it.
"""
__slots__ = ["start", "end", "doc", "metadata", "label", "base_spans"]
def __init__(self, start, end, doc, label=None, meta... |
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (<EMAIL>)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
DEBUG = True if __name__ == '__main__' else False
class BlobOfMatter(object):
def __str__(self):
... |
# -*- coding: utf-8 -*-
"""
plnt.views
~~~~~~~~~~
Display the aggregated feeds.
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
from datetime import datetime, date
from plnt.database import Blog, Entry
from plnt.utils import Pagination, expose, render_te... |
import html
from visidata import *
option('html_title', '<h2>{sheet.name}</h2>', 'table header when saving to html')
def open_html(p):
return HtmlTablesSheet(p.name, source=p)
open_htm = open_html
class HtmlTablesSheet(IndexSheet):
rowtype = 'sheets' # rowdef: HtmlTableSheet (sheet.html = lxml.html.HtmlEle... |
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
# Selecting Between Same Triggers {{{#
class _MultipleMatches(_VimTest):
snippets = (('test', 'Case1', 'This is Case 1'),
('test', 'Case2', 'This is Case 2'))
class Multiple_SimpleCaseSelectFirst_ECR(_MultipleMa... |
import io
import locale
import mimetypes
import sys
import unittest
from test import support
# Tell it we don't know about external files:
mimetypes.knownfiles = []
mimetypes.inited = False
mimetypes._default_mime_types()
class MimeTypesTestCase(unittest.TestCase):
def setUp(self):
self.db = mimetypes.M... |
import re
from ordereddict import OrderedDict
import os
import sys
builtin_types = [
'str', 'int', 'number', 'bool',
'int8', 'int16', 'int32', 'int64',
'uint8', 'uint16', 'uint32', 'uint64'
]
builtin_type_qtypes = {
'str': 'QTYPE_QSTRING',
'int': 'QTYPE_QINT',
'number': 'QTYPE_QFLO... |
"""
Support for Orvibo S20 Wifi Smart Switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.orvibo/
"""
import logging
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.con... |
'''
Created on Aug 4, 2011
@author: sean
'''
from __future__ import print_function
from graphlab.meta.asttools.visitors import Visitor, visit_children
from graphlab.meta.asttools.visitors.symbol_visitor import get_symbols
import ast
from graphlab.meta.utils import py2op
class ConditionalSymbolVisitor(Visitor):
... |
"""This is an alternative to python_reader which tries to emulate
the CPython prompt as closely as possible, with the exception of
allowing multiline input and multiline history entries.
"""
import sys
from pyrepl.readline import multiline_input, _error, _get_reader
def check(): # returns False if there is a prob... |
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...app import App
class TestAssembleApp(unittest.TestCase):
"""
Test assembling a complete App file.
"""
def test_assemble_xml_file(self):
"""Test writing an App file."""
self.maxDiff... |
"""Test for RFlink switch components.
Test setup of rflink switch component/platform. State tracking and
control of Rflink switch devices.
"""
from homeassistant.components.rflink import EVENT_BUTTON_PRESSED
from homeassistant.const import (
ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_ON, STATE_OFF)... |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
Float,
NoneSet,
Bool,
Integer,
MinMax,
NoneSet,
Set,
String,
Alias,
)
from openpyxl.descriptors.excel i... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: win_updates
version_added: "2.0"
short_description: Download and install Windows updates
description:
- Searches, downloads, and installs Windows u... |
"""Module for all nameserver related activity."""
__author__ = '<EMAIL> (Thomas Stromberg)'
import random
import re
import socket
import sys
import time
# external dependencies (from nb_third_party)
import dns.exception
import dns.message
import dns.name
import dns.query
import dns.rcode
import dns.rdataclass
import... |
import os
import tempfile
import uuid
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.db.models.fields.files import Imag... |
from m5.util.code_formatter import code_formatter
class tex_formatter(code_formatter):
braced = "<>"
double_braced = "<<>>"
def printTexTable(sm, code):
tex = tex_formatter()
tex(r'''
%& latex
\documentclass[12pt]{article}
\usepackage{graphics}
\begin{document}
\begin{tabular}{|l||$<<"l" * len(sm.even... |
# -*- coding: utf-8 -*-
"""
This file is part of GEOVAL.
(c) Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE file
"""
import sys
sys.path.append('..')
import unittest
from geoval.core import GeoData
from geoval.statistic.mintrend import MintrendPlot
try:
import cPickle # p2
except:
... |
# This test is temporary until we can import test_decorators from CPython 3.x
# The reason for not doing that already is that in Python 3.x the name of a
# function is stored in func.__name__, in 2.x it's func.func_name
import unittest
from test import test_support
class TestClassDecorators(unittest.TestCase):
de... |
"""Tests for doc generator traversal."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from tensorflow.python.platform import googletest
from tensorflow.tools.docs import generate_lib
from tensorflow.tools.docs import parser
def te... |
"""
Dropbox OAuth support.
This contribution adds support for Dropbox OAuth service. The settings
DROPBOX_APP_ID and DROPBOX_API_SECRET must be defined with the values
given by Dropbox application registration process.
By default account id and token expiration time are stored in extra_data
field, check OAuthBackend ... |
"""
.. inheritance-diagram:: pyopus.misc.sobol
:parts: 1
**Sobol sequence generator**
Details can be found in
[joekuo1] S. Joe and F. Y. Kuo, Remark on Algorithm 659: Implementing Sobol's
quasirandom sequence generator, ACM Trans. Math. Softw. 29, 49-57 (2003).
[joekuo2] S. Joe and F. Y. Kuo, Const... |
from openerp.osv import osv, fields
EDU_STATES = [
('draft', 'New'),
('entrance', 'Entrance'),
('open', 'Training in Progress'),
('pending', 'Training Suspended'),
('done', 'Training Done'),
('canceled', 'Training Canceled'),
]
EDU_DOC_STATES = [
('draft', 'New'),
('confirmed', 'On Val... |
import os
import shutil
import sys
from optparse import OptionParser
from xml.dom.minidom import parse, parseString
from corpustool.lib.logger import log_start
from corpustool.lib.logger import log_done
def filter(pcconfig):
log_start("diff_align")
ext = ".diff_align"
config = pcconfig.config
src_fil... |
# -*- coding: utf-8 -*-
from django.contrib.messages.storage.cookie import CookieStorage
from django.forms.models import model_to_dict
from django.test.utils import override_settings
from cms.models.permissionmodels import PageUserGroup
from cms.test_utils.testcases import CMSTestCase
from cms.utils.urlutils import ad... |
"""Dev server used for running a chalice app locally.
This is intended only for local development purposes.
"""
import functools
from collections import namedtuple
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
from chalice.app import Chalice # noqa
from typing import List,... |
#-*- coding: utf-8 -*-
""" EOSS catalog system
Implementation of ESA sentinel1/2 catalog access
(https://scihub.copernicus.eu)
Users need to register at the scihub page to get access to their catalog system. These credentials are set by SENTINEL_USER and SENTINEL_PASSWORD
"""
__author__ = "Thilo Wehrmann, Steffen Ge... |
# Simple test suite for Cookie.py
from test.test_support import run_unittest, run_doctest, check_warnings
import unittest
import Cookie
class CookieTests(unittest.TestCase):
# Currently this only tests SimpleCookie
def test_basic(self):
cases = [
{ 'data': 'chips=ahoy; vienna=finger',
... |
"""The main API for the v3 notebook format.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
__all__ = ['NotebookNode', 'new_code_cell', 'new_text_cell', 'new_notebook',
'new_output', 'new_worksheet', 'new_metadata', 'new_author',
'new_head... |
#!/usr/bin/python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.uic import *
from blur.Stone import *
from blur.Classes import *
from blur.absubmit import Submitter
from blur.Classesui import *
import sys, os
class Cinema4DRenderDialog(QDialog):
def __init__(self,parent=None):
QDialo... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
---
module: test_perrcert
short_description: Test getting the peer certificate of a HTTP response
description: Test getting the peer certificate of a HTTP response.
options:
url:
description: The endpoint... |
"""Utility functions for killing the wrapper softly.
Copyright (C) 2013, Joshua More and Michele Ceriotti
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 3 of the License, or
(at your... |
import re
import string
def read(filename):
"""return a dict of unicode characters"""
ud = open(filename, 'r')
ret = {}
while True:
l = ud.readline()
if not l:
break
l = re.sub('#.*$', '', l)
if l == "\n":
continue
f = l.split(';')
... |
import json
from magnum.tests.functional.common import models
class BayPatchData(models.BaseModel):
"""Data that encapsulates baypatch attributes"""
pass
class BayPatchEntity(models.EntityModel):
"""Entity Model that represents a single instance of BayPatchData"""
ENTITY_NAME = 'baypatch'
MODE... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.data.python.ops import dataset_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framewor... |
"""Acceptance tests for LMS-hosted Programs pages"""
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.catalog import CatalogFixture, CatalogConfigMixin
from common.test.acceptance.fixtures.programs import ProgramsFixture, ProgramsConfigMixin
from common.test.acceptance.fixtures.course import C... |
DATE_FORMAT = 'Y年n月j日' # 2016年9月5日
TIME_FORMAT = 'H:i' # 20:45
DATETIME_FORMAT = 'Y年n月j日 H:i' # 2016年9月5日 20:45
YEAR_MONTH_FORMAT = 'Y年n月' # 2016年9月
MONTH_DAY_FORMAT = 'm月j日' # 9月5日
SHORT_DATE_FORMAT = 'Y年n月j日' # 2016年9月5日
SHORT_DATETIME_FORMAT... |
import requests
import threading
import time
import traceback
from . import TelegramConnection, MessageHandler
class LongPollingConnection(TelegramConnection):
def __init__(self, token: str, handler: MessageHandler) -> None:
super().__init__(token, handler)
self._connected = False
self.la... |
from msrest.serialization import Model
class ExpressRouteCircuitSku(Model):
"""Contains SKU in an ExpressRouteCircuit.
:param name: The name of the SKU.
:type name: str
:param tier: The tier of the SKU. Possible values are 'Standard' and
'Premium'. Possible values include: 'Standard', 'Premium'
... |
import numpy as np
from skimage.segmentation import clear_border
from skimage._shared.testing import assert_array_equal, assert_
def test_clear_border():
image = np.array(
[[0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0, 0, 0, 0],
[1, 0, 0, 1, 0, 1, 0, 0, 0],
[0, 0, 1, 1, 1, 1,... |
import gl_XML
import license
import sys, getopt
class PrintGlTable(gl_XML.gl_print_base):
def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
self.es = es
self.header_tag = '_GLAPI_TABLE_H_'
self.name = "gl_table.py (from Mesa)"
self.license = license.bsd_license_template % ( \
"""Copyright (... |
import pprint
class FakeSlaveBuilder:
"""
Simulates a SlaveBuilder, but just records the updates from sendUpdate
in its updates attribute. Call show() to get a pretty-printed string
showing the updates. Set debug to True to show updates as they happen.
"""
debug = False
def __init__(self,... |
"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id$
"""
version ... |
#
#
# File: io_controller_class.py
#
#
#
#
#
import struct
import os
import sys
import time
import select
import socket
import json
import redis
class Click_Controller_Base_Class(object):
def __init__(self,instrument, click_io = [], m_tags = {}):
self.instrument = instrument
s... |
import copy
import numpy as np
import matplotlib.pyplot as plt
def logsumexp(values):
biggest = np.max(values)
x = values - biggest
result = np.log(np.sum(np.exp(x))) + biggest
return result
def logdiffexp(x1, x2):
biggest = x1
xx1 = x1 - biggest
xx2 = x2 - biggest
result = np.log(np.exp(xx1) - np.exp(xx2)) +... |
"""Loader functionality for SavedModel with hermetic, language-neutral exports.
Load and restore capability for a SavedModel, which may include multiple meta
graph defs. Each SavedModel is associated with a single checkpoint. Each meta
graph def is saved with one or more tags, which are used to identify the exact
meta... |
import unittest
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_false
from proboscis.asserts import assert_raises
from proboscis.asserts import assert_true
from proboscis import after_class
from proboscis import before_class
from proboscis import SkipTest
from proboscis import test
impo... |
import unittest
class TrueCodePaths(unittest.TestCase):
def setUp(self):
vars = request.vars
vars["lat"] = 0
vars["lon"] = 0
vars["zoom"] = 1
self.old_s3roles = list(session.s3.roles)
session.s3.roles.append(1)
def tearDown(self):
... |
import logging
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from six.moves import configparser, input
from django_extensions.management.utils import signalcommand
try:
from django.db.backends.base.creation import TEST_DATABASE... |
import sys
import imp
import os
import subprocess
USER_TESTS = "userTests"
TEST_FAILED = "FAILED"
TEST_PASSED = "PASSED"
INPUT = "input"
OUTPUT = "output"
def get_index(logical_name, full_name):
logical_name_len = len(logical_name)
if full_name[:logical_name_len] == logical_name:
return int(full_n... |
#Software to encode binary information to DNA nucleotides
import binascii
import re
class DNAEncoder:
def __init__(self):
self.binaryArray = []
self.nucleotideArray = []
#This section of code is used for the express purpose of encoding binary information
#Creates a demilited binary array
... |
from . import Framework
class PullRequest1375(Framework.TestCase):
def setUp(self):
super().setUp()
self.pr = self.g.get_repo("rsn491/PyGithub").get_pulls()[0]
def testCreateReviewCommentReply(self):
comment_id = 373866377 # id of pull request comment without replies
first_re... |
# This is a Python code using OpenCV to print the probabilities and predictions on videos
#
# I am working for a deadline. It's still messed up...
#
# Contact: Chih-Yao Ma at <EMAIL>
import numpy as np
import cv2
import random
import re
n = 3 # number of predictions per video
nVideo = 3754 # number of total videos... |
from __future__ import print_function, division
import numpy as np
from msmbuilder.hmm import VonMisesHMM
from msmbuilder.example_datasets import AlanineDipeptide
from msmbuilder.featurizer import DihedralFeaturizer
from scipy.stats.distributions import vonmises
from itertools import permutations
import random
def t... |
import report_membership
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Run through comments in a specified list of subreddits,
look for typos, and if a typo is found,
post a new comment with the corrected spelling.
"""
import praw
import time
import logging
from . import ap_config
logger = logging.getLogger(__name__)
# User agent info so Reddit can track the bot
r = pra... |
from __future__ import division, print_function
import os
import subprocess
import shutil
from os.path import join as pjoin, split as psplit, dirname
from zipfile import ZipFile
import re
def get_sdist_tarball():
"""Return the name of the installer built by wininst command."""
# Yeah, the name logic is harcod... |
# =======================================
# twilio module support methods
#
try:
import urllib, urllib2
except ImportError:
module.fail_json(msg="urllib and urllib2 are required")
import base64
def post_twilio_api(module, account_sid, auth_token, msg, from_number,
to_number, media_url=Non... |
""" Diffusion 2: jump diffusion, stochastic volatility, stochastic time
Created on Tue Dec 08 15:03:49 2009
Author: josef-pktd following Meucci
License: BSD
contains:
CIRSubordinatedBrownian
Heston
IG
JumpDiffusionKou
JumpDiffusionMerton
NIG
VG
References
----------
Attilio Meucci, Review of Discrete and Contin... |
# -*- coding: utf-8 -*-
from django.test import TestCase, RequestFactory
from django.core import exceptions
from django.contrib.auth.models import AnonymousUser
from .utils import get_payway_class, begin_transaction, format_amount, PayWay
from .models import Transaction
from decimal import Decimal, InvalidOperation
... |
from pyroman import Firewall
from util import Util
from port import Port, PortInvalidSpec
from chain import Chain
from exception import PyromanException
class Nat:
"""
Represents a Network Address Translation rule.
"""
def __init__(self, client, server, ip, port, dport, dir, loginfo):
"""
Create a new NAT rule... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''!
Created on 5/2/2015
@author: Antonio Hermosilla Rodrigo.
@contact: <EMAIL>
@organization: Antonio Hermosilla Rodrigo.
@copyright: (C) 2015 by Antonio Hermosilla Rodrigo
@version: 1.0.0
'''
from Geometrias.Angulo import Angulo
class PuntoGeodesico(object):
'''!
... |
"""$Id: channel.py 711 2006-10-25 00:43:41Z rubys $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 711 $"
__date__ = "$Date: 2006-10-25 00:43:41 +0000 (Wed, 25 Oct 2006) $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from ... |
"""Tokenize DNS master file format"""
import cStringIO
import sys
import dns.exception
import dns.name
import dns.ttl
_DELIMITERS = {
' ' : True,
'\t' : True,
'\n' : True,
';' : True,
'(' : True,
')' : True,
'"' : True }
_QUOTING_DELIMITERS = { '"' : True }
EOF = 0
EOL = 1
WHITESPACE = ... |
"""Test the helper objects in letsencrypt_nginx.obj."""
import unittest
class AddrTest(unittest.TestCase):
"""Test the Addr class."""
def setUp(self):
from letsencrypt_nginx.obj import Addr
self.addr1 = Addr.fromstring("192.168.1.1")
self.addr2 = Addr.fromstring("192.168.1.1:* ssl")
... |
import unittest
from BrickPython.BrickPi import PORT_1
from BrickPython.Sensor import Sensor, TouchSensor, UltrasonicSensor, LightSensor
import TestScheduler
class TestSensor(unittest.TestCase):
'Tests for the Sensor classes'
def testSensor(self):
sensor = Sensor( PORT_1 )
self.assertEquals(se... |
import logging
from django.db import models
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.utils.translation import ugettext_noop
from student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.