content stringlengths 4 20k |
|---|
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compa... |
''' Example inspired by an example from the scikit-learn project:
http://scikit-learn.org/stable/auto_examples/cluster/plot_cluster_comparison.html
'''
from __future__ import print_function
import numpy as np
from sklearn import cluster, datasets
from sklearn.preprocessing import StandardScaler
from bokeh.layouts i... |
from gameboard import actions
class Action(object):
"""An action consists of a single move."""
def __init__(self):
pass
def perform(self, board):
"""Execute the action on the board."""
pass
def __str__(self):
return str(type(self))
class AttackAction(Action):
... |
"""Auth providers for Home Assistant."""
from __future__ import annotations
import importlib
import logging
import types
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant import data_entry_flow, requirements
from homeassistant.const import CONF_ID, CONF... |
########################################################################
#
# File Name: Notation.py
#
#
"""
Implementation of DOM Level 2 Notation interface
WWW: http://4suite.org/4DOM e-mail: <EMAIL>
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.org/COPYRIGHT f... |
# -*- coding: utf-8 -*-
# Feedback script
# Problem: Question de Bilan Final : Mission 9
from lib.pythia import *
from lib.french import *
import os
class Q1Feedback (BasicFeedbackSuite):
def __init__(self):
predefined = [('input/nonexisting.txt',), ('input/empty.txt',), ('input/novalidline.txt',), ('inp... |
import argparse
from euca2ools.commands.argtypes import delimited_list
from euca2ools.commands.monitoring import CloudWatchRequest
from euca2ools.commands.monitoring.argtypes import cloudwatch_dimension
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import P... |
"""
Mock unit tests for the NetApp block storage 7-mode library
"""
from lxml import etree
import mock
from cinder import exception
from cinder import test
import cinder.tests.volume.drivers.netapp.dataontap.fakes as fake
import cinder.tests.volume.drivers.netapp.fakes as na_fakes
from cinder.volume.drivers.netapp.d... |
import simuPOP as sim
pop = sim.Population(size=2000, loci=2)
sim.initGenotype(pop, freq=[.2, .8])
sim.mapPenetrance(pop, loci=0,
penetrance={(0,0):0, (0,1):.2, (1,1):.3})
sim.stat(pop, genoFreq=0, numOfAffected=1, vars='genoNum')
# number of affected individuals
pop.dvars().numOfAffected
# which should be roughly ... |
from __future__ import absolute_import
import urwid
import urwid.util
import os
from netlib.http.semantics import CONTENT_MISSING
import netlib.utils
from .. import utils
from ..models import decoded
from . import signals
try:
import pyperclip
except:
pyperclip = False
VIEW_FLOW_REQUEST = 0
VIEW_FLOW_RES... |
"""
Extends the nose runner to create a temporary filesystem during tests that is
subsequently torn down.
"""
import os
import shutil
from django.conf import settings
from django_nose import NoseTestSuiteRunner
class TempFilesystemTestSuiteRunner(NoseTestSuiteRunner):
"""Subclasses the nose test runner in order... |
#!/usr/bin/python
import argparse
import gc
import json
import logging
import sys
import multiprocessing as mp
# internal imports
from mongodb import output_data, output_latest, output_stat
from settings import DEFAULT_LOG_LEVEL, DEFAULT_MONGO_DATABASE, DOSTATS_INTERVAL
def main():
parser = argparse.ArgumentPars... |
"""
Provide tests for git_add_course management command.
"""
import logging
import os
import shutil
import StringIO
import subprocess
import unittest
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import over... |
import sys
# check: 2.4 <= version < 3.0
py_major, py_minor = sys.version_info[0:2]
if sys.hexversion < 0x2040000:
print >> sys.stderr, 'jag-tipdf requires Python version 2.4 or higher.'
sys.exit(2)
import re
import os
import glob
import platform
from subprocess import Popen, PIPE
from string import Template... |
import os
import gtk
import gobject
import logging
from chirp import chirp_common, directory
from chirp.drivers import generic_csv, generic_xml
from chirp.ui import memedit, dstaredit, bankedit, common, importdialog
from chirp.ui import inputdialog, reporting, settingsedit, radiobrowser, config
LOG = logging.getLogge... |
# -*- coding: utf-8 -*-
try:
from urllib.parse import urljoin
except ImportError:
# Python 2
from urlparse import urljoin
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
# See http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
# for all settings
CK... |
"""Auth models."""
from datetime import datetime, timedelta
import secrets
from typing import Dict, List, NamedTuple, Optional
import uuid
import attr
from homeassistant.util import dt as dt_util
from . import permissions as perm_mdl
from .const import GROUP_ID_ADMIN
TOKEN_TYPE_NORMAL = "normal"
TOKEN_TYPE_SYSTEM =... |
import operator
class Material(object):
def __init__(self, name, x0, lambdaI):
self.name = name
self.x0 = x0
self.lambdaI = lambdaI
material_CMS_ECAL = Material('CMS_ECAL', 8.9e-3, 0.25)
material_CMS_HCAL = Material('CMS_HCAL', None, 0.17)
material_void = Material('void', 0., 0.)
... |
"""
@copyright Copyright (c) 2014 Wanderson Bragança
"""
import sublime
import sublime_plugin
import os
import sys
import re
import imp
st_version = 2
if sublime.version() == '' or int(sublime.version()) > 3000:
st_version = 3
reloader_name = 'textconvert.reloader'
# ST3 loads each package as a module, so it nee... |
from flask.ext.testing import LiveServerTestCase
import twill
import time
class CloudTest(LiveServerTestCase):
def create_app(self):
try:
browser = twill.get_browser()
browser.go("http://0.0.0.0:5000/")
import cloud
cloud.app.config['LIVESERVER_PORT'] = 5010... |
"""
SoftLayer.tests.CLI.modules.object_storage_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import json
from SoftLayer import testing
class ObjectStorageTests(testing.TestCase):
def test_list_accounts(self):
result = self.run_comman... |
import warnings
from .common import ClientDeprecationWarning
from ..constants import Constants
from ..compatpatch import ClientCompatPatch
class MiscEndpointsMixin(object):
"""For miscellaneous functions."""
def sync(self, prelogin=False):
"""Synchronise experiments."""
if prelogin:
... |
"""
WSGI server implementation.
The Python Web Server Gateway Interface (WSGI) is a simple and universal
interface between web servers and web applications or frameworks.
The WSGI interface has two sides: the "server" or "gateway" side, and the
"application" or "framework" side. The server side invokes a callable
obj... |
import tempfile
import os
import unittest
import sys
import shutil
import StringIO
sys.path.append(os.environ['WAFDIR'])
sys.path.append(os.path.join(os.environ['WAFDIR'], 'Tools'))
class WafTestException(Exception):
pass
def get_function(name, function):
data = ''
if function:
func_path, func_fil... |
"""
BMP183
Copyright 2015 - Alexander Hiam <<EMAIL>>
A PyBBIO library for controlling BMP183 SPI pressure/temperature sensors.
BMP183 is released as part of PyBBIO under its MIT license.
See PyBBIO/LICENSE.txt
"""
import bbio
class BMP183(object):
ID_VALUE = 0x55
REG_ID = 0xd0
REG_S... |
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from .models import \
Member, Tag, Formation, Objective, Course, LectureCourse,\
LectureFile, QuestionCourse, Question, Answer, PracticeCourse, Promotion,\
DayAttribution, CourseAttri... |
"""
Module for token functionality.
Tokens act as a registry for storing arbitrary values associated with a user,
group, or other set of fields.
"""
import api
def get_token_path(token_name):
"""
Format the token name into a token path.
Returns:
The token path
"""
return "tokens.{}".form... |
#Written by Reid McIlroy-Young for Dr. John McLevey, University of Waterloo 2016
import collections
import csv
import re
from .tagProcessing.tagFunctions import scopusTagToFunction
from .tagProcessing.specialFunctions import scopusSpecialTagToFunc
from ..mkRecord import ExtendedRecord
from ..mkExceptions import RCTy... |
from gi.repository import GObject, Gedit
from .windowactivatable import WindowActivatable
from .library import ToolLibrary
import os
class AppActivatable(GObject.Object, Gedit.AppActivatable):
__gtype_name__ = "ExternalToolsAppActivatable"
app = GObject.property(type=Gedit.App)
def __init__(self):
... |
from __future__ import unicode_literals
import os
from optparse import make_option
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.six.moves import input
from django.utils.translation import ugettext_lazy as _
from wirecloud.commons.searchers import get_available_search_engines,... |
"""
Defines some base class related to managing green threads.
"""
from __future__ import absolute_import
import abc
from collections import OrderedDict
import logging
import socket
import time
import traceback
import weakref
import netaddr
import six
from ryu.lib import hub
from ryu.lib import sockopt
from ryu.li... |
import sys
import json
import unittest
import packet
import requests_mock
class PacketManagerTest(unittest.TestCase):
def setUp(self):
self.manager = PacketMockManager(auth_token="foo")
def test_get_user(self):
user = self.manager.get_user()
self.assertEqual(user.get("full_name"), "... |
from django.contrib.auth.models import Group
from django.test import TestCase
from dashboard.forms import AssignmentForm
from workshops.models import Person
class TestAssignmentForm(TestCase):
def setUp(self):
self.superuser = Person.objects.create(
personal="Harry",
family="Potte... |
# coding: utf-8
from __future__ import absolute_import
import re
import importlib
import sys
import errno
import os
import collections
from appr.client import ishosted
from termcolor import colored
def parse_version(version):
if str.startswith(version, "@sha256:"):
return {'key': 'digest', 'value': versi... |
from django.contrib.contenttypes.generic import BaseGenericInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.forms.models import ModelForm
from philo.models import Attribute
__all__ = ('AttributeForm', 'AttributeInlineFormSet')
class AttributeForm(ModelForm):
"""
This class han... |
import bpy
from bpy.props import BoolProperty, StringProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import (changable_sockets, multi_socket,
fullList, dataCorrect,
SvSetSocketAnyType, SvGetSocketAnyType)
class Test1Nod... |
import unittest
from geobricks_modis.core import modis_core as c
class GeobricksModisTest(unittest.TestCase):
def test_get_modis_product_table(self):
products = c.get_modis_product_table()
self.assertEqual(len(products), 68)
def test_list_products(self):
products = c.list_products()
... |
"""Handle version information related to Visual Stuio."""
import errno
import os
import re
import subprocess
import sys
import gyp
class VisualStudioVersion(object):
"""Information regarding a version of Visual Studio."""
def __init__(self, short_name, description,
solution_version, project_versi... |
'''
Test create eip and reconnect host
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.host_operations as host_ops
import os
test_stub = test_lib.lib_get_specifi... |
# -*- coding: UTF-8 -*-
from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from models import iis_logs, hit_stats
from forms import HitStatQueryForm
from datetime import datetime
import matplotlib.pypl... |
import time
import math
from rpython.rlib import jit
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rlib.rstring import StringBuilder
from hippy.error import PHPException
from hippy.builtin_klass import k_Exception
from hippy.module.date import timelib
from hippy.module.date.dateinterval_klass impo... |
'''
Created on Aug 9, 2016
@author: David Zwicker <<EMAIL>>
'''
from __future__ import division
import itertools
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mclr
from matplotlib.ticker import FormatStrFormatter, FuncFormatter, MaxNLocator
import six
from ..link.latex import numbe... |
from django.core.management.base import BaseCommand, CommandError
from barsystem_base.models import Product
class Command(BaseCommand):
args = '<filename>'
help = 'Import list of products'
csv_columns = 'id,name,sort,items,person_price,cash_price,type,bar_code,stock_value'.split(',')
column_mapping =... |
# -*- coding: utf-8 -*-
from otpauth import OtpAuth
from nose.tools import raises
def test_hotp():
auth = OtpAuth('python')
code = auth.hotp(4)
assert auth.valid_hotp(code) == 4
# false
assert auth.valid_hotp(1234567) is False
assert auth.valid_hotp(123456) is False
assert auth.valid_hotp... |
#!/usr/bin/python3
import csv
import queue
import MessageSystem
def Init(qtMainWindow):
global gQtMainWindow
gQtMainWindow = qtMainWindow
def ReadEdgeListCSV(fileName, delimiter = ','):
"""
Read edge list csv to a hash table.
"""
edgeList = {}
with open(fileName, newline = '') as csvFile... |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
clean_podcast_url,
float_or_none,
int_or_none,
strip_or_none,
try_get,
unified_strdate,
)
class SpotifyBaseIE(InfoExtractor):
_ACCESS_TOKEN = None
_OP... |
from twisted.internet import threads
from config import config
from enigma import eDBoxLCD, eTimer, iPlayableService, pNavigation
import NavigationInstance
from Tools.Directories import fileExists
from Components.ParentalControl import parentalControl
from Components.ServiceEventTracker import ServiceEventTracker
from ... |
class _ClassMethod:
# Helper class: instances represent methods bound to a class
def __init__(self, klass, func):
self.func = func
# oops: circular reference!
self.klass = klass
def __call__(self, *args, **kw):
# return result of function call
return self.func(self.k... |
#!/usr/bin/env python
"""
Program to align rnaseq transcriptome reads to the genome using STAR aligner
This wrapper will be considering organisms specific features while running
the STAR program.
Requirement:
STAR - https://github.com/alexdobin/STAR/releases
pysam - http://code.google.com/p/pysam/
m... |
from unittest import TestCase
import pickle
import multiprocessing
from ddsc.core.projectuploader import UploadSettings, UploadContext, ProjectUploadDryRun, CreateProjectCommand, \
upload_project_run, create_small_file, ProjectUploader, HashFileCommand, CreateSmallFileCommand, upload_folder_run
from ddsc.core.util ... |
"""HTML reporting for Coverage."""
import os, re, shutil, sys
import coverage
from coverage.backward import pickle
from coverage.misc import CoverageException, Hasher
from coverage.phystokens import source_token_lines, source_encoding
from coverage.report import Reporter
from coverage.results import Numbers
from cove... |
from flask import Blueprint, render_template, abort, request, session, g, redirect, flash, current_app
from jinja2 import TemplateNotFound
from flask_login import current_user, login_user, logout_user, login_required
from forms import RegistrationForm, LoginForm, ResetPasswordForm, NewPasswordForm, ChangePasswordForm
... |
class UnionFind(object):
def __init__(self,n):
self.parent=[-1]*n
self.rank=[0]*n
self.union=0
for i in xrange(n):
self.parent[i]=i
def find(self,x):
if self.parent[x]==x: return x
self.parent[x]=self.find(self.parent[x])
return self.paren... |
import yt
import numpy as np
from galaxy_analysis import Galaxy
from galaxy_analysis.utilities import utilities
from astroML.time_series import ACF_EK
from astroML.time_series import ACF_scargle
from matplotlib import rc
fsize = 17
rc('text', usetex=False)
rc('font', size=fsize)#, ftype=42)
line_width = 3
point_siz... |
from tactic_branding_wdg import *
from search_type_element_wdg import *
from custom_property_wdg import *
from search_limit_wdg import *
from top_wdg import *
from undo_log_wdg import *
from license_manager_wdg import *
from setup_manager_wdg import *
from shelf_wdg import *
from search_wdg import *
from plugin_wdg... |
from pystdf.Types import *
from pystdf.Indexing import *
from pystdf import V4
class StreamMapper(StreamIndexer):
def __init__(self, types=V4.records):
self.indexes = []
self.types = []
self.__rec_map = dict([((recType.typ, recType.sub), recType)
for recType... |
"""Generate random sequences."""
import itertools
import string
from typing import Dict, List
from dataclasses import dataclass
import numpy as np
def generate_random_sequences(vocab: List[str], pattern: str, n: int,
seed: int = 1) -> List[str]:
"""Generate random sequences.
Args:
... |
import functools
import warnings
def deprecated_alias(alias, func):
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter("always", DeprecationWarning) # turn off filter
warnings.warn(
"Call to deprecated function alias {}, use {} instead.".format(alias, func... |
import GemRB
from GUIDefines import *
from ie_stats import *
import CharGenCommon
import GUICommon
GenderWindow = 0
TextAreaControl = 0
DoneButton = 0
def OnLoad():
global GenderWindow, TextAreaControl, DoneButton
GenderWindow = GemRB.LoadWindow(1, "GUICG")
BackButton = GenderWindow.GetControl(6)
BackButton.... |
"""
Introduction
============
Define a variadic function:
>>> @variadic(int)
... def f(*xs):
... return xs
It can be called with a variable number of arguments:
>>> f()
()
>>> f(1, 2, 3, 4)
(1, 2, 3, 4)
So far, no change, but it can also be called with lists (any iterable, in fact) of... |
""""
Tabular Q-Learning implemented by Carlos Aguayo (<EMAIL>)
Adopted from https://gym.openai.com/algorithms/alg_0eUHoAktRVWWM7ZoDBWQ9w (accessed: 21.07.16)
Note: import dymrl is needed
"""
import random
import gym
import numpy as np
import pandas as pd
import dymrl
import os.path
class QLearner(object):
def ... |
import time, electrum_ltc as electrum, Queue
from electrum_ltc import Interface, SimpleConfig
from electrum_ltc.network import filter_protocol, parse_servers
# electrum.util.set_verbosity(1)
def get_peers():
# 1. start interface and wait for connection
interface = electrum.Interface('electrum-ltc.bysh.me:5000... |
from PyMca import PyMcaQt as qt
QTVERSION = qt.qVersion()
def uic_load_pixmap_FitActionsGUI(name):
pix = qt.QPixmap()
if QTVERSION < '4.0.0':
m = qt.QMimeSourceFactory.defaultFactory().data(name)
if m:
qt.QImageDrag.decode(m,pix)
return pix
class CheckField(qt.QWidget):
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''It provides common clauses.'''
from .util import Clause, star
from .chain import identifier_as_list, where_list
from .chain import single_identifier, column_list, values_list, set_list
from .chain import statement_list, identifier_list, identifier_dir_list, single_valu... |
# -*- coding: utf-8 -*-
from odoo.addons.stock_account.tests.test_anglo_saxon_valuation_reconciliation_common import ValuationReconciliationTestCommon
class TestStockLandedCostsCommon(ValuationReconciliationTestCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(ch... |
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import volume
authorize = extensions.soft_extension_authorizer('volume',
'volume_mig_status_attribute')
class VolumeMigStatusAttributeController(wsgi.Co... |
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.revent import *
from pox.lib.util import dpidToStr
from pox.lib.util import str_to_bool
from pox.lib.recoco import Timer
from pox.lib.packet import ethernet
import time
import threading
import asyncore
import collections
import logging
imp... |
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
from twisted.protocols.basic import LineReceiver
import socket,os,pprint
class Chat(LineReceiver):
def __init__(self, clients, liveIps):
self.clients = clients
self.liveIps = liveIps
self.name = Non... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.utils.html import strip_tags
from django.conf import settings
from campaign.models import Campaign
... |
#!/usr/bin/python
import gltk
from gltkdriver import GlutWindowDriver as WindowDriver
from OpenGL.GLU import *
from OpenGL.GL import *
class MyScreen(gltk.Screen):
def __init__(self):
gltk.Screen.__init__(self)
vbox = gltk.VBox()
model = gltk.SpinnerModel(1)
for i in range(10... |
from openstack import resource
from openstack.telemetry import telemetry_service
class Statistics(resource.Resource):
id_attribute = 'meter_name'
resource_key = 'statistics'
base_path = '/meters/%(meter_name)s/statistics'
service = telemetry_service.TelemetryService()
# Supported Operations
a... |
"""
test serviceping network scan
"""
from __future__ import print_function
from serviceping.network import scan, ScanFailed, ping, PingResponse
import unittest
# Any methods of the class below that begin with "test" will be executed
# when the the class is run (by calling unittest.main()
class TestServicepingScan(un... |
# -*- 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 'Message.slug'
db.add_column(u'nuntium_message', 'slug',
self.gf('djang... |
# defaults for VM definition in setup
VM_DEFAULT = {
"computeResource":"rhevm",
"clones":0,
"cluster":"userspace",
"storage":"BC_shared",
"domain":"bc.jonqe.lab.eng.bos.redhat.com",
"arch":"x86_64",
"disk":10,
"ram":4,
"cpus":1,
"image":""
... |
from tests.samples.dummy_pkg import DummyClass
class SomeClass(DummyClass):
pass |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
MANY_SLASHES_PATTERN = r'[\/]+'
MANY_SLASHES_REGEX = re.compile(MANY_SLASHES_PATTERN)
PATTERN_ITEM_OR_KEY_ACCESS = r'^(?P<attr_name>[a-zA-Z][\w\d]*)' \
r'\[((?P<index>\d+)|' \
r'[\'\"](?P<key>[\s\w\d]+)[\'\"])\]$'
REGEX_ITEM_OR_KEY_ACCESS = re.co... |
# -*- coding: utf-8 -*-
"""
Django settings for {{cookiecutter.project_name}} project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolu... |
import wx
import wx.calendar as callib
import wx.grid as gridlib
import cfg
import os
from datetime import date, datetime
from database import *
from grid import CustomDataTable
#********************************************************************
class UserColumnInfo:
"""This class defines th... |
import time
class Runner(object):
"""
Runs the given pipes once using the first pipe as the starting point
"""
def __init__(self, pipes, context):
self.pipes = pipes
self.context = context
def error_pipe(self, index, exception):
if index >= len(self.pipes):
return... |
"""
sentry.utils.stacks
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import inspect
import re
from django.utils.html import escape
from sentry.conf import settings
from sentry.utils import get_installed_apps, transform
d... |
import collections
import datetime
class PrefixTree(collections.defaultdict):
"""
A generic prefix tree (or trie) for counting and aggregating composite keys.
>>> tree = PrefixTree()
Keys are iterables of comparable, hashable objects, such as strings or tuples of integers.
Basic operations ... |
import re
import time
import unittest
import nohang
class TestNohang(unittest.TestCase):
data = "95756, KURN , 20110311, 2130, -34.00, 151.21, 260, 06.0, -9999.0, -9999.0, -9999.0, -9999.0, -9999.0, -9999, -9999, 07.0, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -999... |
import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class CompleteDirectOnlineTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
def run_test(self):
... |
import socket
import struct
import errno
from subprocess import Popen
from glue import MyThread
from time import sleep
BANNER = 0
BANNER_SIZE = 24
HEAD = 1
HEAD_SIZE = 4
DATA = 2
class CapClient(MyThread):
def __init__(self, parent):
MyThread.__init__(self)
disp_max = max(parent.size)
... |
# -*- coding: utf-8 -*-
# Global imports
from datetime import datetime
import re
import logging
# Django imports
from django.db import connections, transaction
from django.db.models import F
# Local imports
from routing.models import Way
from routing.mathfunctions import total_seconds
MAP_DB = 'osm_data'
sac_scale... |
'''
Euler-cromer and Euler algorithm simulating the Simple
Harmonic Motion!
ecRes = tuple with the states of the Euler Cromer algorithm
eoRes = tuple with the states of the classic Euler algorithm
aRes = tuple with the states of the analytical calculation
'''
import math as m
import matplotlib.pyplot as plt
def calc... |
#!/usr/bin/python3
"""Install a 'blob' file from an extract shell archive.
This script installs the 3rd party blob contained in a previously
downloaded extract-*.sh file. This avoids the need to have to page
through and accept the user agreement (which is what you have to do if
you execute the archive directly).
"""
... |
# -*- encoding: utf-8 -*-
import pytest
from abjad import *
from abjad.tools.lilypondparsertools import LilyPondParser
def test_lilypondparsertools_LilyPondParser__misc__chord_repetition_01():
target = Container([
Chord([0, 4, 7], (1, 4)),
Chord([0, 4, 7], (1, 4)),
Chord([0, 4, 7], (1, 4)... |
def test_module(mio, tmpdir, capfd):
with tmpdir.ensure("foo.mio").open("w") as f:
f.write("""
hello = block(
print("Hello World!")
)
""")
foo = mio.eval(
"""foo = Module clone("foo", "{0:s}")""".format(str(tmpdir.join("foo.mio"))))
assert rep... |
#!/usr/bin/env python
import json
import sys
import os
import operator
import requests
import datetime
import warnings
class ReadmeMaker:
def __init__(self):
self.infile = os.path.join(os.path.curdir, 'readme-data.json')
self.outfile = 'README.md'
self.repository = 'https://github.com/N... |
"""Config flow for Tellduslive."""
import asyncio
import logging
import os
import async_timeout
from tellduslive import Session, supports_local_api
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from homeassistant.util.json import load_json
from .const imp... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Newsletter'
db.create_table(
u'newsletter_new... |
u'''
Created on Oct 5, 2010
Refactored from ModelObject on Jun 11, 2011
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from __future__ import with_statement
import os, io, logging
from arelle import XmlUtil, XbrlConst, ModelValue
from arelle.ModelObject im... |
"""Miscellaneous utility functions and classes.
This module is used internally by Tornado. It is not necessarily expected
that the functions and classes defined here will be useful to other
applications, but they are documented here in case they are.
The one public-facing part of this module is the `Configurable` cl... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layers', '26_to_27'),
]
operations = [
migrations.AlterField(
model_name='layer',
name='abstract_en'... |
#!/usr/bin/env python
'''
@author Tim G
@date Wed Mar 27
'''
from csv import DictReader
from StringIO import StringIO
def spike_parser(document):
'''
This parser YIELDS a document per call or until it's done
The format for the document is CSV in this table format
Array,Instrument Class,Reference Desig... |
from __future__ import (absolute_import, division, print_function)
CONTEXT_KEYS = [
'reset', 'error', 'badinfo',
'in_browser', 'in_statusbar', 'in_titlebar', 'in_console',
'in_pager', 'in_taskview',
'active_pane', 'inactive_pane',
'directory', 'file', 'hostname',
'executable', 'media', 'link',... |
"""
Support for reading data from a serial port.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.serial/
"""
import asyncio
import logging
import json
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistan... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogrbuffer.py
---------------------
Date : Janaury 2015
Copyright : (C) 2015 by Giovanni Manghi
Email : giovanni dot manghi at naturalgis dot pt
*****... |
from __future__ import print_function, unicode_literals
import datetime
import calendar
from flask import render_template, request, send_file, Response, url_for
from functools import wraps, partial
from weblab.core.web import weblab_api
from weblab.core.db import UsesQueryParams
def check_credentials(func):
@wraps... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.