code stringlengths 1 199k |
|---|
from dateutil.relativedelta import *
from datetime import datetime, date
from openerp.osv import fields, osv
from openerp.tools.translate import _
import logging
_logger = logging.getLogger(__name__)
class doctor_attentions_diseases(osv.osv):
_name = "doctor.attentions.diseases"
_inherit = 'doctor.attentions.di... |
import ConfigParser
import os
import re
from itertools import product
import LineRegress
import ResultScraper
def readconfig(filename):
## SETS DEFaULTS
#all defaults must be in a list even if only one value
speciesFile = ""
outFolder = ""
lineRegressConfig = ""
lambdas = [1.0]
startPopulati... |
"""
Views to support exchange of authentication credentials.
The following are currently implemented:
1. AccessTokenExchangeView:
3rd party (social-auth) OAuth 2.0 access token -> 1st party (open-edx) OAuth 2.0 access token
2. LoginWithAccessTokenView:
1st party (open-edx) OAuth 2.0 access token -... |
from datetime import datetime
import time
from osv import fields, osv
from tools.translate import _
from tools import ustr
class gap_analysis_effort(osv.Model):
_name = "gap_analysis.effort"
_description = "Gap Analysis Efforts"
_columns = {
'name': fields.char('Effort', size=4, required=True,),... |
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
sp_description = fields.Char(
related="company_id.sp_description",
string="Description for period end statements",
readonly=False,
) |
{
"name": "Account Invoice Margin Sale Delivered Sync",
"summary": "Sync invoice margin between invoices and sale orders",
"version": "12.0.1.0.1",
"development_status": "Beta",
"maintainers": ["sergio-teruel"],
"category": "Account",
"website": "https://github.com/OCA/margin-analysis",
... |
import factory.fuzzy
from base.tests.factories.learning_unit_year import LearningUnitYearFactory
from base.tests.factories.tutor import TutorFactory
from learning_unit.tests.factories.learning_class_year import LearningClassYearFactory
class ScoreResponsibleFactory(factory.DjangoModelFactory):
class Meta:
m... |
"""
Provides crossplatform checking of current power source, battery warning level and battery time remaining estimate.
Allows you to add observer for power notifications if platform supports it.
Usage:
from power import PowerManagement, PowerManagementObserver # Automatically imports platform-specific implementati... |
from openerp.osv import fields,osv
from openerp.addons.at_base import util
class official_holiday_template_wizard(osv.osv_memory):
def do_create(self, cr, uid, ids, context=None):
holiday_obj = self.pool.get("official.holiday")
template_obj = self.pool.get("official.holiday.template")
user_o... |
"""
Interactive wizard to guide user to set up EFB and modules.
Since newer version of pip (>=9.0), which checks Python version
prior to installation, is already widespread, we are dropping
Python version check in wizard script, and assuming user is
running an appropriate Python version.
"""
import argparse
import gett... |
import inspect
import os
import sys
from datetime import timedelta
from io import StringIO
from unittest.mock import Mock
from urllib.error import HTTPError
import django
import django.db
import django.test.runner
import django.test.testcases
import django.test.utils
from django.test import TestCase
from aid.test.data ... |
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
import os
register = template.Library()
@register.filter(name='basename')
@stringfilter
def basename(value):
return os.path.basename(value)
@register.filter(name='replace_macros')
@stringfilter
def r... |
"""Remove any personally identifying information from the database"""
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django_openid_auth.models import UserOpenID
from rest_framework.authtoken.models import Token
from reversion.mo... |
from distutils.core import setup
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name="wrtfreezer",
version="0.1",
description="A simple utility to mass build OpenWRT images.",
author="Shuhao Wu",
license="AGPL",
url="https://github.com/shuhaowu/wrtfreezer",
packages=["wr... |
"""
Some unit tests for BufferedPipe.
"""
import threading
import time
import unittest
from paramiko.buffered_pipe import BufferedPipe, PipeTimeout
from paramiko import pipe
from util import ParamikoTest
def delay_thread(pipe):
pipe.feed('a')
time.sleep(0.5)
pipe.feed('b')
pipe.close()
def close_thread(... |
"""
A collection of utilities that can also be used from outside, if wanted. Functions and
classes here can be assumed public and won’t disappear in future Py-notify versions.
@var is_callable:
Determine if C{object} is callable. E.g. if it is a function, method, class, instance of
a class with C{__call__}, etc. Thi... |
import pycurl
import unittest
import sys
try:
import urllib.parse as urllib_parse
except ImportError:
import urllib as urllib_parse
from . import appmanager
from . import util
setup_module, teardown_module = appmanager.setup(('app', 8380))
class ResetTest(unittest.TestCase):
def test_reset(self):
c ... |
"""
Copyright 2012-2013 YouView TV Ltd.
2014-2017 stb-tester.com Ltd.
License: LGPL v2.1 or (at your option) any later version (see
https://github.com/stb-tester/stb-tester/blob/master/LICENSE for details).
"""
import argparse
import sys
import _stbt.core
from _stbt import imgproc_cache
from _stbt.logging imp... |
import sys, os
BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
sys.path.insert(0, os.path.join(BASE, "lib", "python"))
import gettext;
gettext.install("emc2", localedir=os.path.join(BASE, "share", "locale"), unicode=True)
import Image, numarray
import numarray.ieeespecial as ieee
from rs274.aut... |
from spack import *
class A(AutotoolsPackage):
"""Simple package with one optional dependency"""
homepage = "http://www.example.com"
url = "http://www.example.com/a-1.0.tar.gz"
version('1.0', '0123456789abcdef0123456789abcdef')
version('2.0', '2.0_a_hash')
variant(
'foo',
va... |
from commis import Command
from commis import color
from feet.entities.extractor import Extractor
from feet.entities.registry import Registry
class ExtractCommand(Command):
name = 'extract'
help = 'extract a list of entities from text'
args = {
'--text': {
'metavar': 'TEXT',
... |
"""
Sample for python PCSC wrapper module: send a Control Code to a card or
reader
__author__ = "Ludovic Rousseau"
Copyright 2007-2010 Ludovic Rousseau
Author: Ludovic Rousseau, mailto:ludovic.rousseau@free.fr
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the ter... |
from spack import *
class RLimma(RPackage):
"""Data analysis, linear models and differential expression
for microarray data."""
homepage = "https://www.bioconductor.org/packages/limma/"
url = "https://www.bioconductor.org/packages/release/bioc/src/contrib/limma_3.32.6.tar.gz"
list_url = homepag... |
from __future__ import unicode_literals
import unittest
import slopos
class TestTagger(unittest.TestCase):
def setUp(self):
slopos.load_from_path("slopos/sl-tagger.pickle")
def testSentenceTagging(self):
tagged = slopos.tag("To je test.")
self.assertEqual(tagged, [('To', 'ZK-SEI'), ('je'... |
import os
import sys
import argparse
import datetime
import time
import gettext
from pseudo_cluster.task import Task_record
from pseudo_cluster.tasks_list import Tasks_list
from pseudo_cluster.extended_task import Extended_task_record
from pseudo_cluster.actions_list import Action_list
def get_submit_string(self,time... |
__version__ = (0, 31)
__version_extra__ = ''
__version_string__ = '.'.join(map(str, __version__)) + __version_extra__
__all__ = [
'X',
'XK',
'Xatom',
'Xcursorfont',
'Xutil',
'display',
'error',
'rdb',
# Explicitly exclude threaded, so that it isn't imported by
# from Xlib import... |
from scrapy.spiders import Spider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from scrapy.conf import settings
from beerindex.items import BeerindexItem
import logging
import lxml.html
from urlparse import urlparse
import re
class BeerSpider(Spider):
name = "beerspider"
beer_si... |
import define
import tw8836
import spi
def quad_check():
status = spi.status1_read()
if (status & 0x40):
print 'SPI flash is already in QUAD mode'
return define.TRUE
else:
print 'SPI flash is not in QUAD mode yet'
return define.FALSE
def quad_enable():
status = spi.status... |
from .ao_integrals import AOIntegrals, ao2mo
from .mo_integrals import FCIDUMP
from .mo_integrals import load as load_fcidump
from .fcidump_generator import generate_fcidump |
import time
import requests
from collectors.lib import utils
from collectors.lib.collectorbase import CollectorBase
REST_API = {"YARN_APPS_PATH": "ws/v1/cluster/apps",
"MAPREDUCE_JOBS_PATH": "ws/v1/mapreduce/jobs"}
JOB = ['elapsedTime', 'mapsTotal', 'mapsCompleted', 'reducesTotal', 'reducesCompleted', 'maps... |
from __future__ import print_function
import cx_Oracle
import db_config
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()
print("Inserting data...")
cur.execute("truncate table testclobs")
longString = ""
for i in range(5):
char = chr(ord('A') + i)
longString += char * 250
... |
from osp.conf.settings import *
SECRET_KEY = 'Chac-8#haCa_Ra-e?-e+ucrur=gEFRasejayasaC?meMe!AC-a'
DEBUG = False
ADMINS = (
('John Smith', 'john.smith@example.edu'),
('Francis Drake', 'francis.drake@example.edu'),
)
MANAGERS = ADMINS
DEBUG_USERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.d... |
"""This is the Cloud Signature Bot based on Time4Mind and Telegram
It allow to sign documents using a Telegram chat and a Time4Mind account
"""
import sys
import os
import yaml
import logging
import time
import datetime
import uuid
import urllib.request
import shutil
import re
import magic
import json
from threading im... |
from __future__ import unicode_literals
import sys
from PyQt4.uic import loadUiType
from pyqtgraph.Qt import QtCore, QtGui
from matplotlib import pyplot as plt
import numpy as np
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
import... |
import os
import sys
from rbnics.utils.config import Config
def test_config(tempdir):
# Create a default configuration
config = Config()
# Write config to stdout
print("===============")
config.write(sys.stdout)
print("===============")
# Change options
config.set("backends", "online bac... |
print '''<!DOCTYPE html><html>'''
incluir(data,"head")
print '''<body>'''
incluir(data,"header")
print '''</body></html>''' |
import argparse
from getpass import getpass
import json
import sys
import textwrap
import zmq
import colorama
from colorama import Fore
def execute(code):
ctx = zmq.Context.instance()
ctx.setsockopt(zmq.LINGER, 50)
repl_in = ctx.socket(zmq.PUSH)
repl_in.connect('tcp://127.0.0.1:2000')
repl_out = ctx... |
import gaugette.platform
import gaugette.gpio
import gaugette.spi
import gaugette.font5x8
import time
import sys
class SSD1306:
# Class constants are externally accessible as gaugette.ssd1306.SSD1306.CONST
# or my_instance.CONST
EXTERNAL_VCC = 0x1
SWITCH_CAP_VCC = 0x2
SET_LOW_COLUMN = 0x00
... |
from django import template
from kilonull.models import Menu, MenuItem
from kilonull.settings import SETTINGS
import re
register = template.Library()
@register.simple_tag
def blog_title():
return SETTINGS['BLOG_TITLE']
@register.simple_tag
def get_menu(menu_slug, curr_page):
html = ""
menu_items = MenuItem.... |
import logging
import odoo
from odoo.tools.func import lazy_property
from .sessionstore import PostgresSessionStore
_logger = logging.getLogger(__name__)
class RootTkobr(odoo.http.Root):
@lazy_property
def session_store(self):
# Setup http sessions
_logger.debug('HTTP sessions stored in Postgres... |
"""Counter.py
Part of the AQuA Cesium Controller software package
author=Martin Lichtman
created=2013-10-19
modified>=2015-05-11
This file holds everything to model a National Instruments DAQmx counter.
It communicated to LabView via the higher up LabView(Instrument) class.
Saving of returned data is handled in the Lab... |
"""
Module defining DataID as enumeration, e.g. concentration, velocity.
class Enum allows accessing members by .name and .value
FunctionID is deprecated and will be removed
"""
from enum import IntEnum, auto
DataSchema = {
"type": "object",
"properties": {
"Type": {"type": "string"}, # Automatically g... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'core.views.empresta_list_view', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
) |
"""
This is a Class which allows one to manipulate a git repository.
"""
import os
import tempfile
import subuserlib.subprocessExtras as subprocessExtras
from subuserlib.classes.fileStructure import FileStructure
class GitRepository():
def __init__(self,path):
self.__path = path
def getPath(self):
return se... |
"""
Cairo test suite.
"""
import imp
import os
import cairosvg
reference_cairosvg = imp.load_source(
'cairosvg_reference', pathname=os.path.join(
os.path.dirname(__file__), 'cairosvg_reference', 'cairosvg',
'__init__.py'))
cairosvg.features.LOCALE = reference_cairosvg.features.LOCALE = 'en_US'
TEST_... |
'''
This file contains all the functions that constitute the "frontend of the backend",
i.e. native Python plotting functions. All actual plots are generated by plotting.py --
this is purely about displaying them. manualfit() and geogui() rely on PyQt4, which
is likely to fail, so it's sequestered.
Version: 2019aug06
'... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'data_monging', # Or path to da... |
"""The function module of dolfin"""
from dolfin.functions import multimeshfunction
from dolfin.functions import functionspace
from dolfin.functions import function
from dolfin.functions import constant
from dolfin.functions import expression
from dolfin.functions import specialfunctions
from .multimeshfunction import *... |
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {"profile_set": None, "material": None}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
profiles = list(self.settings["profile_set"].MaterialProfile... |
import coeffstore
import expressions
import caching
import libadjoint
from dolfin_adjoint import backend
if backend.__name__ == "dolfin":
import lusolver
adjointer = libadjoint.Adjointer()
mem_checkpoints = set()
disk_checkpoints = set()
adj_variables = coeffstore.CoeffStore()
def adj_start_timestep(time=0.0):
... |
import unittest
from Tribler.community.market.core.ttl import Ttl
class TtlTestSuite(unittest.TestCase):
"""Ttl test cases."""
def setUp(self):
# Object creation
self.ttl = Ttl(0)
self.ttl2 = Ttl(2)
self.ttl3 = Ttl(2)
self.ttl4 = Ttl(1)
def test_init(self):
# ... |
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 'Photo'
db.create_table(u'accounts_photo', (
(u'id', self.gf('django.db.m... |
import pygame
import random
import item
import mob
import tile
class Mapgen(object):
def __init__(self, level):
self.xsiz = 10
self.ysiz = 10
self.biome = "random"
self.procedure = 0
self.zone = []
self.level = level
self.sizefactor = 2
#self.items = p... |
import time
import os
import sys
import pickle
a=sys.argv[1]
q=open('facultysubject.txt','r')
w=open('facultydept.txt','r')
e=open('facultyprojects.txt','r')
dic1={}
dic2={}
dic3={}
dic1=pickle.load(q)
dic2=pickle.load(w)
dic3=pickle.load(e)
print 'NAME OF FACULTY: '+a+'\n'
print 'DETAILS AVAILABLE:- '+'\n'
print ' *... |
import re
class Solution(object):
def decodeString(self, s):
"""
:type s: str
:rtype: str
"""
# Original idea by @StefanPochmann
r = re.compile(r"(\d+)\[([^\d\[\]]*)\]")
while r.search(s):
s = r.sub(lambda m: int(m.group(1)) * m.group(2), s)
... |
import unittest
import sys
class Bear:
""" Bear representation """
def __init__(self, test_inputs=None):
""" Default constructor """
it = iter(test_inputs.split("\n")) if test_inputs else None
def uinput():
return next(it) if it else sys.stdin.readline().rstrip()
# Re... |
from django import forms
from .models import Topic, Entry
class TopicForm(forms.ModelForm):
class Meta:
model = Topic
fields = ['text']
labels = {'text': ''}
class EntryForm(forms.ModelForm):
class Meta:
model = Entry
fields = ['text']
labels = {'text': ''}
... |
from datetime import timedelta, datetime
from airflow import DAG
from airflow.contrib.operators.bigquery_operator import BigQueryOperator
from airflow.contrib.operators.bigquery_to_gcs import BigQueryToCloudStorageOperator
from airflow.contrib.operators.gcs_to_bq import GoogleCloudStorageToBigQueryOperator
from dags.su... |
DOCUMENTATION = """
---
module: eos_vlan
short_description: Manage VLAN resources in EOS
description:
- The eos_vlan module manages VLAN configurations on Arista EOS nodes.
version_added: 1.0.0
category: Bridging
author: Arista EOS+
requirements:
- Arista EOS 4.13.7M or later with command API enabled
- Python Cli... |
"""
Visualizers for feature analysis and diagnostics.
"""
from .pcoords import ParallelCoordinates, parallel_coordinates
from .radviz import RadialVisualizer, RadViz, radviz
from .rankd import Rank1D, rank1d, Rank2D, rank2d
from .jointplot import JointPlot, JointPlotVisualizer, joint_plot
from .pca import PCADecomposit... |
from django.test import TransactionTestCase
from myuw.models import VisitedLinkNew, CustomLink, PopularLink, User
from myuw.test import get_request_with_user
from myuw.dao.user import get_user_model
from myuw.dao.affiliation import get_all_affiliations
from myuw.dao.quicklinks import get_quicklink_data, get_link_label,... |
import tempfile
import synapse.common as s_common
import synapse.lib.msgpack as s_msgpack
_readsz = 10000000
def splice(act, **info):
'''
Form a splice event from a given act name and info.
Args:
act (str): The name of the action.
**info: Additional information about the event.
Exampl... |
"""The test for the bayesian sensor platform."""
import json
import unittest
from homeassistant.components.bayesian import binary_sensor as bayesian
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN
fr... |
from synapse.tests.common import *
import synapse.lib.trees as s_trees
class TreeTest(SynTest):
def test_lib_tree_interval(self):
ivals = (
((-30, 50), {'name': 'foo'}),
((30, 100), {'name': 'bar'}),
((80, 100), {'name': 'baz'}),
)
itree = s_trees.Interval... |
import sys
from neural_net import train, test,\
make_neural_net_basic,\
make_neural_net_two_layer,\
make_neural_net_challenging,\
make_neural_net_with_weights
from neural_net_data import simple_data_sets,\
harder_data_sets,\
challenging_data_sets,\
manual_weight_data_sets,\
all_d... |
import json
import optparse
import os
import polib
import re
import string
import sys
parser = optparse.OptionParser(usage="usage: %prog [options] pofile...")
parser.add_option("--callback", default="_.setTranslation", dest="callback", help="callback function to call with data")
parser.add_option("--quiet", action="sto... |
import datetime
from ...place import Place
from ...spec import Spec
from .planet import Planet
from .dwarfplanet import DwarfPlanet
class System(Place):
"""Systems exist within galaxies, and can contain planets...
Attributes
allowedChildEntities Entity spec types that can be created from this context
spec ... |
"""
Instances of :py:class:`~.TwinMainModule` define how ``__main__`` is
bootstrapped in twinterpreters. A
:py:class:`~cpy2py.twinterpeter.twin_master.TwinMaster` without
a :py:class:`~.TwinMainModule` defaults to :py:data:`DEFAULT_DEF`.
Bootstrap the ``__main__`` module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The ``__main__... |
from __future__ import unicode_literals
import json
import xmltodict
from jinja2 import Template
from six import iteritems
from moto.core.responses import BaseResponse
from .models import redshift_backends
def convert_json_error_to_xml(json_error):
error = json.loads(json_error)
code = error["Error"]["Code"]
... |
from tensorflow.core.framework import node_def_pb2
from tensorflow.python.framework import tensor_util
from intel_quantization.quantize_graph.quantize_graph_base import QuantizeNodeBase
from intel_quantization.quantize_graph.quantize_graph_common import QuantizeGraphHelper as helper
class FuseNodeStartWithPad(QuantizeN... |
import argparse
import irc.client
import logging
import random
import string
import ssl
import sys
import time
import yaml
logging.basicConfig(level=logging.INFO)
class CheckAccess(irc.client.SimpleIRCClient):
log = logging.getLogger("checkaccess")
def __init__(self, channels, nick, flags):
irc.client.S... |
"""
Volume manager manages creating, attaching, detaching, and persistent storage.
Persistent storage volumes keep their state independent of instances. You can
attach to an instance, terminate the instance, spawn a new instance (even
one from a different image) and re-attach the volume with the same data
intact.
**Re... |
__author__ = 'frank'
import os
import os.path
import pprint
import re
import traceback
import urllib2
import zstacklib.utils.daemon as daemon
import zstacklib.utils.http as http
import zstacklib.utils.jsonobject as jsonobject
from zstacklib.utils import lock
from zstacklib.utils import linux
from zstacklib.utils import... |
import pecan
from oslo_log import log as logging
from designate import utils
from designate.api.v2.controllers import rest
from designate.objects import TsigKey
from designate.objects.adapters import DesignateAdapter
LOG = logging.getLogger(__name__)
class TsigKeysController(rest.RestController):
SORT_KEYS = ['crea... |
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from fixture.session import SessionHelper
from fixture.mk import M... |
<<<<<<< HEAD
'''
Given a rectangular matrix of characters, add a border of asterisks(*) to it.
For
picture = ["abc",
"ded"]
the output should be
addBorder(picture) = ["*****",
"*abc*",
"*ded*",
"*****"]
'''
=======
"""
Given a rectangular matr... |
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.layer import layer_util
class DilatedTensor(object):
"""
This context manager makes a wrapper of input_tensor
When created, the input_tensor is dilated,
the input_tensor resumes to original space when exiting th... |
CATEGORY10 = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b',
'#e377c2', '#7f7f7f', '#bcbd22', '#17becf']
CATEGORY20 = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a',
'#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94',
'#e377c2... |
import shutil
import numpy as np
import dill
import gzip
import os
import subprocess
import struct
from array import array
import warnings
from dps import cfg
from dps.utils import image_to_string, cd, resize_image
emnist_url = 'http://www.itl.nist.gov/iaui/vip/cs_links/EMNIST/gzip.zip'
template = 'emnist-byclass-{}-{}... |
"""
pygments.lexers.jvm
~~~~~~~~~~~~~~~~~~~
Pygments lexers for JVM languages.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
this, combined, defaul... |
import sys
from unittest import mock
from neutronclient.neutron.v2_0.lb import healthmonitor
from neutronclient.tests.unit import test_cli20
class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
def test_create_healthmonitor_with_mandatory_params(self):
# lb-healthmonitor-create with mandatory par... |
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import datetime # for checking renewal date range
class RenewBookForm(forms.Form):
renewal_date = forms.DateField(help_text="Enter a date between now and 4 weeks (default 3). ")
def c... |
from pyramid.view import view_config
from twonicornweb.views import (
site_layout,
get_user,
)
@view_config(context=Exception, renderer='twonicornweb:templates/exception.pt')
def error(exc, request):
request.response.status_int = 500
page_title = 'Internal Server Error'
user = get_user(request)
... |
"""Tool to gauge message passing throughput and latencies"""
import logging
import optparse
import time
import uuid
import pyngus
from proton import Message
from utils import connect_socket
from utils import get_host_port
from utils import process_connection
LOG = logging.getLogger()
LOG.addHandler(logging.StreamHandle... |
import logging
import pytest
import sdk_cmd
import sdk_install
import sdk_plan
import sdk_security
import sdk_utils
from tests import config
from tests import test_utils
LOG = logging.getLogger(__name__)
@pytest.fixture(scope="module", autouse=True)
def zookeeper_server(configure_security):
service_options = {
... |
"""Implements additional custom Pylint checkers to be used as part of
presubmit checks. Next message id would be C0029.
"""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
import linecache
import os
import re
im... |
NWA_DEVICE_GDV = "GeneralDev"
NWA_DEVICE_TFW = "TenantFW"
NWA_AGENT_TOPIC = 'nwa_agent'
NWA_AGENT_TYPE = 'NEC NWA Agent'
NWA_FIREWALL_PLUGIN = 'NECNWAFWaaS'
NWA_GREENPOOL_ADD_SIZE = 32 |
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', 'flag=ceph'],
[TestAction.create_volume, 'volume1', 'flag=ceph,scsi'],
[TestAction.attach_volume, 'vm1'... |
"""
JsonCli: Library for CLI based on JSON
--------------------------------------
+------------------------+-------------+
| This is the JsonCli common library. |
+------------------------+-------------+
"""
import argparse
from collections import OrderedDict
from argcomplete import autocomplete
from botocore import x... |
class Hayvan:
def __init__(self,isim, renk):
self.isim=isim
self.renk=renk
def yuru(self):
print(self.isim+" yurumeye basladi")
def ye(self):
print(self.isim+" yemeye basladi")
class Fare(Hayvan):
def __init__(self,isim,renk):
super().__init__(isim,renk)
def y... |
from openstackclient.common import clientmanager
from openstackclient.tests import utils
class Container(object):
attr = clientmanager.ClientCache(lambda x: object())
def __init__(self):
pass
class TestClientManager(utils.TestCase):
def setUp(self):
super(TestClientManager, self).setUp()
... |
from . import statuscodes
from .exceptions import *
from . import basedatamodel |
from ggrc import db
from .mixins import Mapping
class SectionObjective(Mapping, db.Model):
__tablename__ = 'section_objectives'
@staticmethod
def _extra_table_args(cls):
return (
db.UniqueConstraint('section_id', 'objective_id'),
db.Index('ix_section_id', 'section_id'),
db.Index('ix_ob... |
import threading
import time
class timer(threading.Thread): #The timer class is derived from the class threading.Thread
def __init__(self, num, interval):
threading.Thread.__init__(self)
self.thread_num = num
self.interval = interval
self.thread_stop = False
def run(self): #Overw... |
from __future__ import unicode_literals
from .request import Request
from .response import Response
from .stat import Stat
from .primitives import Bool, UString, Vector
class GetChildrenRequest(Request):
"""
"""
opcode = 8
parts = (
("path", UString),
("watch", Bool),
)
class GetChil... |
from setuptools import setup
setup(name='scalegrease',
version='1',
url='https://github.com/spotify/scalegrease',
description='A tool chain for executing batch processing jobs',
packages=['scalegrease'],
data_files=[('/etc', ['conf/scalegrease.json'])],
scripts=[
'bin/greas... |
from moto.core.responses import BaseResponse
class ReservedInstances(BaseResponse):
def cancel_reserved_instances_listing(self):
if self.is_not_dryrun("CancelReservedInstances"):
raise NotImplementedError(
"ReservedInstances.cancel_reserved_instances_listing is not yet implemente... |
class Notification(object):
"""Notification class."""
DEVICE_ID_KEY = 'deviceId'
ID_KEY = 'id'
NOTIFICATION_KEY = 'notification'
PARAMETERS_KEY = 'parameters'
TIMESTAMP_KEY = 'timestamp'
def __init__(self, notification):
self._device_id = notification[self.DEVICE_ID_KEY]
self... |
import os
import re
import unittest
from collections import OrderedDict
from unittest.mock import patch
import pytest
from airflow.exceptions import AirflowException
from airflow.providers.apache.hive.operators.hive_stats import HiveStatsCollectionOperator
from tests.providers.apache.hive import DEFAULT_DATE, DEFAULT_D... |
import argparse
import json
import os
from ironicclient import client
from subprocess import check_output
from credential_helper import CredentialHelper
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--power", required=True, default=None,
choices=["on", "off", "reset... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.