content stringlengths 4 20k |
|---|
"""
Use this component to generate a schedule with a constant value or a schedule with 24 values that repeat in the same 24-hour pattern every day.
-
Provided by Ladybug 0.0.62
Args:
_value: A value or list of 24 values that will be repeated for every day of the year.
_scheduleName: A text stri... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the file entry implementation using the SleuthKit (TSK)."""
import os
import unittest
from dfvfs.path import os_path_spec
from dfvfs.path import tsk_path_spec
from dfvfs.resolver import context
from dfvfs.vfs import tsk_file_entry
from dfvfs.vfs import tsk_file_s... |
#!/usr/bin/env python2
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''Read meta information from epub files'''
import os, re, posixpath
from cStringIO import StringIO
from contextlib import closing
from future_builtins import map
from c... |
""" Video plugin for Artifactor
Add a stanza to the artifactor config like this,
artifactor:
log_dir: /home/username/outdir
per_run: test #test, run, None
overwrite: True
plugins:
video:
enabled: True
plugin: video
quality: 10
display: ":99"
"""
... |
# -----------------------------------------------------------------------------
# calc.py
#
# This example shows how to run the parser in a debugging mode
# with output routed to a logging object.
# -----------------------------------------------------------------------------
import sys
sys.path.insert(0,"../..")
if ... |
import uuid as uuid_lib
from oslo_utils import timeutils
from webob import exc
from nova.api.openstack.compute import cloudpipe as cloudpipe_v21
from nova.compute import utils as compute_utils
import nova.conf
from nova import exception
from nova import objects
from nova import test
from nova.tests.unit.api.openstack... |
"""
Based on "python-archive" -- http://pypi.python.org/pypi/python-archive/
Copyright (c) 2010 Gary Wilson Jr. <<EMAIL>> and contributors.
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... |
"""Topological sorting algorithms."""
from sqlalchemy.exc import CircularDependencyError
from sqlalchemy import util
__all__ = ['sort', 'sort_as_subsets', 'find_cycles']
def sort_as_subsets(tuples, allitems):
edges = util.defaultdict(set)
for parent, child in tuples:
edges[child].add(parent)
t... |
from __future__ import division
"""
This package contains experimental data, usefull for plotting.
Experiments 201104 from Department Organic Chemistry
Experiments 201106 "
"""
#---------------------------------------------------------------
#
# System imports
#
#-----------------------------------------------------... |
#!/usr/bin/python
# coding=utf-8
__author__ = 'luowei'
import sqlite3
import re
import codecs
conn = sqlite3.connect('test.db')
print "Opened database successfully"
conn.execute("DROP TABLE IF EXISTS wubi_words")
conn.execute('''CREATE TABLE wubi_words (id INTEGER PRIMARY KEY NOT NULL ,
code VARCH... |
'''Test the functions and main class method of textView.py.'''
import unittest
import os
from test.test_support import requires
from Tkinter import Tk
from idlelib import textView as tv
from idlelib.idle_test.mock_idle import Func
from idlelib.idle_test.mock_tk import Mbox
orig_mbox = tv.tkMessageBox
class textviewC... |
from django.utils.translation import ugettext_lazy as _
from django.contrib.comments.models import CommentFlag
from django.contrib.comments.admin import CommentsAdmin
from django.contrib import admin
from scipy_central.comments.models import SpcComment
class SpcCommentAdmin(CommentsAdmin):
"""
Custom admin in... |
"""
Annalist record field description
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (<EMAIL>)"
__copyright__ = "Copyright 2014, G. Klyne"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
import logging
log = ... |
import logging
import sys
import pytest
import rasterio
from rasterio.profiles import default_gtiff_profile
from rasterio.vfs import parse_path, vsi_path
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
def test_parse_path_with_vfs():
"""Correctly parse path with legacy vfs parameter"""
assert ... |
"""Support code for YAML parsing of experiment descriptions."""
import yaml
from pylearn2.utils import serial
from pylearn2.utils.exc import reraise_as
from pylearn2.utils.string_utils import preprocess
from pylearn2.utils.call_check import checked_call
from pylearn2.utils.string_utils import match
from collections imp... |
import ctypes
from ctypes import util
import re
iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))
kIOMasterPortDefault = ctypes.c_void_p.in_dll(iokit, "kIOMasterPortDefault")
kCFAllocatorDefault = ctypes.c_void_p.in_dll(cf, "kCF... |
#!/usr/bin/python
import re
import sys
import getopt
DX = DY = PX = PY = KX = KY = 0
_RE_LINE = re.compile("^\s*(?P<keyword>[\w-]+)\s+{\s*$")
_RE_XY = re.compile("^(?P<start>\s*)(?P<xy>[x|y]\s+)(?P<num>\d+)(?P<end>\s*)$")
def main():
ParseArgs()
ParseInput()
def Usage():
print >>sys.stderr, """
Usage: %s -... |
"""
URL patterns for testing Horizon views.
"""
from django.conf.urls.defaults import patterns, url, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic import TemplateView
import horizon
urlpatterns = patterns('',
url(r'', include(horizon.urls)),
url(r"auth... |
from Components.VariableText import VariableText
from enigma import eLabel, iServiceInformation, eServiceReference, eServiceCenter
from Renderer import Renderer
#
# from vali, adapted for openpli, adapted for dmm
#
class ODChannelNumber(Renderer, VariableText):
def __init__(self):
Renderer.__init__(self)
Variable... |
from flask.ext.restplus import Namespace
from app.helpers.data import DataManager
from app.helpers.data_getter import DataGetter
from app.models.notifications import Notification as NotificationModel
from .helpers import custom_fields as fields
from .helpers.helpers import (
can_create,
requires_auth
)
from .h... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import map
from builtins import str
from builtins import *
import logging
import geojs... |
"""Methods to allow dask.DataFrame."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
try:
# pylint: disable=g-import-not-at-top
import dask.dataframe as dd
allowed_classes = (dd.Series, dd.DataFrame)
HAS_DASK = True
except Impo... |
#!/usr/bin/python
# coding=utf-8
################################################################################
import os
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
try:
from cStringIO import StringIO
Strin... |
# -*- coding: utf-8 -*-
"""
pyvisa-sim.gpib
~~~~~~~~~~~~~~~
GPIB simulated session.
:copyright: 2014 by PyVISA-sim Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, print_function, absolute_import
try:
i... |
ANSIBLE_METADATA = {'status': ['deprecated'],
'supported_by': 'community',
'version': '1.0'}
import time
try:
import glanceclient
HAS_GLANCECLIENT = True
except ImportError:
HAS_GLANCECLIENT = False
try:
from keystoneclient.v2_0 import client as ksclient
HAS_... |
"""
C code printer
The CCodePrinter converts single sympy expressions into single C expressions,
using the functions defined in math.h where possible.
A complete code generator, which uses ccode extensively, can be found in
sympy.utilities.codegen. The codegen module can be used to generate complete
source code files... |
import sys
if sys.version_info[:2] == (2, 6): # pragma: no cover
import unittest2 as unittest
else: # pragma: no cover
import unittest
class Test_asbool(unittest.TestCase):
def _callFUT(self, s):
from waitress.adjustments import asbool
return asbool(s)
def test_s_is_None(self):
... |
"""
EasyBuild support for building and installing foo, implemented as an easyblock
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM, MANDATORY
class EB_foo(EasyBlock):
"""Support for building/installing foo."""
... |
"""distutils.command.install_headers
Implements the Distutils 'install_headers' command, to install C/C++ header
files to the Python include directory."""
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: install_headers.py 37828 2004-11-10 22:23:15Z loewis $"
import os
from distutils.co... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
from .forms import UserEditForm, ProfileEditForm
class ProfileView(TemplateView):
... |
from django.db import models
from django_extensions.db.fields import UUIDField
from developer.models import Developer
from reporter.models import Reporter
import datetime
# Create your models here.
class Bug(models.Model):
guid = UUIDField(db_index=True)
title = models.CharField(max_length=100, null=False, blank=Fal... |
import os
Import("env")
# Relocate firmware from 0x08000000 to 0x0800A000
env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000"))
#alternatively, for STSTM <=5.1.0 use line below
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x0800A000"))
custom_ld_script = os.pa... |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDD... |
"""Base classes for "service" uploaders.
.. inheritance-diagram:: CatchupDataService FileService LiveDataService
:top-classes: pywws.service.ServiceBase
"""
from __future__ import absolute_import, print_function, unicode_literals
from ast import literal_eval
from collections import deque
from datetime import da... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:... |
####################################################################################################
# pimms/table.py
# Classes for storing immutable data tables.
# By Noah C. Benson
import copy, types, sys, pint, six
import numpy as np
import pyrsistent as ps
from functo... |
import time, resource
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.test.util import gc_collect
from sqlalchemy.test import profiling
db = create_engine('sqlite://')
metadata = MetaData(db)
Person_table = Table('Person', metadata,
Column('id', Integer, primary_key=True),
... |
"""Test node disconnect and ban behavior"""
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
connect_nodes_bi,
wait_until,
)
class DisconnectBanTest(BitcoinTestFramework):
def set_test_params(self):
... |
import datetime
import os
import random
import shutil
import socket
import sys
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.cli import CLI
from ansible.plugins import module_loader
from ansible.utils.display import Display
from ansible.utils.cmd_functions... |
from random import shuffle
NUM_PLAYERS = 5
ALIASES = ("Pink", "Green", "Blue", "White", "Orange")
MOVE_TYPES = ("send", "spoof", "wiretap", "ambush")
class Game:
"""
An object to contain an entire game of Ruse.
"""
def __init__(self, game_id, emitter):
self.game_id = game_id
self.emi... |
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api import users
from google.appengine.api import urlfetch
from google.appengine.ext.webapp import template
from google.appengine.api.urlfetch import DownloadError
import oauth2
import urllib
import logging
import... |
import simplejson as json
from mongrel2 import handler
sender_id = "82209006-86FF-4982-B5EA-D1E29E55D481"
conn = handler.Connection(sender_id, "tcp://127.0.0.1:9999",
"tcp://127.0.0.1:9998")
users = {}
user_list = []
while True:
try:
req = conn.recv_json()
except:
p... |
"""distutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution)."""
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: sdist.py 61268 2008-03-06 07:14:26Z martin.v.loewis $"
import sys, os, string
from types import *
from glob import glob
from distutils.... |
from collections import defaultdict
from decorator import decorator
from inspect import getargspec
import logging
_logger = logging.getLogger(__name__)
class ormcache_counter(object):
""" Statistic counters for cache entries. """
__slots__ = ['hit', 'miss', 'err']
def __init__(self):
self.hit = ... |
"""Inference in propositional logic"""
from __future__ import print_function, division
from sympy.logic.boolalg import And, Not, conjuncts, to_cnf
from sympy.core.compatibility import ordered
from sympy.core.sympify import sympify
def literal_symbol(literal):
"""
The symbol in this literal (without the negat... |
"""This module is a ad-hoc command processor for xmpppy. It uses the plug-in mechanism like most of the core library. It depends on a DISCO browser manager.
There are 3 classes here, a command processor Commands like the Browser, and a command template plugin Command, and an example command.
To use this module:
... |
from __future__ import division
import numpy as np
from neon import NervanaObject
class DataLoaderTransformer(NervanaObject):
"""
DataLoaderTransformers are used to transform the output of a DataLoader.
DataLoader doesn't have easy access to the device or graph, so any
computation that should happen t... |
"""
Main program for 2to3.
"""
from __future__ import with_statement
import sys
import os
import difflib
import logging
import shutil
import optparse
from . import refactor
def diff_texts(a, b, filename):
"""Return a unified diff of two strings."""
a = a.splitlines()
b = b.splitlines()
return diffl... |
from importlib import import_module
def __dir__():
"""
Using the __dir__ and __getattr__ functions allows
to inspect the availability of modules without loading them
:return:
"""
import pkgutil
names = [
name for importer, name, ispkg
in pkgutil.iter_modules(__path__)
... |
from flask import Flask, render_template, request
from flask.ext.sqlalchemy import SQLAlchemy
import os
import sys
import requests
import operator
import re
import nltk
from collections import Counter
from bs4 import BeautifulSoup
import stop_words
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS... |
import json
import gzip
def loadJson(filepath):
try:
with gzip.open(filepath, 'rb') as fp:
bytes = fp.read()
except IOError:
bytes = None
if bytes:
string = bytes.decode("utf-8")
struct = json.loads(string)
else:
with open(filepath, "rU") as fp:
... |
# -*- coding: utf-8 -*-
"""
import os
import glob
from copy import deepcopy
from goose.article import Article
from goose.utils import URLHelper, RawHelper
from goose.extractors import StandardContentExtractor
from goose.cleaners import StandardDocumentCleaner
from goose.outputformatters import StandardOutputFormatter
... |
from __future__ import unicode_literals
import unittest
from datetime import date, datetime, time, timedelta
from django.utils.dateparse import (
parse_date, parse_datetime, parse_duration, parse_time,
)
from django.utils.timezone import get_fixed_timezone
class DateParseTests(unittest.TestCase):
def test_... |
#!/usr/bin/python
#
# Simple utility script to manipulate
# certain types of strings in a file
# This can be used in various projects where
# there is the need to replace strings in files,
# and is copied from GLib's $(srcroot)/win32
import os
import sys
import re
import string
import argparse
valid_actions = ['rem... |
"""Crypto-related routines for oauth2client."""
import base64
import imp
import json
import logging
import os
import sys
import time
import six
CLOCK_SKEW_SECS = 300 # 5 minutes in seconds
AUTH_TOKEN_LIFETIME_SECS = 300 # 5 minutes in seconds
MAX_TOKEN_LIFETIME_SECS = 86400 # 1 day in seconds
logger = logging.... |
# -*- coding: utf-8 -*-
import unittest
class TestRedisStore(unittest.TestCase):
def setUp(self):
from shove import Shove
self.store = Shove('redis://localhost:6379/0')
def tearDown(self):
self.store.clear()
self.store.close()
def test__getitem__(self):
self.sto... |
from sqlalchemy.test.testing import eq_
import sqlalchemy as sa
from sqlalchemy.test import testing
from sqlalchemy import Integer, String, ForeignKey, MetaData, func
from sqlalchemy.test.schema import Table
from sqlalchemy.test.schema import Column
from sqlalchemy.orm import mapper, relationship, create_session
from s... |
"""Example use of feedcache.Cache.
"""
__module_id__ = "$Id$"
#
# Import system modules
#
import sys
import shelve
#
# Import local modules
#
import cache
#
# Module
#
def main(urls=[]):
print 'Saving feed data to ./.feedcache'
storage = shelve.open('.feedcache')
try:
fc = cache.Cache(storage)... |
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import sys
from multiprocessing import Process
ERR_SLEEP = 15
MAX_NONCE = 1000000L
settings = {}
pp = pprint.PrettyPrinter(indent=4)
class BitcoinRPC:
OBJID = 1
def __init__(self, host, port, username, passwo... |
from __future__ import unicode_literals
import json
import boto
from freezegun import freeze_time
import sure # noqa
from moto import mock_sts
@freeze_time("2012-01-01 12:00:00")
@mock_sts
def test_get_session_token():
conn = boto.connect_sts()
token = conn.get_session_token(duration=123)
token.expira... |
from __future__ import print_function
import sys
from command import Command
from git_command import GitCommand
class Rebase(Command):
common = True
helpSummary = "Rebase local branches on upstream branch"
helpUsage = """
%prog {[<project>...] | -i <project>...}
"""
helpDescription = """
'%prog' uses git reba... |
"""Cache object
The Cache object is used to manage a set of cache files and their
associated backend. The backends can be rotated on the fly by
specifying an alternate type when used.
Advanced users can add new backends in beaker.backends
"""
import warnings
import beaker.container as container
import beaker.u... |
"""
EasyBuild support for building and installing NEMO, implemented as an easyblock
@author: Oriol Mula-Valls (IC3)
"""
import os
import shutil
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM, MANDATORY
from easybuild.tools.build_log import EasyBuildError
from eas... |
from . import ServiceBase
from ..cache import cachedmethod
from ..language import language_set, Language
from ..subtitles import get_subtitle_path, ResultSubtitle
from ..utils import get_keywords
from ..videos import Episode
from bs4 import BeautifulSoup
import logging
import re
from sickbeard import db
from sickbeard ... |
"""
Tests for L{twisted.python.text}.
"""
from twisted.python.compat import NativeStringIO as StringIO
from twisted.trial import unittest
from twisted.python import text
sampleText = \
"""Every attempt to employ mathematical methods in the study of chemical
questions must be considered profoundly irrational and con... |
import attr
from navmazing import NavigateToAttribute
from navmazing import NavigateToSibling
from widgetastic.utils import Version
from widgetastic.utils import VersionPick
from cfme.common import CustomButtonEventsMixin
from cfme.common import Taggable
from cfme.exceptions import ItemNotFound
from cfme.modeling.base... |
from __future__ import absolute_import
from datetime import timedelta
from celery import current_app
from celery import states
from celery.result import AsyncResult
from celery.task import PeriodicTask
from celery.utils import gen_unique_id
from djcelery.backends.database import DatabaseBackend
from djcelery.utils i... |
def i_code (code3):
return code3[0]
def o_code (code3):
if len (code3) >= 2:
return code3[1]
else:
return code3[0]
def tap_code (code3):
if len (code3) >= 3:
return code3[2]
else:
return code3[0]
def i_type (code3):
return char_to_type[i_code (code3)]
def o_ty... |
"""
raven.handlers.logbook
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from __future__ import print_function
import logbook
import sys
import traceback
from raven.base impor... |
"""
A module for interfacing with the Stanford POS-tagger.
"""
import os
from subprocess import PIPE
import tempfile
import nltk
from api import *
_stanford_url = 'http://nlp.stanford.edu/software/tagger.shtml'
class StanfordTagger(TaggerI):
"""
A class for pos tagging with Stanford Tagger. The input is the ... |
from oslo_log import log as logging
from neutron.tests.api import base
from neutron.tests.tempest import test
LOG = logging.getLogger(__name__)
class TestFlavorsJson(base.BaseAdminNetworkTest):
"""
Tests the following operations in the Neutron API using the REST client for
Neutron:
List, Show... |
import HTMLParser as _HTMLParser
import re
tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*')
class HTMLParser(_HTMLParser.HTMLParser):
"""
Patched version of stdlib's HTMLParser with patch from:
http://bugs.python.org/issue670664
"""
def __init__(self):
_HTMLParser.HTMLParse... |
import array
import random
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
class PBIL(object):
def __init__(self, ndim, learning_rate, mut_prob, mut_shift, lambda_):
self.prob_vector = [0.5] * ndim
self.learning_rate = learning_rate
... |
""" Returns information about a module """
import os
from optparse import OptionGroup
from modtool_base import ModTool, ModToolException
from util_functions import get_modname
class ModToolInfo(ModTool):
""" Return information about a given module """
name = 'info'
aliases = ('getinfo', 'inf')
def ... |
import unittest
import json
import re
from base64 import b64encode
from flask import url_for
from app import create_app, db
from app.models import User, Role, Post, Comment
class APITestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_contex... |
from boto.gs.user import User
from boto.exception import InvalidAclError
ACCESS_CONTROL_LIST = 'AccessControlList'
ALL_AUTHENTICATED_USERS = 'AllAuthenticatedUsers'
ALL_USERS = 'AllUsers'
DISPLAY_NAME = 'DisplayName'
DOMAIN = 'Domain'
EMAIL_ADDRESS = 'EmailAddress'
ENTRY = 'Entry'
ENTRIES = 'Entries'
GROUP_BY_DOMAIN =... |
import numpy as np
def hex_to_rgb(value):
"""Given a color in hex format, return it in RGB."""
values = value.lstrip('#')
lv = len(values)
rgb = list(int(values[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
return rgb
class RGBAColorMapper(object):
"""Maps floating point values to rg... |
"""
Support for manual alarms.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.manual/
"""
import datetime
import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
import homeassistant.util... |
"""Tests for tensorflow.contrib.graph_editor."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
from tensorflow.contrib import graph_editor as ge
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import ops as o... |
import unittest
from GPy.core.parameterization.parameterized import Parameterized
from GPy.core.parameterization.param import Param
import numpy
# One trigger in init
_trigger_start = -1
class ParamTestParent(Parameterized):
parent_changed_count = _trigger_start
def parameters_changed(self):
self.pare... |
"""Manage individual cells in a spreadsheet.
The Cell class is required to know its value and type, display options,
and any other features of an Excel cell. Utilities for referencing
cells using Excel's 'A1' column/row nomenclature are also provided.
"""
__docformat__ = "restructuredtext en"
# Python stdlib impor... |
#!/usr/bin/env python3
#
# test_multibytecodec.py
# Unit test for multibytecodec itself
#
from test import support
from test.support import TESTFN
import unittest, io, codecs, sys, os
import _multibytecodec
ALL_CJKENCODINGS = [
# _codecs_cn
'gb2312', 'gbk', 'gb18030', 'hz',
# _codecs_hk
'big5hkscs',
# _code... |
from decimal import Decimal
from django.template.defaultfilters import pluralize
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_integers(self):
self.assertEqual(pluralize(1), '')
self.assertEqual(pluralize(0), 's')
self.assertEqual(pluralize(2), 's')... |
"""
The Bugs model package provides bugs and their specific behaviour.
"""
from net.cadrian.microcosmos.model.bugs.antFemales import AntFemale, Target as AntFemaleTarget
from net.cadrian.microcosmos.model.bugs.antQueens import AntQueen
from net.cadrian.microcosmos.model.bugs.antSoldiers import AntSoldier
from net.cadr... |
doctests = """
Unpack tuple
>>> t = (1, 2, 3)
>>> a, b, c = t
>>> a == 1 and b == 2 and c == 3
True
Unpack list
>>> l = [4, 5, 6]
>>> a, b, c = l
>>> a == 4 and b == 5 and c == 6
True
Unpack implied tuple
>>> a, b, c = 7, 8, 9
>>> a == 7 and b == 8 and c == 9
True
Unpa... |
import random
try:
import asyncio
except ImportError:
## Trollius >= 0.3 was renamed
import trollius as asyncio
from autobahn.wamp.types import SubscribeOptions
from autobahn.asyncio.wamp import ApplicationSession
class Component(ApplicationSession):
"""
An application component that subscribes and ... |
import tempfile
import re
import os.path
from pip.util import call_subprocess
from pip.util import display_path, rmtree
from pip.vcs import vcs, VersionControl
from pip.log import logger
from pip.backwardcompat import url2pathname, urlparse
urlsplit = urlparse.urlsplit
urlunsplit = urlparse.urlunsplit
class Git(Versi... |
"""Conditional distribution base class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import util as distribution_util
class ConditionalDistribution... |
# Demonstrate usage of PyMa27 abstract class for the solution of symmetric
# systems of linear equations.
# Example usage: python demo_ma27.py file1.mtx ... fileN.mtx
# where each fileK.mtx is in MatrixMarket format.
from nlpy.linalg.pyma27 import PyMa27Context as LBLContext
#from nlpy.linalg.pyma57 import PyMa57Conte... |
"""
This test verifies image authentication for a signed image which is signed
by user certificate and contains additional intermediate certificates in its
signature.
"""
import pytest
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('efi_secure_boot')
@pytest.mark.buildconfigspec('cmd_efidebug')
@pyte... |
"""
Tests For Compute w/ Cells
"""
import functools
import inspect
import mock
from oslo_config import cfg
from oslo_utils import timeutils
from nova import block_device
from nova.cells import manager
from nova.compute import api as compute_api
from nova.compute import cells_api as compute_cells_api
from nova.compute... |
"""
Studio Home page
"""
from bok_choy.page_object import PageObject
from . import BASE_URL
class DashboardPage(PageObject):
"""
Studio Home page
"""
url = BASE_URL + "/course/"
def is_browser_on_page(self):
return self.q(css='body.view-dashboard').present
@property
def course_... |
data = (
'gwan', # 0x00
'gwanj', # 0x01
'gwanh', # 0x02
'gwad', # 0x03
'gwal', # 0x04
'gwalg', # 0x05
'gwalm', # 0x06
'gwalb', # 0x07
'gwals', # 0x08
'gwalt', # 0x09
'gwalp', # 0x0a
'gwalh', # 0x0b
'gwam', # 0x0c
'gwab', # 0x0d
'gwabs', # 0x0e
'gwas', # 0x0f
'gwass', #... |
import os, sys, pdb, imp, re, inspect
from django.contrib.admin import site
from django.template import add_to_builtins
def get_module_list(start):
all_files = os.walk(start)
file_list = [(i[0], (i[1], i[2])) for i in all_files]
file_dict = dict(file_list)
curr = start
modules = []
pathlist =... |
"""Leetcode 171. Excel Sheet Column Number
Easy
URL: https://leetcode.com/problems/excel-sheet-column-number/
Given a column title as appear in an Excel sheet,
return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Inpu... |
"""
Handling of VM disk images.
"""
import os.path
import shutil
import sys
import time
import urllib2
import urlparse
from nova import context
from nova import flags
from nova import log as logging
from nova import utils
from nova.auth import manager
from nova.auth import signer
FLAGS = flags.FLAGS
LOG = logging.g... |
#!/usr/bin/env python
import os
import sys
import argparse
import gzip
import logging
############
#
# NCBI taxonomy creator
#
####
# COPYRIGHT DISCALIMER:
# 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... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.signals import connection_created
from django.db.backends.postgresql_psycopg2.operations import DatabaseOperations
from... |
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
from django.contrib.gis.geos.point import Point
from django.contrib.gis.... |
# -*- coding: utf-8 -*-
"""
Sycamore - OrphanedPages Macro
@copyright: 2006-2007 by Philip Neustrom <<EMAIL>>
@copyright: 2001 by Jürgen Hermann <<EMAIL>>
@license: GNU GPL, see COPYING for details.
"""
# Imports
from Sycamore import config, user, wikiutil, wikidb
_guard = 0
Dependencies = ["pages"]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.