content string |
|---|
"""Pygame particle renderers.
(Obviously) requires pygame
"""
__version__ = '$Id$'
from pygame.transform import rotozoom
from math import degrees
class FillRenderer:
"""Renders particles to a pygame surface using simple fills"""
def __init__(self, surface, flags=None):
"""
surface -- pygame surface to rende... |
"""
Replaces gyp files in tree with files from here that
make the build use system libraries.
"""
import optparse
import os.path
import shutil
import sys
REPLACEMENTS = {
'use_system_expat': 'third_party/expat/expat.gyp',
'use_system_ffmpeg': 'third_party/ffmpeg/ffmpeg.gyp',
'use_system_flac': 'third_party/fl... |
"""
Author: Fabio Brandespim
Email: <EMAIL>
Location: Brazil - Goiania
Date: 09-19-2016
"""
#!C:/Python27_32/python.exe
import pygame
import math
import particle
import titulos
import email_py
#import time
from threading import Thread
from pygame.locals import *
img = pygame.image.load("terra_plana.bmp")
i... |
from org.apache.qpid.proton import Proton
from org.apache.qpid.proton.messenger import Messenger, Status
from org.apache.qpid.proton import InterruptException, TimeoutException
from cerror import *
# from proton/messenger.h
PN_STATUS_UNKNOWN = 0
PN_STATUS_PENDING = 1
PN_STATUS_ACCEPTED = 2
PN_STATUS_REJECTED = 3
PN_S... |
from nose.tools import eq_, ok_
import mkt.site.tests
from mkt.site.utils import app_factory
from mkt.tags.models import attach_tags, Tag
from mkt.websites.utils import website_factory
class TestTagManager(mkt.site.tests.TestCase):
def test_not_blocked(self):
"""Make sure Tag Manager filters right for n... |
"""Support for KEBA charging stations."""
import asyncio
import logging
from keba_kecontact.connection import KebaKeContact
import voluptuous as vol
from homeassistant.const import CONF_HOST
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(_... |
import setuptools
class InvenioManageCommand(setuptools.Command):
"""
Setuptools command for running ```bower <command>```
"""
description = "run inveniomanage commands."
user_options = [
('manage-command=', 'c',
'inveniomanage command to run.'),
]
def initialize_option... |
import os
import subprocess
import sickbeard
from sickbeard import logger
from sickbeard import common
from sickrage.helper.encoding import ek
from sickrage.helper.exceptions import ex
class synologyNotifier:
def notify_snatch(self, ep_name):
if sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH:
se... |
from queue import Queue
from bears.haskell.HaskellLintBear import HaskellLintBear
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper
from coalib.testing.BearTestHelper import generate_skip_decorator
from coalib.settings.Section import Section
good_single_line_file = """
myconcat = (++)
""".splitlines... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from abc import ABCMeta, abstractmethod
from six import with_metaclass
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
class BaseCacheModule(with_m... |
from math import sqrt,cos,sin,atan2,ceil,floor,log10,pi,atan,tan
from log import Warn
try:
from math import fsum
except ImportError:
from mymath import fsum
## MISC MATH FUNCTIONS ##
def Mean(numbers):
"Returns the arithmetic mean of a numeric list."
return fsum(numbers) / len(numbers)
def InBounds... |
"""
A testcase which accesses *values* in a dll.
"""
import unittest
from ctypes import *
import _ctypes_test
class ValuesTestCase(unittest.TestCase):
def test_an_integer(self):
# This test checks and changes an integer stored inside the
# _ctypes_test dll/shared lib.
ctdll... |
#!/usr/bin/env python
"""
This example illustrates the sudden appearance of a
giant connected component in a binomial random graph.
Requires pygraphviz and matplotlib to draw.
"""
# Copyright (C) 2006-2008
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
... |
from lasercut.hingesproperties import GlobalLivingMaterialProperties
from lasercut.hingesproperties import HingesProperties
from panel.toolwidget import ParamWidget, WidgetValue
class GlobalLivingHingeWidget(ParamWidget):
def __init__(self, global_properties):
self.name = global_properties.name
s... |
"""
Code for plotting curves with tangent lines.
"""
__author__ = "Ian Goodfellow"
try:
from matplotlib import pyplot
except Exception:
pyplot = None
from theano.compat.six.moves import xrange
def tangent_plot(x, y, s):
"""
Plots a curve with tangent lines.
Parameters
----------
x : lis... |
"""
.. dialect:: sqlite+pysqlite
:name: pysqlite
:dbapi: sqlite3
:connectstring: sqlite+pysqlite:///file_path
:url: http://docs.python.org/library/sqlite3.html
Note that ``pysqlite`` is the same driver as the ``sqlite3``
module included with the Python distribution.
Driver
------
When using P... |
"""Unit tests for local command-line-interface debug wrapper session."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import tempfile
from tensorflow.python.client import session
from tensorflow.python.debug.cli import cli_shared
... |
from __future__ import absolute_import
import logging
from flask import request
# TODO right now we are only logging exceptions. We should probably
# add support for some INFO and maybe DEBUG level logging (like, log each time
# a endpoint is hit, etc.)
class RequestFilter(logging.Filter):
""" Adds Flask's requ... |
"""
=============================================
A demo of the Spectral Biclustering algorithm
=============================================
This example demonstrates how to generate a checkerboard dataset and
bicluster it using the Spectral Biclustering algorithm.
The data is generated with the ``make_checkerboard`... |
import GemRB
from GUIDefines import *
StartWindow = 0
QuitWindow = 0
def OnLoad():
global StartWindow, QuitWindow
skip_videos = GemRB.GetVar ("SkipIntroVideos")
if not skip_videos:
GemRB.PlayMovie ("BISLOGO")
GemRB.PlayMovie ("TSRLOGO")
GemRB.PlayMovie ("OPENING")
GemRB.SetVar ("SkipIntroVideos", 1)
Ge... |
"""Support for Aqualink pool feature switches."""
from homeassistant.components.switch import DOMAIN, SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from . import AqualinkEntity, refresh_system
from .const import DOMAIN as AQUALINK_DOMAIN
P... |
import json
import os
import shutil
import tempfile
import unittest
import mock
import sys
import run_gpu_integration_test
import gpu_project_config
from gpu_tests import context_lost_integration_test
from gpu_tests import gpu_helper
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
from gpu_t... |
from tailbone import BaseHandler
from tailbone import as_json
from tailbone import AppError
from tailbone import DEBUG
from tailbone import PREFIX
from tailbone.compute_engine import LoadBalancer
from tailbone.compute_engine import TailboneCEInstance
from tailbone.compute_engine import STARTUP_SCRIPT_BASE
import binas... |
microcode = '''
def macroop EMMS {
emms
};
# FEMMS
''' |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils._text import to_text
__all__ = ('unicode_wrap')
def unicode_wrap(func, *args, **kwargs):
"""If a function returns a string, force it to be a text string.
Use with partial to ensure that filter... |
"""Tests for ceilometer/storage/
"""
import mox
import testtools
from ceilometer import storage
from ceilometer.storage import impl_log
class EngineTest(testtools.TestCase):
def test_get_engine(self):
conf = mox.Mox().CreateMockAnything()
conf.database = mox.Mox().CreateMockAnything()
c... |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns(
'dnd.spells.views',
# spells
url(
r'^$',
'spell_index',
name='spell_index',
),
# spells > rulebook
url(
r'^(?P<rulebook_slug>[^/]+)--(?P<rulebook_id>\d+)/$',
'sp... |
"""
Adapted from: https://docs.python.org/3.4/howto/sockets.html
TODO: Get this based on tornado TCPClient class instead of this half baked
thing
TODO: Do co-routines *or* callbacks. This goes for the whole thing, not just
this class.
"""
import socket
from tornado import (
gen,
)
class DriverClient:... |
import unittest
import os
import shutil
from penguin.main import newSite, buildSite, publishPosts
from penguin.penguin import Penguin
class TestContentCreation(unittest.TestCase):
def test_build_project(self):
newSite('test_site')
os.chdir('test_site')
site = Penguin()
buildSite(s... |
"""Imports external packages that replace or emulate internal packages.
If the external module is not present, the build-in module is imported.
"""
try:
import pathlib2
pathlib = pathlib2
except ImportError:
pathlib2 = None
try:
import pathlib
except ImportError:
pathlib = None
t... |
#!/usr/bin/env python
# sorry, this is very ugly, but I'm in python 2.5
import sys
sys.path.insert(0,"../..")
from dot11 import Dot11, Dot11Types, Dot11ManagementFrame, Dot11ManagementAssociationResponse
from ImpactDecoder import RadioTapDecoder
from binascii import hexlify
import unittest
class TestDot11ManagementA... |
"""
Python script to check that properties in glade using Pango markup contain
valid markup.
"""
# Ignore any interruptible calls
# pylint: disable=interruptible-system-call
import sys
import argparse
# Import translation methods if needed
if ('-t' in sys.argv) or ('--translate' in sys.argv):
try:
from p... |
"""Tests for embargo app views. """
import unittest
from mock import patch
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from mako.exceptions import TopLevelLookupException
import ddt
from util.testing import UrlResetMixin
from embargo import messages
... |
from __future__ import print_function, division
from sympy.tensor.indexed import Idx
from sympy.core.mul import Mul
from sympy.core.singleton import S
from sympy.core.symbol import symbols
from sympy.concrete.expr_with_intlimits import ExprWithIntLimits
from sympy.functions.elementary.exponential import exp, log
from ... |
from functions import *
"""IMAP Fuzzer"""
PROPERTY={}
PROPERTY['PROTOCOL']="IMAP"
PROPERTY['NAME']=": IMAP Fuzzer"
PROPERTY['DESC']="Fuzz an IMAP server"
PROPERTY['AUTHOR']='localh0t'
user_stage = ['. login']
pass_stage = ['. login <EMAIL>']
stage_1 = ['. list ""','. lsub ""', '. status INBOX','. examine','. select','... |
from idlelib.WidgetRedirector import WidgetRedirector
from idlelib.Delegator import Delegator
class Percolator:
def __init__(self, text):
# XXX would be nice to inherit from Delegator
self.text = text
self.redir = WidgetRedirector(text)
self.top = self.bottom = Delegator(text)
... |
import serial
import string
import math
import time
from Tkinter import *
from threading import Timer
comPort = '/dev/ttyACM0' #default com port
comPortBaud = 38400
class App:
grid_size = 15
num_pixels = 30
image_started = FALSE
image_current_row = 0;
ser = serial.Serial(comPort, c... |
import django
from django.core.management.base import BaseCommand
from django.conf import settings
import os
import sys
class Command(BaseCommand):
help = "Runs this project as a uWSGI application. Requires the uwsgi binary in system path."
http_port = '8000'
socket_addr = None
def handle(self, *arg... |
from __future__ import absolute_import, division, print_function
import sys
import pytest
from _pytest.compat import is_generator, get_real_func, safe_getattr
from _pytest.outcomes import OutcomeException
def test_is_generator():
def zap():
yield
def foo():
pass
assert is_generator(zap... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields import GeometryField
from django.db import... |
from __future__ import print_function, division
from sympy.core import S, Add, Expr
from sympy.assumptions import Q, ask
from sympy.core.logic import fuzzy_not
def refine(expr, assumptions=True):
"""
Simplify an expression using assumptions.
Gives the form of expr that would be obtained if symbols
i... |
from __future__ import print_function
from git.test.lib import (
TestBase,
assert_equal,
assert_not_equal,
with_rw_repo,
fixture_path,
StringProcessAdapter
)
from git import (
Commit,
Actor,
)
from gitdb import IStream
from gitdb.test.lib import with_rw_directory
from git.compat import ... |
from django.template.defaultfilters import striptags
from django.test import SimpleTestCase
from django.utils.functional import lazystr
from django.utils.safestring import mark_safe
from ..utils import setup
class StriptagsTests(SimpleTestCase):
@setup({'striptags01': '{{ a|striptags }} {{ b|striptags }}'})
... |
# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 6
_modified_time = 1367126126.936375
_template_filename='htdocs/login.mako'
_template_uri='login.mako'
_template_cache=cache.Cache(__name__, _modified_time)... |
from namespaces import *
# Inline element don't cause a box
# They are analogous to the HTML elements SPAN, B, I etc.
inline_elements = (
(TEXTNS,u'a'),
(TEXTNS,u'author-initials'),
(TEXTNS,u'author-name'),
(TEXTNS,u'bibliography-mark'),
(TEXTNS,u'bookmark-ref'),
(TEXTNS,u'chapter'),
(TEXTN... |
import unittest
from quick_sort_concept import quick_sort
class QuickSortTest(unittest.TestCase):
def test_quick_sort_random_1(self):
data = [4, 1, 10, 4, 4, 3, 9, 4, 1, 9]
expected = [1, 1, 3, 4, 4, 4, 4, 9, 9, 10]
output = quick_sort(data)
self.assertEqual(expected, ... |
import hashlib
import logging
import os
import shutil
from typing import Generator, Optional, Dict, Any
from dataclasses import dataclass
from opentrons.config import CONFIG
from opentrons.system import nmcli
log = logging.getLogger(__name__)
class ConfigureArgsError(Exception):
pass
EAP_CONFIG_SHAPE = {
... |
import datetime
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, Template, TemplateDoesNotExist, RequestContext
from djan... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutClasses(Koan):
class Dog:
"Dogs need regular walkies. Never, ever let them drive."
def test_instances_of_classes_can_be_created_adding_parentheses(self):
# NOTE: The .__name__ attribute will convert the class
... |
""" Bibcheck plugin add the DOIs (from crossref) """
from invenio.bibrecord import record_add_field
from invenio.crossrefutils import get_doi_for_records
from invenio.bibupload import find_record_from_doi
def check_records(records, doi_field="0247_a", extra_subfields=(("2", "DOI"), ("9", "bibcheck"))):
"""
F... |
"""
Tools for memoization of function results.
"""
from functools import wraps
from six import iteritems
from weakref import WeakKeyDictionary
class lazyval(object):
"""
Decorator that marks that an attribute should not be computed until
needed, and that the value should be memoized.
Example
----... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import sys
from six.moves import builtins
from ansible import constants as C
from ansible.plugins import filter_loader, test_loader
def safe_eval(expr, locals={}, include_exceptions=False):
'''
This is intende... |
"""An example of training and predicting with a TFTS estimator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import numpy as np
import tensorflow as tf
try:
import matplotlib # pylint: disable=g-import-not-at-top
mat... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError
class TinyPicIE(InfoExtractor):
IE_NAME = 'tinypic'
IE_DESC = 'tinypic.com videos'
_VALID_URL = r'http://(?:.+?\.)?tinypic\.com/player\.php\?v=(?P<id>[^&]+)&s=\d+'
_TESTS = [
... |
"""Soundex algorithm
This program is part of "Dive Into Python", a free Python book for
experienced programmers. Visit http://diveintopython.org/ for the
latest version.
"""
__author__ = "Mark Pilgrim (<EMAIL>)"
__version__ = "$Revision: 1.2 $"
__date__ = "$Date: 2004/05/06 21:36:36 $"
__copyright__ = "Copyright (c)... |
from django.db import models
from django.core.urlresolvers import reverse
from autoslug import AutoSlugField
from model_utils.models import TimeStampedModel
from django_countries.fields import CountryField
class Player(TimeStampedModel):
GROUP_UNSPECIFIED = "unspecified"
GROUP_FIRST = "first"
GROUP_SECOND... |
"""
Verifies that a dependency on a bundle causes the whole bundle to be built.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
test.run_gyp('test.gyp', chdir='depend-on-bundle')
test.build('test.gyp', 'dependent_on_bundle', chdir='depend-... |
import itertools
import weakref
import atexit
import threading # we want threading to install it's
# cleanup function before multiprocessing does
from multiprocessing.process import current_process, active_children
__all__ = [
'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import logging
import os
import signal
import subprocess
import sys
from tornado.httpclient import HTTPClient, HTTPError
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.log i... |
"""This test verifies that the C++ test node and py.TestNode
It creates the same two node network with all four combinations
of TestNode and py.TestNode:
1. TestNode, TestNode
2. TestNode, py.TestNode
3. py.TestNode, TestNode
4. py.TestNode, py.TestNode
Then it performs the same tests as the twonode_network demo (ex... |
import random
import gym
import numpy as np
from collections import deque
from tensorflow.contrib.keras.python.keras.models import Sequential
from tensorflow.contrib.keras.python.keras.layers import Dense
from tensorflow.contrib.keras.python.keras.optimizers import Adam
from tensorflow.contrib.keras.python.keras... |
from . import test_note
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import sys
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
def is_list_type(obj, element_type):
if not type(obj) is list:
return False
if len(obj) < 1:
raise ValueError("Unable to determine list element type from empty list")
return type(obj[0]) is element_type
def clea... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'textbox02.xlsx'
... |
import numpy as np
from perceptron import Perceptron
class Adaline(Perceptron):
"""
Implementation of an Adaptive Linear Neuron, that can be abstracted to
various input sizes or dimensions. Displays using pyplot.
"""
ETA = 1
def __init__(self, grph, eta, max_t):
Perceptron.__init__(se... |
from openerp.osv import orm, fields
class AccountInvoice(orm.Model):
_inherit = 'account.invoice'
_columns = {
'is_ticket_summary': fields.boolean(
'Ticket Summary',
help='Check if this invoice is a ticket summary'),
'number_tickets': fields.integer('Number of tickets'... |
from django.utils import timezone
from . import models
def calculate_milestone_is_closed(milestone):
return (milestone.user_stories.all().count() > 0 and
all([task.status.is_closed for task in milestone.tasks.all()]) and
all([user_story.is_closed for user_story in milestone.user_stories.... |
"""
Verifies that xctest targets are correctly configured.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['xcode'])
# Ignore this test if Xcode 5 is not installed
import subprocess
job = subprocess.Popen(['xcodebuild', '-version'],
stdout=... |
"""Detect structural variation in genomes using high-throughput sequencing data.
"""
import collections
import copy
import operator
import toolz as tz
from bcbio.pipeline import datadict as dd
from bcbio.structural import (battenberg, cn_mops, cnvkit, delly,
lumpy, manta, metasv, plot, v... |
# Text Drawing
#
# This example shows off drawing text on the OpenMV Cam.
import sensor, image, time, pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
clock.tick()
img = ... |
import sys
import unittest
from tests.base import BaseTestCase
from pyasn1.type import constraint
from pyasn1.type import error
class SingleValueConstraintTestCase(BaseTestCase):
def setUp(self):
BaseTestCase.setUp(self)
self.v1 = 1, 2
self.v2 = 3, 4
self.c1 = constraint.SingleVa... |
"""Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... |
from django.template.defaultfilters import wordwrap
from django.test import SimpleTestCase
from django.utils.functional import lazystr
from django.utils.safestring import mark_safe
from ..utils import setup
class WordwrapTests(SimpleTestCase):
@setup({'wordwrap01':
'{% autoescape off %}{{ a|wordwrap:"3"... |
def to_bufferable(binary):
return binary
def _get_byte(c):
return ord(c)
try:
xrange
except:
def to_bufferable(binary):
if isinstance(binary, bytes):
return binary
return bytes(ord(b) for b in binary)
def _get_byte(c):
return c
def append_PKCS7_padding(data):... |
# -*- coding: utf-8 -*-
import calendar
from bson import ObjectId
from datetime import datetime
from modularodm import fields, Q
from framework.mongo import StoredObject
from framework.guid.model import GuidStoredObject
from website.settings import DOMAIN
from website.util import web_url_for, api_url_for
from websi... |
class AppSettings(object):
def __init__(self, prefix):
self.prefix = prefix
def _setting(self, name, dflt):
from django.conf import settings
getter = getattr(settings,
'ALLAUTH_SETTING_GETTER',
lambda name, dflt: getattr(settings, name,... |
import copy
import os
import re
import mxnet as mx
import numpy as np
from common import models
from mxnet.test_utils import discard_stderr
import pickle as pkl
def test_symbol_basic():
mlist = []
mlist.append(models.mlp2())
for m in mlist:
m.list_arguments()
m.list_outputs()
def test_symb... |
from .. import bar
from . import base
class _CrashMe(base._TextBox):
"""
A developer widget to force a crash in qtile.
Pressing left mouse button causes a zero divison error.
Pressing the right mouse button causes a cairo draw error.
"""
orientations = base.ORIENTATION_HORIZONTAL
... |
from __future__ import unicode_literals
import cgi
import codecs
import logging
import sys
import warnings
from io import BytesIO
from threading import Lock
from django import http
from django.conf import settings
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers impo... |
from django.core.management.base import NoArgsCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_')):
"Converts a module namespace to a Python dictionary. Used by get_settings_diff."
return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])
class Command(NoArgsComm... |
"""Entry point for CloudML training.
CloudML training requires a tarball package and a python module to run. This file
provides such a "main" method and a list of args passed with the program.
"""
import argparse
import json
import logging
import os
import tensorflow as tf
from . import _model
from . import _t... |
"""
Input module. Contains functions to read element, Slater-Koster and repulsion
data.
"""
def read_element(filename, symbol, format=None):
"""
Read element data from files.
Parameters:
-----------
fileobj: filename of file-object to read from
symbol: chemical symbol of the element
"... |
from .charsetprober import CharSetProber
from .constants import eNotMe
from .compat import wrap_ord
FREQ_CAT_NUM = 4
UDF = 0 # undefined
OTH = 1 # other
ASC = 2 # ascii capital letter
ASS = 3 # ascii small letter
ACV = 4 # accent capital vowel
ACO = 5 # accent capital other
ASV = 6 # accent small v... |
"""Reproduce an Water heater state."""
import asyncio
import logging
from typing import Any, Dict, Iterable, Optional
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import Context, State
from homeassistant.helpers.... |
# These classes implement a doctest runner plugin for nose, a "known failure"
# error class, and a customized TestProgram for NumPy.
# Because this module imports nose directly, it should not
# be used except by nosetester.py to avoid a general NumPy
# dependency on nose.
from __future__ import division, absolute_impo... |
"""
Use BDDs to solve SAT problems from DIMACS files.
TODO: try the tableau method too
"""
import bddsat
import dimacs
import sat
# Some problems from http://toughsat.appspot.com/
filenames = ['problems/trivial.dimacs',
'problems/factoring6.dimacs',
'problems/factoring2.dimacs',
... |
"""Contains an abstract base class for protocol messages."""
__author__ = '<EMAIL> (Will Robinson)'
class Error(Exception): pass
class DecodeError(Error): pass
class EncodeError(Error): pass
class Message(object):
"""Abstract base class for protocol messages.
Protocol message classes are almost always genera... |
from __future__ import absolute_import
"""
Tests for the incremental XML serialisation API.
From lxml
"""
from io import BytesIO
import unittest
import tempfile, os, sys
from .common_imports import etree, HelperTestCase, skipIf
from .. import xmlfile as etree
import pytest
from openpyxl.tests.helper import compar... |
"""Class representing instrumentation test apk and jar."""
import os
from pylib.instrumentation import test_jar
from pylib.utils import apk_helper
class TestPackage(test_jar.TestJar):
def __init__(self, apk_path, jar_path, test_support_apk_path):
test_jar.TestJar.__init__(self, jar_path)
if not os.path.e... |
from django.forms import ChoiceField, Field, Form, Select
from django.test import SimpleTestCase
class BasicFieldsTests(SimpleTestCase):
def test_field_sets_widget_is_required(self):
self.assertTrue(Field(required=True).widget.is_required)
self.assertFalse(Field(required=False).widget.is_required... |
from django.test import TestCase
from django.core.management import call_command
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from userena.models import UserenaSignup
from userena.managers import ASSIGNED_PERMISSIONS
from userena import settings as useren... |
import holidays_summary_report
import available_holidays
import hr_holidays_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface IdentifierConflictAcrossMembers1 {
const byte thing1 = 1;
readonly attribute long thing1;
};
""")
results = parser.finish()
except:
threw = True... |
from __future__ import absolute_import
import logging
from django.db import IntegrityError, transaction
from django.db.models import Q
from django.utils import timezone
from rest_framework.permissions import IsAuthenticated
from sentry.api.base import Endpoint
from sentry.api.exceptions import ResourceDoesNotExist
f... |
import sys
import xml.dom.minidom
from libtpcodegen import file_set_contents, u
from libglibcodegen import escape_as_identifier, \
get_docstring, \
NS_TP, \
Signature, \
type_to_gtype, \
... |
"""
Utils called from project_root/docs/conf.py when Sphinx
documentation is generated.
"""
from __future__ import division, print_function, unicode_literals
from future.builtins import map, open, str
from collections import OrderedDict
from datetime import datetime
import os.path
from shutil import copyfile, move
fro... |
"""
This script is a collection of all the testcases for easybuild-easyconfigs.
Usage: "python -m easybuild.easyconfigs.test.suite.py" or "./easybuild/easyconfigs/test/suite.py"
@author: Toon Willems (Ghent University)
@author: Kenneth Hoste (Ghent University)
"""
import glob
import os
import shutil
import sys
import ... |
"""Support functions for geographic operations"""
def aspect(df):
"""Return the aspect ratio of a Geopandas dataset"""
tb = df.total_bounds
return abs((tb[0] - tb[2]) / (tb[1] - tb[3]))
def scale(df, x):
"""Given an x dimension, return the x and y dimensions to maintain the dataframe aspect ratio"""... |
import matplotlib, pylab
from matplotlib.font_manager import FontProperties
from matplotlib.numerix import array, arange, reshape, shape, transpose, zeros
from matplotlib.numerix import Float
from matplotlib.ticker import NullLocator
matplotlib.interactive(False)
from chart import ChartOptions
class BarChart(ChartOp... |
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_dashboard.dashboards.project.stacks import views
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^select_template$',
views.SelectTemplateView.as_view(),
name='select... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.