content stringlengths 4 20k |
|---|
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(co... |
"""
Support for Flux lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.flux_led/
"""
import logging
import socket
import random
import voluptuous as vol
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PROTOCOL
from homeassistan... |
import os
from pathlib import Path
from superdesk.default_settings import INSTALLED_APPS, strtobool
def env(variable, fallback_value=None):
env_value = os.environ.get(variable, '')
if len(env_value) == 0:
return fallback_value
else:
if env_value == "__EMPTY__":
return ''
... |
#!/usr/bin/env python
import re
import sys
import os
import webbrowser
import json
def generate(data, generated_path):
path = os.path.dirname(__file__)
template_path = os.path.join(path, 'replay.html.template')
template = open(template_path, 'r')
content = template.read()
template.close()
pat... |
# -*- 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 field 'Form.is_primary'
db.add_column(u'forms_form', 'is_primary... |
"""
.. _WTForms: http://wtforms.simplecodes.com/
A simple wrapper for WTForms_.
Basically we only need to map the request handler's `arguments` to the
`wtforms.form.Form` input. Quick example::
from wtforms import TextField, validators
from tornadotools.forms import Form
class SampleForm(Form):
... |
import mock
from murano.dsl import murano_method
from murano.dsl import murano_type
from oslo_config import cfg
from murano.engine.system import net_explorer
from murano.tests.unit import base
CONF = cfg.CONF
class TestNetExplorer(base.MuranoTestCase):
def setUp(self):
super(TestNetExplorer, self).set... |
"""Utilitis for copying dependent files for Windows build."""
__author__ = "yukawa"
import datetime
import logging
import optparse
import os
import shutil
from util import PrintErrorAndExit
def ParseOption():
"""Parse command line options."""
parser = optparse.OptionParser()
MSG = ' you can use %s as path sep... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class AwsTestCase(IntegrationTe... |
import random
from constants import *
from player import *
from tile import *
class Tiles(object):
EmptyTileSegment = ' '
def __init__(self):
self.tiles = []
self._generate_tiles()
def _generate_tiles(self):
""" randomly generates tiles to begin play. Runs at init """
if len(self.ti... |
# -*- coding: utf-8 -*-
from ..logger import logger
logger.debug("Started 'reading process/measure.py'")
import os
import numpy as np
import pyqtgraph as pg
from qtpy import QtWidgets, QtCore, QtGui
from .. import global_vars as g
from ..utils.BaseProcess import BaseProcess
from ..utils.misc import save_file_gui
from ... |
import numbers
from django.core.exceptions import ObjectDoesNotExist
from lxml import etree
def add_value_list(data_list, value=None):
if value:
data_list.append(value)
def add_dict(data_dict=dict, field=None, value=None):
if value and field and isinstance(field, str):
data_dict[field] = va... |
# $HeadURL$
__RCSID__ = "$Id$"
import types
from DIRAC.ConfigurationSystem.Client.Config import gConfig
from DIRAC.FrameworkSystem.Client.Logger import gLogger
from DIRAC.Core.Security import CS
from DIRAC.Core.Security import Properties
from DIRAC.Core.Utilities import List
class AuthManager:
"""
Handle Servic... |
"""utils: utility functions to manipulate host, interfaces, ..."""
import collections
import os
from mininet.link import Intf
from mininet.log import lg as log
from mininet.node import Node
from ipaddress import ip_address, IPv4Address, IPv6Address
from typing import Type, Dict, Optional, Union, Tuple, List, TYPE_CH... |
#!/usr/bin/env python3
import argparse, os
from genompy.cn import *
pr = argparse.ArgumentParser(description='Annotate sgementation file with genes')
pr.add_argument('input', help='input regions file')
pr.add_argument('output', help='output genes file')
pr.add_argument('-d', '--delimiter', help='delimiting charact... |
#Dataset : /opt/datasets/ml-100k
PATH = "/opt/datasets/ml-100k/u.data"
rating_data_raw = sc.textFile(PATH)
prin... |
import time
import numpy as np
from equipment.custom import mmwave_source
from equipment.hittite import signal_generator
from equipment.srs import lockin
from kid_readout.interactive import *
from kid_readout.equipment import hardware
from kid_readout.measurement import mmw_source_sweep, core, acquire
logger.setLeve... |
import sys
import numpy as np
import cv2
video_file = sys.argv[1]
cap = cv2.VideoCapture(video_file)
# take first frame of the video
ret,frame = cap.read()
# setup initial location of window
# r,h,c,w - region of image simply hardcoded the values
r,h,c,w = 300,50,300,50
track_window = (c,r,w,h)
# set up the ROI f... |
#!/usr/bin/env python3
"""
wardrobe_1.py
This program uses a Clothing class to keep track of my wardrobe.
@author Tset Noitamotua
@version 2017-05-03
"""
class Clothing(object):
"""
The Clothing class defines a piece of clothing in terms of
its name its cleanliness.
"""
# constructor - instance va... |
from DistributedMinigameAI import *
from direct.fsm import ClassicFSM, State
from direct.fsm import State
import PatternGameGlobals
from direct.task.Task import Task
import MazeGameGlobals
import MazeData
class DistributedMazeGameAI(DistributedMinigameAI):
def __init__(self, air, minigameId):
try:
... |
#!/usr/bin/python3
#coding=utf-8
'''
python script for ROUGE-1.5.5
不同于之前的指定要待测list和reflist的list,
这里我们只能指定两个目录地址,待测的所有sum和对应的所有ref
利用topic来寻找指定的evalID,Peer,models
'''
import os
import re
import pickle
# input :
# all summarization's path.
# all the referance summarization's path
# output :
... |
"""
Management of data retrieval and structure.
"""
import pandas as pd
import xarray as xr
import os
from numpy import atleast_1d
from tempfile import mkstemp, mkdtemp
from shutil import rmtree
from functools import wraps
from dask import delayed, compute
from dask.utils import SerializableLock
from dask.diagnostics ... |
class CONST(object) :
URI_LOGIN = 'https://www.google.com/accounts/ClientLogin'
URI_PREFIXE_READER = 'http://www.google.com/reader/'
URI_PREFIXE_ATOM = URI_PREFIXE_READER + 'atom/'
URI_PREFIXE_API = URI_PREFIXE_READER + 'api/0/'
URI_PREFIXE_VIEW = URI_PREFIXE_READER + 'view/'
ATOM_GET_FE... |
from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from fortuitus.feditor.forms import TestCaseForm
from fortuitus.feditor.models import TestProject, TestCase, TestCaseStep, TestCaseAssert
from fortuitus.feditor.m... |
from __future__ import print_function
import FreeCAD
from FreeCAD import Units
import Path
import argparse
import datetime
import shlex
from PathScripts import PostUtils
TOOLTIP = '''
This is a postprocessor file for the Path workbench. It is used to
take a pseudo-gcode fragment outputted by a Path object, and output
... |
from tempest.lib.services.identity.v3 import groups_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestGroupsClient(base.BaseServiceTest):
FAKE_CREATE_GROUP = {
'group': {
'description': 'Tempest Group Description',
'domain... |
# $HeadURL$
__RCSID__ = "$Id$"
import time
import types
import thread
import DIRAC
from DIRAC.Core.DISET.private.Protocols import gProtocolDict
from DIRAC.FrameworkSystem.Client.Logger import gLogger
from DIRAC.Core.Utilities import List, Network
from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR
from DIRAC.C... |
import time
import fixtures
from keystoneclient.auth.identity import v3 as identity_v3
from keystoneclient import session
from neutronclient.neutron import client as neutron_client
from novaclient import client as nova_client
from novaclient import exceptions as nova_exc
from oslo_utils import uuidutils
from saharacli... |
#!/usr/bin/env python
import optparse
import numpy as np
import scipy.signal
import scipy.fftpack as fft
import gnsstools.galileo.e5bq as e5bq
import gnsstools.nco as nco
import gnsstools.io as io
import gnsstools.util as util
#
# Acquisition search
#
def search(x,prn,doppler_search,ms):
fs = 3*10230000.0
n = ... |
import os
import mimetypes
try:
from io import StringIO
except ImportError:
from io import StringIO # noqa
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
from d... |
"""
Course discovery page.
"""
from bok_choy.page_object import PageObject
from common.test.acceptance.pages.lms import BASE_URL
class CourseDiscoveryPage(PageObject):
"""
Find courses page (main page of the LMS).
"""
url = BASE_URL + "/courses"
form = "#discovery-form"
def is_browser_on_... |
# USAGE:
# from distance_functions import *
# PREAMBLE:
import numpy as np
sqrt = np.sqrt
sums = np.sum
square = np.square
zeros = np.zeros
# SUBROUTINES:
def RMSD(x,y,n):
""" Calculates the Root Mean Squared Distance between two arrays of the same size
Usage: rmsd = RMSD(x,y,n)
Arguments:
x, y: numpy arrays... |
from __future__ import with_statement
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import subprocess
import tempfile
from .libtoolimporter import LibtoolImporter
from .message import Position
from .ccompi... |
# coding: utf-8
"""
MIT License
Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49)
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 restriction, including without limit... |
import pytest
from odinweb import utils
class TestToken(object):
@pytest.mark.parametrize('depth, expected_length', (
(8, 2),
(16, 4),
(24, 5),
(32, 7),
(48, 10),
(64, 13),
(128, 26),
(256, 52),
))
def test_bit_length(self, depth, expected_l... |
# -*- coding: utf-8 -*-
'''
Simple RPC
Copyright (c) 2012-2013, LastSeal S.A.
'''
from simplerpc.base.SimpleRpcLogicBase import SimpleRpcLogicBase
from simplerpc.expose_api.javascript.ClassToJs import ClassToJs
from simplerpc.expose_api.javascript.data_model import AutoTemplateAstNode
from simplerpc.context.SimpleRpcCo... |
from twisted.internet import reactor, protocol
# a client protocol
class EchoClient(protocol.Protocol):
"""Once connected, send a message, then print the result."""
def connectionMade(self):
self.transport.write("hello, world!")
def dataReceived(self, data):
"As soon as any data... |
import os
import re
import sublime
import sublime_plugin
SYNTAX = {'behave': 'Packages/MyPyTest/MyPyTest.hidden-tmLanguage'}
SCHEME = {'light': 'Packages/MyPyTest/MyPyTest.hidden-tmTheme',
'dark': 'Packages/MyPyTest/MyPyTestDark.hidden-tmTheme'}
TEST_FUNC_RE = re.compile(r'(\s*)def\s+(test_\w+)\s?\(')
TEST_... |
from __future__ import unicode_literals
import os
import subprocess
import sys
import time
from .common import AudioConversionError, PostProcessor
from ..compat import (
compat_subprocess_get_DEVNULL,
)
from ..utils import (
encodeArgument,
encodeFilename,
get_exe_version,
is_outdated_version,
... |
from app import db
class JobDetails(db.Model):
__tablename__ = 'job_details'
id = db.Column(db.Integer, primary_key=True)
job_details_type = db.Column(db.String(32))
job_details_status = db.Column(db.String(32))
job_details_location = db.Column(db.String(64))
job_details_description_of_loss =... |
#!/usr/bin/python2.7
import struct
import time
import sys
import zmq
class CommandHandler(object):
def __init__(self, sock, argv):
self.socket_ = sock
self.argv_ = argv
self.argv_offset = 4
def handle_command(self, cmd):
cmd = cmd.lower()
if cmd == "module_list":
... |
import client
import server
import messages
import urlparse as _urlparse
from messages import Exec, Exec_rv
# Connection = client.Connection
default_port = 8089 # PY
class PythonShareError(Exception):
pass
class AuthenticationError(PythonShareError):
pass
class RemoteExecError(PythonShareError):
pass
... |
import gettext
import gnome
import gobject
import gtk
import gtk.glade
import locale
import os
import pygtk
import re
import sys
import time
import traceback
import pdk_utils
import SDK
_ = gettext.lgettext
class packageGroup(object):
def __init__(self, sdk, target):
self.sdk = sdk
self.target =... |
import itertools
import logging
from cliff import command
from cliff import show
from designateclient.v2.cli import common
LOG = logging.getLogger(__name__)
DNS_QUOTAS = {
"api_export_size": "api-export-size",
"recordset_records": "recordset-records",
"zone_records": "zone-records",
"zone_recordset... |
#!/usr/bin/env python
"""py.test fixtures to be used in netmiko test suite."""
from os import path
import os
import pytest
from netmiko import ConnectHandler, FileTransfer, InLineTransfer, SSHDetect
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
def pytest_addoption(parser):
"""... |
'''
*** SHED SKIN Python-to-C++ Compiler ***
Copyright 2005-2013 Mark Dufour; License GNU GPL version 3 (See LICENSE)
'''
import logging
import sys
import infer
ERRORS = set()
def error(msg, gx, node=None, warning=False, mv=None):
if warning:
kind = logging.WARNING
else:
kind = logging.ERR... |
from ingest.grib_source import GribError
from ingest.grib_reanalysis import GribReanalysis
from datetime import datetime, timedelta
import pytz
import logging
import os.path as osp
from utils import Dict, timedelta_hours, readhead
class NARR(GribReanalysis):
"""
The NARR (North American Regional Reanalysis) g... |
from atlas import *
from physics import *
#
# class Heaping(server.Task):
# """ A task for laying down built up terrain with a digging implement."""
#
# class Obstructed(Exception):
# "An exception indicating this task is obstructed by an entity>"
# pass
#
# def heap_operation(self, op):
# ... |
from time import time
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic import LineReceiver
import click
import json
class SyncplayClientProtocol(LineReceiver):
def __init__(self, factory):
self.factory = factory
def connectionLost(self, reason):
click.echo('Con... |
#!/usr/bin/python
import paho.mqtt.client as paho
import psutil
import pywapi
import signal
import sys
import time
from threading import Thread
def functionApiWeather():
data = pywapi.get_weather_from_weather_com('MXJO0042','metric')
message = data['location']['name']
message = message + ", Temperature "... |
"""The tests for the Recorder component."""
import unittest
from datetime import datetime
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
import homeassistant.core as ha
from homeassistant.const import EVENT_STATE_CHANGED
from homeassistant.util import dt
from homeassistan... |
import re
import sys
class EgColorizer():
def __init__(self, color_config):
self.color_config = color_config
def colorize_heading(self, text):
return self._color_helper(
text,
'(^#+)(.*)$',
(
self.color_config.pound +
r'\1' ... |
from __future__ import absolute_import
from datetime import datetime
from .base import QueueInterface
try:
from Queue import PriorityQueue, Empty
except ImportError:
from queue import PriorityQueue, Empty
class QueueBackend(QueueInterface):
def __init__(self, spider_name, **kwargs):
super(QueueInt... |
__author__ = 'thorwhalen'
"""
Includes various adwords elements diagnosis functions
"""
#from ut.util.var import my_to_list as to_list, my_to_list
from numpy.lib import arraysetops
from numpy import array
from numpy import argmax
import pandas as pd
from ut.util.ulist import ascertain_list
import ut.util.var as util_v... |
from behave import *
from flask import json
@when("I request {url:S}")
def step_impl(context, url):
context.rv = context.request(url)
@when("I request {url:S} via {method}")
def step_impl(context, url, method):
context.rv = context.request(url, method)
@when("I {method} following data to {url}")
def step_... |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config import BrainFileConfiguration
class BasicTestClient(TestClient):
def __init__(self):
TestClient.__init__(self, debug=True)
def load_configuration(self, arguments):
super(BasicTestClient, self).load_co... |
"""Benchmark complex."""
from __future__ import print_function
import timeit
NAME = "complex"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: t... |
from operator import itemgetter
# - an individual node contains the word associated with the node along with
# pointers to its kids and parents.
class node:
def __init__(self, word):
if word != None:
self.word = word
self.kids = []
self.parent = []
self.fi... |
class Routine(object):
"""
A step is a way to chain multiple routines together.
"""
def start(self):
a = False
while not a:
print "entering " + str(task)
self.doStep()
a = raw_input("Pausing. Check that results are satisfactory for you.")
def doT... |
"""
lastchange.py -- Chromium revision fetching utility.
"""
from __future__ import print_function
import argparse
import collections
import datetime
import logging
import os
import subprocess
import sys
VersionInfo = collections.namedtuple("VersionInfo",
("revision_id", "revision... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Faraday Penetration Test IDE - Community Version
Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
See the file 'doc/LICENSE' for the license information
'''
from plugins import core
from model import api
import re
import os, socket
import pprint
current_... |
# -*- coding: utf-8 -*-
from odoo import http
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.http import request
class WebsiteSale(WebsiteSale):
@http.route(['/shop/pricelist'])
def pricelist(self, promo, **post):
order = request.website.sale_get_order()
coupon_st... |
"""Test deCONZ component setup process."""
import asyncio
from copy import deepcopy
from asynctest import patch
from homeassistant.components import deconz
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
ENTRY1_HOST = "1.2.3.4"
ENTRY1_PORT = 80
ENTRY1_API_KEY = "1234567890ABCDEF"
ENTRY1_BRIDG... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test the ability to create more than rpm file with different package root
from one SCons environment.
"""
import os
import SCons.Tool.rpmutils
import TestSCons
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
scons = test.program
rpm = te... |
import logging
import sys
import unittest
import numpy
import numpy.testing as nptst
import sppy
class utilTest(unittest.TestCase):
def setUp(self):
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
def testDiag(self):
a = numpy.array([1, 2, 3])
X = sppy.... |
from pylons import tmpl_context as c
from alluratest.controller import setup_basic_test, setup_global_objects
from allura import model as M
from allura.lib import security
from allura.tests import decorators as td
def setUp():
setup_basic_test()
setup_global_objects()
@td.with_discussion
def test_role_assi... |
"""Remote service handling base classes and helpers."""
import logging
from urllib.parse import quote
from django.conf import settings
from django.urls import reverse
from urllib.parse import urlencode, urlparse, urljoin, parse_qs, urlunparse
from geonode import geoserver
from geonode.utils import check_ogc_backend... |
import numpy
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import argument
from chainer.utils import type_check
class Gaussian(function_node.FunctionNode):
"""Gaussian sampling function.
.. note::
In forward calculat... |
from cloudify import ctx
from cloudify.decorators import operation
from .. import constants
from .. import utils
from ..gcp import (
check_response,
GoogleCloudPlatform,
)
class DNSZone(GoogleCloudPlatform):
def __init__(self,
config,
logger,
name,
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
#
##################################################
######## Please Don't Remove Author Name #########
############### Thanks ###########################
##################################################
#
#
# Written By:
# S.S.B
# <EMAIL>
# bitforestinfo... |
class Entity(object):
"""Base entity class.
Basically various attributes and utility methods.
"""
def __init__(self, parent, id):
"""Replace attributes, name and callbacks with ones needed after creation."""
self.attributes = {
'fixed' : 0,
'blocking' ... |
import re
import json
import sys
from os import listdir, getcwd
from os.path import dirname, join, exists
from tempfile import mkdtemp
from fabric.api import run, env, cd, quiet, lcd, local
from fabric.contrib.project import rsync_project
from scrapy_dockerhub.pprint_table import pprint_table
env.project_path = joi... |
from spack import *
class Mpt(Package):
"""HPE MPI is HPE's implementation of
the Message Passing Interface (MPI) standard.
Note: HPE MPI is proprietry software. Spack will search your
current directory for the download file. Alternatively, add this file to a
mirror so that Spack can find it. For... |
from opus_core.variables.lag_variable import LagVariable
class VVV_lagLLL(LagVariable):
"""A built-in class used to implement lag variables.
Returns a set of rows with the same set of ids as exist in the current
year's dataset for this variable. Rows with ids that existed in the prior
year but n... |
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation, sessionmaker, relationship
from sqlalchemy import ForeignKey
from sqlalchemy import Enum
from db import Base, Session
from enums import SkillsEnum
class EventSkills(Base):
__tablename__ = 'eventSkills... |
"""
Functionality for display and saving images of collections of images patches.
"""
import numpy as np
from pylearn2.datasets.dense_design_matrix import DefaultViewConverter
from pylearn2.utils.image import Image, ensure_Image
from pylearn2.utils.image import show
from pylearn2.utils import py_integer_types
import wa... |
#!/usr/bin/python
#coding:utf-8
import mybaselib
import myequation
import logging
import os.path
import sys
import numpy as np
import multiprocessing
import gen_entity_cluster as mygen_entity_cluster
import jieba
reload(sys)
sys.setdefaultencoding('utf8')
program = os.path.basename(sys.argv[0])
logger = logging.getLo... |
"""Config Flow for Hive."""
from apyhiveapi import Auth
from apyhiveapi.helper.hive_exceptions import (
HiveApiError,
HiveInvalid2FACode,
HiveInvalidPassword,
HiveInvalidUsername,
)
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_SC... |
"""
utility functions for breaking down a given block of text
into it's component syntactic parts.
"""
import nltk
from nltk.tokenize import RegexpTokenizer
import syllables_en
TOKENIZER = RegexpTokenizer('(?u)\W+|\$[\d\.]+|\S+')
SPECIAL_CHARS = ['.', ',', '!', '?']
def get_char_count(words):
characters = 0
... |
from __future__ import absolute_import
import errno
import warnings
import hmac
from binascii import hexlify, unhexlify
from hashlib import md5, sha1, sha256
from ..exceptions import SSLError, InsecurePlatformWarning
SSLContext = None
HAS_SNI = False
create_default_context = None
# Maps the length of a digest to a... |
import warnings
import json
import re
from datetime import datetime, timedelta
from jira import JIRA
from jira.exceptions import JIRAError
from dateutil import parser
from libraries import prettify
from helpers import helper
class JiraLogger:
def __init__(self):
warnings.filterwarnings('ignore') # SNIMiss... |
import jenkinsapi
from jenkinsapi.jenkins import Jenkins
import time
import datetime
import socket
PATTERN_DONE = 3 # Spin
PATTERN_RUN = 1 # Pulse
PATTERN_PROGRESS = 2 # Progress
COLOR_GOOD = 0x00FF00
COLOR_BAD = 0xFF0000
passing = True
curRed = 0x00
curGreen = 0x00
curBlue = 0x00
curPattern = 0x03
curP... |
import os
from ironic_lib import utils as ironic_utils
import jinja2
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import fileutils
from ironic.common import dhcp_factory
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import utils
from ironic.... |
import random
import sys
from datetime import datetime
from dolfin import *
from dolfin_adjoint import *
from math import sqrt
dolfin.parameters["adjoint"]["fussy_replay"] = False
# Class representing the intial conditions
class InitialConditions(Expression):
def __init__(self):
random.seed(2 + MPI.proce... |
#!/usr/bin/env python
# cardinal_pythonlib/tools/pdf_to_booklet.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (<EMAIL>).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 ... |
"""Tests for quality_of_service_specs table."""
import time
from cinder import context
from cinder import db
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume import volume_types
LOG = logging.getLogger(__name__)
def fake_qos_specs_get_by_n... |
from __future__ import unicode_literals
import logging
import sickbeard
from sickbeard import db, helpers
from adba.aniDBerrors import AniDBCommandTimeoutError
class BlackAndWhiteList(object):
blacklist = []
whitelist = []
def __init__(self, show_id):
if not show_id:
raise BlackWhit... |
import binascii
from datetime import datetime
from ctypes import c_uint
import argparse
def date_to_seed(date, seed):
dx = (date.day-1) // 10
data = "{}.{}.{}.{:08x}".format(
dx if dx <= 2 else 2,
date.strftime("%b").lower(),
date.year,
seed)
crc = c_uint(... |
import unittest
from streamlink.plugins.kanal7 import Kanal7
class TestPluginKanal7(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
'http://www.kanal7.com/canli-izle',
'https://www.tvt.tv.tr/canli-yayin',
]
for url in should_match:
s... |
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
vies_passed = fields.Boolean(string="VIES validation", readonly=True)
@api.model
def simple_vat_check(self, country_code, vat_number):
res = super(ResPartner, self).simple_vat_check(country_code, va... |
import unittest
import random
import IECore
class testBinaryFrameList( unittest.TestCase ) :
def test( self ) :
r = IECore.BinaryFrameList( IECore.FrameRange( 1, 5) )
self.assertEqual( r.asList(), [ 1, 5, 3, 2, 4 ] )
r = IECore.BinaryFrameList( IECore.FrameRange( 1, 3) )
self.assertEqual( r.asList(), [ 1, ... |
"""
This module contains the classes and utility functions for distance and
cartesian coordinates.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from .. import units as u
__all__ = ['Distance']
__doctest_requires__ = {'*': ['scip... |
from django.test import TestCase
from django.contrib.auth.models import User
import mock
from projects.models import (
ProjectBuild, ProjectDependency, ProjectBuildDependency)
from projects.helpers import (
build_project, build_dependency, archive_projectbuild,
get_transport_for_projectbuild)
from .factori... |
class_str = 'class'
types = ["BOOL", "CHAR", "INT8", "UINT8", "INT16", "UINT16", "INT32", "UINT32",
"INT64", "UINT64", "FLOAT32", "FLOAT64", "FLOATMAX", "COMPLEX128"]
config_tests = ["HAVE_HDF5", "HAVE_JSON", "HAVE_XML", "HAVE_LAPACK",
"USE_CPLEX", "USE_SVMLIGHT", "USE_GLPK", "USE_LZO", "USE_GZ... |
import time, os
delay = 0.25
print "Getting list of all projects"
v = os.listdir('/projects')
print "Got %s projects" % len(v)
for project_id in sorted(v):
c = "bup_storage.py chown %s" % project_id
print c
os.system(c)
time.sleep(delay) |
#!/usr/bin/env python
"""A client for a MidasYeller."""
import socket
from socket import error
from midassocket import *
class MidasListener(MidasSocket_) :
"""The MidasListener listens to a single MidasYeller. If we
are not actively trying to receive data, it may be lost as the
MidasYeller sends UDP pa... |
"""
Description here
"""
import unittest
import madsenlab.axelrod.analysis as stats
import madsenlab.axelrod.utils as utils
import networkx as nx
import logging as log
import os
import tempfile
import re
class NautyTest(unittest.TestCase):
filename = "test"
def setUp(self):
self.tf = tempfile.Name... |
from glob import glob
from ovirt.node.utils import Transaction
from pipes import quote
import logging
import os
import subprocess
import tempfile
logger = logging.getLogger(__name__)
class Network:
def __init__(self):
self.WORKDIR = tempfile.mkdtemp()
self.IFSCRIPTS_PATH = "/etc/sysconfig/network-... |
from m5.SimObject import SimObject
class MemObject(SimObject):
type = 'MemObject'
abstract = True |
#! /usr/bin/env python
'''
Copyright (C) 2012 Diego Torres Milano
Created on Feb 3, 2012
This example starts the TemperatureConverter activity then type '123' into the 'Celsius' field.
Then a ViewClient is created to obtain the view dump and the current values of the views with
id/celsius and id/fahrenheit are obtain... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.