content stringlengths 4 20k |
|---|
from typing import Any, Dict, List, Union
from airflow.exceptions import AirflowException
from airflow.models.baseoperator import BaseOperator # pylint: disable=R0401
from airflow.models.xcom import XCOM_RETURN_KEY
class XComArg:
"""
Class that represents a XCom push from a previous operator.
Defaults t... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import remo.base.utils
import remo.profiles.models
import django.db.models.deletion
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
... |
import vtk
import requests
# to support alternative baseURL
import os
import os.path
def add_arguments(parser):
parser.add_argument("--tree1", help="URI to serialized vtkTree", dest="tree1URI")
parser.add_argument("--tree2", help="URI to serialized vtkTree", dest="tree2URI")
parser.add_argument("--table",... |
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import logging
import re
import time
from basedeployer import BaseDeployer
from library.models import *
from cmudbac.settings import *
import utils
## =====================================================================
## LOGGING CO... |
import sys
import os
import tempfile
import time
import getpass
import numpy as np
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
matplotlib_usetex = False
plt.rc('text', usetex=matplotlib_usetex)
plt.rc('font', family='sans-serif')
from matplotlib.ticker import NullFormatter
import scipy
if ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 15 19:22:32 2013
@author: mel
"""
import wx
from .._Folder import Folder
from .Task import Task
from .TaskFolder import TaskFolder
class FinishedTasks(Folder):
"""Clase que representa a las tareas pendientes"""
task_container = True
@property
def stat... |
# coding: utf8
"""
Ensemble de fonctions pour créer des ensembles de données d'apprentissage pour
la résolution du problème "Le jardinier et les taupes".
"""
import os
import time
import itertools
import numpy as np
from uuid import uuid4
from collections import namedtuple
InstanceParams = namedtuple('InstanceParams'... |
import utils
utils.backup(__file__)
import pylab as pl
import numpy.testing as tests
import itertools
class OptimalChannels(object):
def __init__(self,p_uA_given_A=0.8,p_uA_given_B=0.1,
p_uB_given_A=None,p_uB_given_B=None,N_u=10):
self.p_uA_given_A = p_uA_given_A
self.p_uA_given_B... |
import virtool.downloads.db
async def test_generate_sequence_fasta(dbi, test_otu, test_sequence):
await dbi.otus.insert_one(test_otu)
await dbi.sequences.insert_one(test_sequence)
expected = (
"prunus_virus_f.isolate_8816-v2.kx269872.fa",
">Prunus virus F|Isolate 8816-v2|KX269872|27\nTGTT... |
"""BibEdit Regression Test Suite."""
__revision__ = "$Id$"
import unittest
from invenio.config import CFG_SITE_URL
from invenio.testutils import make_test_suite, run_test_suite, \
test_web_page_content, merge_error_messages
class BibEditWebPagesAvailabilityTest(unittest.TestCase):
... |
"""Provides device automations for Media player."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_CONDITION,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
STATE_IDLE,
STATE_OFF,
STATE_ON,
STATE_PAUSE... |
import traceback
from _emerge.SpawnProcess import SpawnProcess
import copy
import io
import signal
import sys
import portage
from portage import os
from portage import _encodings
from portage import _unicode_encode
from portage import _unicode_decode
from portage.checksum import _hash_filter
from portage.elog.messages... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import autoslug.fields
import phorum.models.managers
from django.conf import settings
import django.utils.timezone
import phorum.models
import django.core.validators
class Migration(migrations.Migration):
de... |
import os
import threading
import time
import traceback
from abc import ABCMeta, abstractmethod
from typing import Type, Union, Dict, Any, Optional
from dbt import tracking
from dbt import ui
from dbt.contracts.graph.manifest import Manifest
from dbt.contracts.results import (
NodeStatus, RunResult, collect_timing... |
########################
# Jean-Philippe Groulx #
# Pierre-Emmanuel Viau #
# Yann David #
# #
# #
# Classe Map #
# Proprietaire: Yann #
########################
#import
from Fichier import *
from Vecteur import *
from Constantes import *
c... |
### Author: <<EMAIL>>
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
global mysql_host
mysql_host = os.getenv('DSTAT_MYSQL_HOST')
global mysql_port
mysql_port = os.getenv('DSTAT_MYSQL_PORT')
global mysql_socket
mysql_socke... |
import re
import os
import requests
import urllib.request
import hentai_extension
from bs4 import BeautifulSoup
def gelbooru_downloader(imageid):
imageurl = 'http://gelbooru.com/index.php?page=post&s=view&id=' + str(imageid)
image_source_code = requests.get(imageurl)
image_plain_text = image_source_code.... |
# -*- coding: utf-8 -*-
from django.views.generic import (
CreateView,
UpdateView,
DeleteView,
ListView
)
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse_lazy
from django.contrib import messages
from django.http import HttpResponseRedirect
from licen... |
import operator
class Authorization(object):
"""
A base class that provides no permissions checking.
"""
def __get__(self, instance, owner):
"""
Makes ``Authorization`` a descriptor of ``ResourceOptions`` and creates
a reference to the ``ResourceOptions`` object that may be us... |
import jsonPy
import time
import subprocess
t0=time.time()
t1=0
t2=0
command="python ./genJunitReport.py -nValueClass -d'"
junit='test3BaseLibrary|getValueException%'
try:
jsonPy.open("./jsons/sample.null.json")
jsonPy.getStringValueByPath("root.menu.xxxxxxxtitle")
except:
print "Test3 - jsonPy.getStringValueByP... |
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
if sys.version > '3':
long = int
import hashlib
from bitcoinpy.lib.serialize import Hash, Hash160, ser_uint256, ser_uint160
from bitcoinpy.lib.script import *
from bitcoinpy.lib.core import CTxOut, CTransaction
from bitc... |
from io import BytesIO
import pickle
import unittest
import numpy
import cartopy.crs as ccrs
class TestCRS(unittest.TestCase):
def test_hash(self):
stereo = ccrs.Stereographic(90)
north = ccrs.NorthPolarStereo()
self.assertEqual(stereo, north)
self.assertFalse(stereo != north)
... |
#!/usr/bin/python
#coding:utf-8
import numpy as np
import math
import sys
import os
import time
import matplotlib.pyplot as plt
from pprint import pprint
import matplotlib.animation as animation
import cPickle as pickle
from copy import deepcopy
def load_coordiantes(file_path):
with open(file_path, 'rb') as... |
from __future__ import unicode_literals
from encoding import uu
def ex(e):
"""
:param e: The exception to convert into a unicode string
:return: A unicode string from the exception text if it exists
"""
return uu(e)
class SickRageException(Exception):
"""
Generic SiCKRAGE Exception - s... |
import serial
class DummySCPI:
def __init__(self, port='/dev/usb/ttyUSB0', baudrate=9600, parity=serial.PARITY_NONE, bytesize=serial.EIGHTBITS):
self.td = 0
self.ts = "BUS"
self.ds = True
self.message = ""
self.state_ = False
def beep(self):
pass
def getErrors(self):
return []
d... |
"""
Tests the execution of forum notification tasks.
"""
from datetime import datetime, timedelta
import json
import math
from crum import CurrentRequestUserMiddleware
import ddt
from django.contrib.sites.models import Site
import mock
import lms.lib.comment_client as cc
from django_comment_common.models import Foru... |
from __future__ import print_function
try: # Python 3
import http.client as httplib
except ImportError: # Python 2
import httplib
import json
import re
import base64
import sys
import os
import os.path
settings = {}
##### Switch endian-ness #####
def hex_switchEndian(s):
""" Switches the endianness of a hex ... |
#!/usr/bin/python
import collections as col
import forgi.utilities.stuff as fus
import itertools as it
import json
import math
import RNA
import sys
from optparse import OptionParser
def main():
usage = """
python scripts/dotplus.py sequence
Create a file for displaying as a dotplot using the provided se... |
"""Measurement smoke test to make sure that no new action_name_to_run is
defined."""
import os
import optparse
import logging
import unittest
from measurements import rasterize_and_record_micro
from telemetry import benchmark as benchmark_module
from telemetry.core import discover
from telemetry.page import page_tes... |
from flask import url_for
from models import Cluster, Tags, TaggingSpeed, User, Pages
from . import BasicTestCase
class FixturesTest(BasicTestCase):
def setUp(self):
self.client.post(url_for("fixtures.reset_db"))
def assert_count(self, model, expected_count, **kwargs):
self.assertEquals(mode... |
import unittest
from unittest import mock
from pyrser import parsing
class TestAlt(unittest.TestCase):
def test_it_calls_skipIgnore_before_each_clause(self):
parser = mock.Mock(spec=parsing.BasicParser)
pt = mock.Mock(return_value=False)
parser.pt = pt
parsing.Alt(pt, pt)(parser)
... |
import unittest
from . import FunctionalTestCase
SCHEMA = """
{
"title": "Object",
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
}
"""
class TestTypes(FunctionalTestCase):
def test_write_integer(self):
... |
#!/usr/bin/env python
from nose.tools import *
from nose import SkipTest
from nose.plugins.attrib import attr
import networkx as nx
from networkx.algorithms import bipartite
class TestBipartiteBasic:
def test_is_bipartite(self):
assert_true(bipartite.is_bipartite(nx.path_graph(4)))
assert_true(bip... |
import logging
from decimal import Decimal
import tablib
from django.test import TestCase
from django.utils.datetime_safe import date
from hordak.models import Account, StatementImport, StatementLine
from hordak.resources import StatementLineResource
from hordak.tests.utils import DataProvider
class StatementLineRe... |
"""
Copyright (c) 2014 Brian Muller
Copyright (c) 2015 OpenBazaar
"""
from collections import Counter, defaultdict
from twisted.internet import defer
from log import Logger
from dht.utils import deferredDict
from dht.node import Node, NodeHeap
from protos import objects
class SpiderCrawl(object):
"""
Craw... |
from distutils.core import setup
from setuptools import find_packages
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
shapely_dep = "Shapely<1.5.13"
else:
shapely_dep = "Shapely==1.5.17"
setup(name='GeoNode',
version=__import__('geonode').get_version(),
description="App... |
from openerp import exceptions
from openerp.tests import common
class TestQuantitiesModifications(common.TransactionCase):
def setUp(self):
super(TestQuantitiesModifications, self).setUp()
self.product1 = self.browse_ref('sale_order_quantities_modifications.product1')
self.product2 = self... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils.log import log_once
try:
from flexge... |
from django.db import models
import datetime
from easy_thumbnails.files import get_thumbnailer
from filer.fields.image import FilerImageField
import shortuuid
class Calendar(models.Model):
name = models.CharField(max_length=250)
uuid = models.CharField(max_length=22)
YEAR_CHOICES = [(r, r) for r in r... |
#!/usr/bin/env python
# encoding: utf-8
'''
Created by Brian Cherinka on 2016-04-29 01:15:33
Licensed under a 3-clause BSD license.
Revision History:
Initial Version: 2016-04-29 01:15:33 by Brian Cherinka
Last Modified On: 2016-04-29 01:15:33 by Brian
'''
from __future__ import print_function
from __future__... |
from app import app, db, site_name, site_tagline, ts
from sqlalchemy.ext.hybrid import hybrid_property
from flask.ext.bcrypt import Bcrypt
from sqlalchemy import func, and_
from sqlalchemy.sql import text
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask.ext.login import UserMixin, login... |
"""Setup tool for protoc_docs_plugin."""
import setuptools
setuptools.setup(
name='protoc-docs-plugin',
version='0.8.0',
description='Plugin for reading and writing documentation from '
'protobuf files into existing generated protoc output.',
author='Luke Sneeringer',
author_email... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergl.marker.colorbar"
_path_str = "scattergl.marker.colorbar.tickformatstop"
_v... |
"""A widget for searching git commits"""
from __future__ import division, absolute_import, unicode_literals
import time
import subprocess
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtCore import Qt
from PyQt4.QtCore import SIGNAL
from cola import core
from cola import gitcmds
from cola import utils
... |
from shutil import move
import os
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.contrib import messages
from django.contrib.messages import constants as messages
from common.helpers import jsonify, resolve_http_method
from common.forms imp... |
__author__ = 'suwelack'
from msml.io.mapper.base_mapping import *
import inspect
import types
from msml.exporter.base import *
from msml.model.base import *
class MSMLWriter(object):
def __init__(self, mapping):
self._mapping = mapping
assert isinstance(self._mapping, BaseMapping)
def map(sel... |
"""This example creates custom fields.
To determine which custom fields exist, run get_all_custom_fields.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication i... |
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from django.views.generic import ListView, DetailView
from django.views.generic.edit import FormView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.cor... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Account import Account
from module.plugins.internal.Plugin import set_cookie
class ShareonlineBiz(Account):
__name__ = "ShareonlineBiz"
__type__ = "account"
__version__ = "0.41"
__status__ = "testing"
__description__ = """Sha... |
__author__ = 'dmorina, megha'
from csp import settings
import httplib2
from django.http import HttpResponseRedirect
from crowdsourcing import models
from apiclient import discovery, errors
from apiclient.http import MediaFileUpload
from oauth2client.client import Credentials
from rest_framework.viewsets import ViewSet
... |
from diffcalc.hkl.common import getNameFromScannableOrString
from diffcalc.util import command
class WillmottHklCommands(object):
def __init__(self, hklcalc):
self._hklcalc = hklcalc
self.commands = [self.con,
self.uncon,
self.cons]
def __str... |
import os
import ast
import threading
import random
import time
import json
import copy
import re
import stat
from i18n import _
from util import NotEnoughFunds, PrintError, profiler
from plugins import run_hook, plugin_loaders
from keystore import bip44_derivation
# seed_version is now used for the version of the w... |
import numpy as np
from . import _spatial_mp
from . import geometry
class GridFilter(object):
"""Geographic filter from a grid
:Parameters:
grid_ll_x : float
Projection x coordinate of lower left corner of lower left pixel
grid_ll_y : float
Projection y coordinate of lower left corn... |
from __future__ import unicode_literals
from django.utils import six
from django.utils.translation import ugettext as _
from django.template.defaultfilters import truncatechars
from reviewboard.accounts.models import ReviewRequestVisit
from reviewboard.admin.server import build_server_url
from reviewboard.diffviewer.... |
import wx
import odict
from cuttlebug import util
import random, inspect
# APPLICATION SPECIFIC
# pub/sub topics
PROJECT_OPEN = 1
PROJECT_CLOSE = 2
TARGET_ATTACHED = 3
TARGET_DETACHED = 4
TARGET_RUNNING = 5
TARGET_HALTED = 6
BUILD_STARTED = 7
BUILD_FINISHED = 8
class MenuItemProxy(object):
def __init__(self, ... |
#!/usr/bin/python3
# -*- coding_ utf-8 -*-
""" This program implements a viewer for the LPO data structure.
A LPO is a partial ordered set of events. If two events are ordered
this order is represented by an arrow. If there is an arrow form an
event a to an event b this means event b occurs after event a.
Usage: pyt... |
from generator.analysis.verifier_tools import *
def after_SystemStateFlow(analysis):
# Find all three systemcall handlers
(H1, H2, H3, H4, H5, Idle, StartOS, bar) = \
get_functions(analysis.system_graph, ["H1", "H2", "H3", "H4", "H5",
"Idle", "StartOS", "bar"])
... |
import os
from ige import log
from ige.ClientMngr import ClientMngr
from ige.Config import Config
from ige.Const import OID_UNIVERSE
from ige.ospace.GameMngr import GameMngr
from ige.IssueMngr import IssueMngr
from ige.MsgMngr import MsgMngr
from ige.SQLiteDatabase import Database, DatabaseString
def rpc(f):
retu... |
from __future__ import absolute_import
from core.components.event.eventaction import EventAction
from core.components.item import Item
class AddItemAction(EventAction):
""" Adds an item to the current player's inventory.
The action parameter must contain an item name to look up in the item database.
"""... |
import netaddr
from tempest.lib import exceptions as lib_exc
def get_unused_ip_addresses(ports_client, subnets_client,
network_id, subnet_id, count):
"""Return a list with the specified number of unused IP addresses
This method uses the given ports_client to find the specified n... |
"""Contains the logic for `aq show building`."""
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.commands.show_location_type import CommandShowLocationType
class CommandShowBuildingAll(CommandShowLocationType):
required_parameters = []
def render(self, session,... |
from twisted.internet.defer import inlineCallbacks
from twisted.internet.serialport import SerialPort
from autobahn.twisted.wamp import ApplicationSession
from txXBee.protocol import txXBee
from handlers import handle_rx
from handlers import is_RX
from handlers import is_PANID
class McuProtocol(txXBee):
""" Pr... |
import math
import curses
import asyncio
import view
class NetView(view.View):
_mode_name = "net"
def __init__(self):
self._nettotals_history = []
super().__init__()
async def _draw(self):
self._clear_init_pad()
deltas = []
if self._nettotals_history:
... |
import random
import sys
import time
import threading
import weaver.client as client
num_started = 0
num_finished = 0
num_clients = 100
cv = threading.Condition()
def exec_clusterings(reqs, cl, exec_time, idx):
global num_started
global cv
global num_clients
global num_finished
with cv:
w... |
#!/usr/bin/python
#coding: utf-8
#(c) 2013 Julian Ceballos <@jceb>
import os
import base64
import inspect
from httplib2 import Http
try:
import json
except ImportError:
import simplejson as json
API_VERSION = '0.2.0'
__version__ = '0.6'
__author__ = 'Julian Ceballos'
API_BASE = 'https://api.conekta.io/'
H... |
"""Tests for deCONZ config flow."""
from unittest.mock import patch
import asyncio
from homeassistant.components.deconz import config_flow
from tests.common import MockConfigEntry
import pydeconz
async def test_flow_works(hass, aioclient_mock):
"""Test that config flow works."""
aioclient_mock.get(pydeconz... |
from __future__ import unicode_literals
template = {
"Resources": {
"HostedZone": {
"Type": "AWS::Route53::HostedZone",
"Properties": {
"Name": "my_zone"
}
},
"my_health_check": {
"Type": "AWS::Route53::HealthCheck",
... |
'''
Created on Nov 11, 2013
@author: Matthias Sperber
'''
#from numpy.random import poisson
import numpy
import math
import scipy.stats as stats
import copy
import source.prob as prob
import source.expressions as expr
import source.graph as graph
from source.prob import HyperParameters
def selectBooksForFirstRea... |
import numpy as npy
import matplotlib.cm as cm # plot lib
import matplotlib.pyplot as plt # plot lib (for figures)
from matplotlib import rc
exp1Categoria = npy.loadtxt('/home/monica/Dropbox/Cesar/Gratings/exp1_DSIporcategoria.txt')
exp2Categoria = npy.loadtxt('/home/monica/Dropbox/Cesar/Gratings/exp2_DSIp... |
"""Modality base class - defines the bottom and top of the model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import tensorflow as tf
from layers import common_layers
class Modality(object):
"""Abstract Modality class for data transform... |
import argparse
import os
import sys
import psycopg2
import shutil
import fsurfer
import fsurfer.log
import fsurfer.helpers
PARAM_FILE_LOCATION = "/etc/fsurf/db_info"
VERSION = fsurfer.__version__
def purge_workflow_files(result_dir, log_filename, output_filename):
"""
Remove the results in specified direc... |
from argparse import ArgumentParser
from os import listdir
from os.path import isdir, join
from re import compile, sub
from random import random
from numpy import floor
def make_list(datadir, template, outlist):
inf = open(template, 'r')
content = inf.readlines()
inf.close()
p = compile('num|path')
dirs ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('api', '0001_initial'),
]
operati... |
# -*- 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 'Event.source'
db.add_column('events_event', 'source',
self.gf('django.... |
"""Tests for sparse distributed polynomials and Groebner bases. """
from sympy.polys.groebnertools import (
sdp_LC, sdp_LM, sdp_LT, sdp_del_LT,
sdp_coeffs, sdp_monoms,
sdp_sort, sdp_strip, sdp_normal,
sdp_from_dict, sdp_to_dict,
sdp_indep_p, sdp_one_p, sdp_one, sdp_term_p,
sdp_abs, sdp_neg,
... |
# -*- coding: utf-8 -*-
import unittest
from statik.pagination import *
class MockDBQuery(object):
def __init__(self, items):
self._items = items
self._offset = 0
self._limit = None
def count(self):
return len(self._items)
def offset(self, offset):
self._offset... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 04:03:19 2015
@author: winpython
"""
from matplotlib.pyplot import imshow
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import cPickle, pickle
import gzip
thelist = np.array(['8_7', '1_12', '2_8', '3_15', '8_16', '7_1', '0_3', '1_0', '9_18'... |
import numpy as np
from scipy.spatial.distance import cdist
def naive(coord1, coord2):
'''Returns the distance between points in two sets of coordinates.
This function uses loops over all elements in each dataset to get the distances.
That is the most naive implementation of this function.
Parameters
c... |
from io import StringIO
import pytest
import kevlar
from kevlar.tests import data_file
from kevlar.seqio import KevlarPartitionLabelError
from kevlar.sequence import KmerOfInterest, Record
import khmer
import pysam
import screed
import shutil
@pytest.fixture
def bogusseqs():
seq = '>seq1\nACGT\n>seq2 yo\nGATTACA\... |
from couchdb import client
from django.conf import settings
class CouchDBImproperlyConfigured(Exception):
pass
try:
HOST = settings.COUCHDB_HOST
except AttributeError:
raise CouchDBImproperlyConfigured("Please ensure that COUCHDB_HOST is " +
"set in your settings file.")
DATABASE_NAME = getattr(s... |
from __future__ import unicode_literals
# Portions (c) 2014, Alexander Klimenko <<EMAIL>>
# All rights reserved.
#
# Copyright (c) 2011, SmartFile <<EMAIL>>
# All rights reserved.
#
# This file is part of DjangoDav.
#
# DjangoDav is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... |
from functools import total_ordering
import itertools
import re
all_modules = []
@total_ordering
class Module(object):
"""
A module is the basic abstraction in our test runner script. Each module consists of a set
of source files, a set of test commands, and a set of dependencies on other modules. We use... |
"""Unit tests for contextlib.py, and other context managers."""
import sys
import tempfile
import unittest
from contextlib import * # Tests __all__
from test import support
try:
import threading
except ImportError:
threading = None
class ContextManagerTestCase(unittest.TestCase):
def tes... |
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import fields
from django.utils.translation import ugettext_lazy as _
class UserManager(BaseUserManager):
def __create_user(se... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import getdate, validate_email_add, cstr
from webnotes.model.doc import make_autoname
from webnotes import msgprint, _
sql = webnotes.conn.sql
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
d... |
"""Support for Ecovacs Ecovacs Vaccums."""
import logging
import sucks
from homeassistant.components.vacuum import (
SUPPORT_BATTERY,
SUPPORT_CLEAN_SPOT,
SUPPORT_FAN_SPEED,
SUPPORT_LOCATE,
SUPPORT_RETURN_HOME,
SUPPORT_SEND_COMMAND,
SUPPORT_STATUS,
SUPPORT_STOP,
SUPPORT_TURN_OFF,
... |
'''
Mouse provider implementation
=============================
On linux systems, the mouse provider can be annoying when used with another
multitouch provider (hidinput or mtdev). The Mouse can conflict with them: a
single touch can generate one event from the mouse provider and another
from the multitouch provider.
... |
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from .iq_groups import GroupsIqProtocolEntity
class RemoveAllParticipantsGroupIqProtocolEntity(GroupsIqProtocolEntity):
'''
<iq id="{{id}}"" type="get" to="{{group_jid}}" xmlns="w:g2">
<query request="interactive"></query>
</iq>
'''
... |
from openerp.osv import orm, fields
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
import time
from dateutil.relativedelta import relativedelta
from datetime import datetime
class sale_order(orm.Model):
_inherit = 'sale.order'
def action_wait(self, cr, uid, ids... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_urlparse,
)
from ..utils import (
unified_strdate,
qualities,
)
class WDRIE(InfoExtractor):
_PLAYER_REGEX = '-(?:video|audio... |
import pandas as pd
from bokeh.models import HoverTool
from bokeh.models.formatters import DatetimeTickFormatter
from bokeh.plotting import figure, ColumnDataSource
from app import db
from app.decorators import data_quality
# creates your plot
date_formatter = DatetimeTickFormatter(microseconds=['%f'],
... |
import os.path
import cPickle
from .path import getScriptDirectory
from .translator import Translator
# name of the save file
SAVE_FILENAME = 'config.dat'
# not containing all methods, but instead properties which will be pickled and saved
class DataSafe(object):
def __init__(self):
pass
class Configurator(ob... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... |
from __future__ import division
from vistrails.core.cache.hasher import Hasher
def vtk_hasher(pipeline, module, chm):
outgoing_connections = pipeline.graph.edges_from(module.id)
incoming_connections = pipeline.graph.edges_to(module.id)
current_hash = Hasher.module_signature(module, chm)
chashes = [Has... |
#!/usr/bin/python2.7
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import string
import re
import os
RAIZ = "/Documents/PornoDuro/Tiamat/Tiamat/"
HOME = os.path.expanduser("~")
import sys
sys.path.insert(0, HOME+RAIZ+'Core')
sys.path.insert(0,"../.")
import TiamatCore
from PageManager import PageManage... |
from __future__ import division
import numpy as np
import scipy.sparse as sp
import array
from sklearn.utils import check_random_state
from ._random import sample_without_replacement
from .deprecation import deprecated
__all__ = ['sample_without_replacement', 'choice']
# This is a backport of np.random.choice from ... |
"""Extractors for https://www.weasyl.com/"""
from .common import Extractor, Message
from .. import text
BASE_PATTERN = r"(?:https://)?(?:www\.)?weasyl.com/"
class WeasylExtractor(Extractor):
category = "weasyl"
directory_fmt = ("{category}", "{owner_login}")
filename_fmt = "{submitid} {title}.{extension... |
#!/usr/bin/python3
from ABE_ExpanderPi import IO
import time
import os
"""
================================================
ABElectronics Expander Pi | Digital I/O Interrupts Demo
Version 1.0 Created 21/08/2014
Version 1.1 Updated 11/06/2017 updated to include changes to Expander Pi library
Requires python smbus to ... |
import numpy as np
import numpy.linalg as npl
def mat2tens(cij_mat, compl=False):
"""Convert from Voigt to full tensor notation
Convert from the 6*6 elastic constants matrix to
the 3*3*3*3 tensor representation. Recoded from
the Fortran implementation in DRex. Use the optional
argu... |
import unittest
from itertools import cycle
from mock import mock_open, patch, sentinel
from six.moves import builtins
from sapphire import qsub
@patch.object(qsub.utils, 'which')
class CheckQueueTest(unittest.TestCase):
@patch.object(qsub.subprocess, 'check_output')
def test_queues(self, mock_check_outpu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.