code stringlengths 1 199k |
|---|
from django.conf.urls import patterns # noqa
from django.conf.urls import url # noqa
from openstack_dashboard.dashboards.admin.images import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.images.views',
url(r'^images/$', views.IndexView.as_view(), name='index'),
url(r'^create/$', views.Cre... |
import turtle
kay = turtle.Turtle()
kay.penup()
kay.goto(-125,0)
kay.pendown()
kay.width(5)
kay.color()
kay.color('blue','yellow')
kay.circle(50)
kay.penup()
kay.goto(0,0)
kay.pendown()
kay.color()
kay.color('black','yellow')
kay.circle(50)
kay.penup()
kay.goto(125,0)
kay.pendown()
kay.color()
kay.color('red','yellow')... |
import time
from Facturacion.Objects.Bill import Bill, ItemLine
from Facturacion.Controllers.ControlDB import BillsController
from Facturacion.Collections.Vendors import Vendors
from Facturacion.Collections.Clients import Clients
from Facturacion.Collections.Items import Items
class Bills:
facturas = {}
control... |
import ast
import re
import six
from hacking import core
import pycodestyle
"""
Guidelines for writing new hacking checks
- Use only for Barbican specific tests. OpenStack general tests
should be submitted to the common 'hacking' module.
- Pick numbers in the range B3xx. Find the current test with
the highest a... |
"""
Created on Tue Nov 03 13:06:56 2015
@author: Eunice
"""
if __name__ == '__main__':
import sys
sys.path.append("..")
from engine import bar
from engine.broker.fillstrategy import DefaultStrategy
from engine.broker.backtesting import TradePercentage
from engine import strategy
from engine.technical import... |
"""Tokenization classes."""
from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import logging
import os
import unicodedata
from io import open
from .tokenization_utils import PreTrainedTokenizer
logger = logging.getLogger(__name__)
VOCAB_FILES_NAMES = {'vocab_file': 'v... |
__author__ = 'CGS'
import os, shutil, sys, distutils.core, subprocess
apps_directory = ""
apps = {"variants": "apps/variants"}
PRODUCTION = False
if os.getuid() != 0:
sys.exit("This program requires super user privileges.")
if len(sys.argv) <= 1:
sys.exit("Please, give the name of the app you want to install. C... |
import os
import socket
import threading
import paramiko
from touchdown.tests.fixtures.fixture import Fixture
class DummyServer(paramiko.ServerInterface):
def get_allowed_auths(self, username):
return "publickey,password"
def check_auth_password(self, username, password):
return paramiko.AUTH_SU... |
"""Classes to track metrics about cache line evictions."""
import abc
import numpy as np
from scipy import stats
from cache_replacement.policy_learning.cache_model import utils
class CacheEvictionMetric(abc.ABC):
"""Tracks the value of a metric about predictions on cache lines."""
@abc.abstractmethod
def update(s... |
_base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
type='NASFCOS',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cf... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from models import Project
class ProjectsTest(TestCase):
fixtures = ['test_data.json']
def test_project_listing(self):
"""
Verify that the project listing page contains all p... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.g... |
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
from thrift.transport import TTransport
all_structs = []
class AdjacencyType(object):
CONJUNCTIVE = 0
DISJUNCTI... |
from datetime import datetime
from platformio.commands.device import DeviceMonitorFilter
class Timestamp(DeviceMonitorFilter):
NAME = "time"
def __init__(self, *args, **kwargs):
super(Timestamp, self).__init__(*args, **kwargs)
self._line_started = False
def rx(self, text):
if self._l... |
def donuts(count):
# +++your code here+++
if count < 10:
return "Number of donuts: "+str(count)
else:
return "Number of donuts: many"
def both_ends(s):
# +++your code here+++
if len(s) < 2:
return ""
else:
return s[:2]+s[-2:]
def fix_start(s):
# +++your code here+++
h = s[0]
t = s.repl... |
from iptest.assert_util import *
from iptest.type_util import *
skiptest("win32")
load_iron_python_test()
from IronPythonTest.BinderTest import *
myint1, myint2 = myint(20), myint(-20)
mylong1, mylong2 = mylong(3), mylong(-4)
myfloat1, myfloat2 = myfloat(4.5), myfloat(-4.5)
mycomplex1 ... |
from panda3d.core import *
from panda3d.direct import *
from NametagConstants import *
from Nametag3d import *
from Nametag2d import *
class NametagGroup:
CCNormal = CCNormal
CCNoChat = CCNoChat
CCNonPlayer = CCNonPlayer
CCSuit = CCSuit
CCToonBuilding = CCToonBuilding
CCSuitBuilding = CCSuitBuil... |
"""Generator and discriminator for a progressive GAN model.
See https://arxiv.org/abs/1710.10196 for details about the model.
See https://github.com/tkarras/progressive_growing_of_gans for the original
theano implementation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ impo... |
"""This code example gets all active creative wrappers.
To create creative wrappers, run create_creative_wrappers.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 authentic... |
from google.cloud import aiplatform_v1
def sample_list_annotations():
# Create a client
client = aiplatform_v1.DatasetServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.ListAnnotationsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list... |
import logging
from botocore.exceptions import ClientError
import mock
from c7n.exceptions import PolicyValidationError
from c7n.executor import MainThreadExecutor
from c7n.resources.aws import shape_validate
from c7n.resources.ebs import (
CopyInstanceTags,
EncryptInstanceVolumes,
CopySnapshot,
Delete,... |
import functools
import itertools
import time
import uuid
import eventlet
import greenlet
from oslo.config import cfg
from heat.openstack.common import excutils
from heat.openstack.common.gettextutils import _ # noqa
from heat.openstack.common import importutils
from heat.openstack.common import jsonutils
from heat.op... |
"""
A parsed token that represents a predicate list.
"""
from __future__ import absolute_import
from itertools import count, izip
from amara.xpath import datatypes
from amara.xpath.expressions.basics import literal, variable_reference
from amara.xpath.expressions.booleans import equality_expr, relational_expr
from amar... |
import random
start = 1
end = 6
totalDoubles = 0
rolls = int(input("Enter the number of dice rolls: "))
for num in range(0, rolls, 1):
# Capture the rolls to check for doubles
roll_1 = random.randint(start, end)
roll_2 = random.randint(start, end)
# Check if rolls equal each other, and track the double ... |
import os
import unittest
from __main__ import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
class CreateSamples(ScriptedLoadableModule):
"""Uses ScriptedLoadableModule base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from edctf.api.models import challengeboard, category, challenge
from edctf.api.serializers import challengeboard_serializer, category_serializer, challenge_serializer
class chall... |
def match_ends(words):
# +++your code here+++
count = 0
for word in words:
if len(word) >= 2 and word[0] == word[-1]:
count += 1
return count
def front_x(words):
# +++your code here+++
#for word in words:
# if word[0] == 'x':
# takeOut =
return
def sort_last(tuples):
# +++your code her... |
"""The tests for SleepIQ binary sensor platform."""
import unittest
from unittest.mock import MagicMock
import requests_mock
from homeassistant.setup import setup_component
from homeassistant.components.binary_sensor import sleepiq
from tests.components.test_sleepiq import mock_responses
from tests.common import get_te... |
from __future__ import print_function
from cms.sitemaps import CMSSitemap
from django.conf.urls import * # NOQA
from django.conf.urls.i18n import i18n_patterns
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.conf import settings
from ImmOrbit.api import ... |
import numpy as np
import pytest
import re
from typing import Text, Dict, Any, Callable, List, Optional, Union
from rasa.engine.graph import ExecutionContext
from rasa.engine.storage.storage import ModelStorage
from rasa.engine.storage.resource import Resource
from rasa.nlu.constants import (
DENSE_FEATURIZABLE_ATT... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('todo', '0006_auto_20160530_1210'),
]
operations = [
migrations.AlterField(
model_name='todo',
na... |
from nose.tools import eq_
from pepdata.amino_acid_alphabet import (
canonical_amino_acids,
canonical_amino_acid_letters,
extended_amino_acids,
extended_amino_acid_letters,
)
def test_canonical_amino_acids():
assert len(canonical_amino_acids) == 20
def test_canonical_amino_acids_letters():
asser... |
"""Tests for the Google Analytics cookie event formatters."""
import unittest
from plaso.formatters import ganalytics
from tests.formatters import test_lib
class AnalyticsUtmaCookieFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the UTMA Google Analytics cookie event formatter."""
def testInitializatio... |
"""Tests for TPU outside compilation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tempfile
from absl.testing import parameterized
import numpy as np
from tensorboard.plugins.scalar import summary_v2 as scalar_summary_v2
from tensorflow... |
__author__ = 'litao'
import urllib
import urllib2
import re
import thread
import time
class QSBK:
def __init__(self):
self.pageIndex = 1
self.user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
self.headers = { 'User-Agent' : self.user_agent }
self.stories = []
self... |
"""Contains functions for outputting as l2t_csv.
Author description at: http://code.google.com/p/log2timeline/wiki/l2t_csv
"""
import logging
import re
from plaso.lib import errors
from plaso.lib import eventdata
from plaso.lib import output
from plaso.lib import timelib
from plaso.lib import utils
from plaso.output im... |
from blinker import signal, Namespace, NamedSignal
from yosaipy2.core.event.abcs import EventBus
from typing import Dict
from functools import wraps
class BlinkerEventBus(EventBus):
def __init__(self):
# type: (str) -> None
self.AUTO_TOPIC = "blinker_eventbus_auto_topic"
self._signals = {} ... |
"""This test checks that Optuna is functional.
It also checks that it is usable with a separate scheduler.
"""
import time
import ray
from ray import tune
from ray.tune.suggest import ConcurrencyLimiter
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest.optuna import OptunaSearch
def evaluati... |
'''
SI 618 - HW 4: Map-Reduce Part 2
Uniqname: gracfu
'''
from mrjob.job import MRJob
from mrjob.step import MRStep
import re
WORD_RE = re.compile(r"\b[\w']+\b")
class MRMostUsedWord(MRJob):
def mapper_get_words(self, _, line):
for word in WORD_RE.findall(line):
yield (word.lower(), 1)
def combiner_count_words(s... |
"""do_release.py
Usage:
do_release.py [--force] [CALICO_DOCKER_VERSION CALICO_VERSION LIBCALICO_VERSION LIBNETWORK_VERSION]
Options:
-h --help Show this screen.
"""
import subprocess
import utils
import re
from docopt import docopt
from utils import print_paragraph as para
from utils import print_user_actions a... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
import json
from oslo.config import cfg
from sahara import conductor as c
from sahara import context
from sahara.utils.openstack import keystone
conductor = c.API
CONF = cfg.CONF
def create_trust(cluster):
client = keystone.client()
ctx = context.current()
trustee_id = keystone.client_for_admin().user_id
... |
'''
Created on 2013年7月13日
@author: huiyugeng
'''
import types
import ndb
import regex
'''
载入解析映射
'''
def load_map(map_file):
map_struct = ndb.load(map_file)
map_list = ndb.execute(map_struct, 'select: map')
return map_list
'''
规则匹配及字段映射
'''
def reflect(map_list, line):
value_list = []
map_index = {}... |
import importlib.util
import os
import sys
import types
from functions_framework.exceptions import (
InvalidConfigurationException,
InvalidTargetTypeException,
MissingTargetException,
)
DEFAULT_SOURCE = os.path.realpath("./main.py")
FUNCTION_SIGNATURE_TYPE = "FUNCTION_SIGNATURE_TYPE"
HTTP_SIGNATURE_TYPE = "... |
__author__ = 'fjordonez, gchevalier'
from signal_filtering import filter_opportunity_datasets_accelerometers
import os
import zipfile
import argparse
import numpy as np
import cPickle as cp
from io import BytesIO
from pandas import Series
NB_SENSOR_CHANNELS = 113
NB_SENSOR_CHANNELS_WITH_FILTERING = 149 # =77 gyros +36*... |
import distutils.spawn
import os
import platform
import re
import signal
import tempfile
import time
from . import _common
CLOSE_FDS = True
if platform.system() in ["Linux", "Darwin"]:
TOOL_GDB = distutils.spawn.find_executable('gdb', os.pathsep.join([os.environ['PATH'], _common.PATH_DBG]))
if platform.system()... |
import setuptools
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=1.8'],
pbr=True) |
from traits.api import HasTraits, Str, List, Instance
from traitsui.api import View, UItem, Item, TableEditor
from traitsui.table_column import ObjectColumn
from pychron.core.helpers.traitsui_shortcuts import okcancel_view
from pychron.core.ui.enum_editor import myEnumEditor
class Conflict(HasTraits):
queue_name = ... |
from heat.engine import properties
from heat.engine import constraints
from heat.engine import attributes
from heat.common.i18n import _
from avi.heat.avi_resource import AviResource
from avi.heat.avi_resource import AviNestedResource
from options import *
from common import *
from options import *
from vi_mgr_common i... |
import tangelo
import pymongo
import bson.json_util
from ArborFileManagerAPI import ArborFileManager
api = ArborFileManager()
api.initDatabaseConnection()
@tangelo.restful
def get(*pargs, **query_args):
if len(pargs) == 0:
return tangelo.HTTPStatusCode(400, "Missing resource type")
resource_type = pargs... |
try:
import unittest2 as unittest # Python2.6
except ImportError:
import unittest
from tests.functional import test_base
@unittest.skipIf(test_base.get_test_server_api() == 1,
"The tag API didn't work at v1 - see frontend issue #927")
class TestTags(test_base.TestBase):
testcase_name = "tag... |
import scrapy |
from setuptools import setup, find_packages
setup(name='netdisco',
version='0.9.2',
description='Discover devices on your local network',
url='https://github.com/home-assistant/netdisco',
author='Paulus Schoutsen',
author_email='Paulus@PaulusSchoutsen.nl',
license='Apache License 2.0... |
import wave
import wx
import audiothread
import wavehandle
import sdisp
class MyFrame(wx.Frame):
def __init__(self, parent, title, wavehandle):
wx.Frame.__init__(self, parent, -1, title, size=(1024, 624))
self.wavehandle = wavehandle
self.scale = 8
self.shift = 0
self.drawcnt... |
"""Tests for tensorflow.python.ops.special_math_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import... |
"""Constants for Google Assistant."""
from homeassistant.components import (
binary_sensor,
camera,
climate,
cover,
fan,
group,
input_boolean,
light,
lock,
media_player,
scene,
script,
sensor,
switch,
vacuum,
)
DOMAIN = "google_assistant"
GOOGLE_ASSISTANT_API_... |
import socket, time, fcntl, struct
def udpBeacon():
# Create a UDP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
my_ip = getIP('wlan0')
spliced_subnet = my_ip[:my_i... |
from google.cloud import aiplatform_v1beta1
def sample_suggest_trials():
# Create a client
client = aiplatform_v1beta1.VizierServiceClient()
# Initialize request argument(s)
request = aiplatform_v1beta1.SuggestTrialsRequest(
parent="parent_value",
suggestion_count=1744,
client_id... |
import json
from datetime import datetime
from django.test import TestCase, Client
from authentication.models import Account
from recipies.models import Recipe, RecipeSteps
from recipies.serializers import RecipeSerializer, RecipeStepsSerializer
class Utility(TestCase):
"""Utility class para testing"""
@staticm... |
'''
This script is used to generate a set of random-ish events to
simulate log data from a Juniper Netscreen FW. It was built
around using netcat to feed data into Flume for ingestion
into a Hadoop cluster.
Once you have Flume configured you would use the following
command to populate data:
./gen_events.py 2>&1 | nc 1... |
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import kinow_client
from kinow_client.rest import ApiException
from kinow_clien... |
from collections import OrderedDict
from typing import Dict, Type
from .base import RegionCommitmentsTransport
from .rest import RegionCommitmentsRestTransport
from .rest import RegionCommitmentsRestInterceptor
_transport_registry = OrderedDict() # type: Dict[str, Type[RegionCommitmentsTransport]]
_transport_registry[... |
import unittest
from citest.base import (
ExecutionContext,
JsonSnapshotHelper)
import citest.json_contract as jc
import citest.json_predicate as jp
_called_verifiers = []
_TEST_FOUND_ERROR_COMMENT='Found error.'
class TestObsoleteObservationFailureVerifier(jc.ObservationFailureVerifier):
def __init__(self, title... |
import re
import uuid as py_uuid
from common_fixtures import * # NOQA
from test_volume import VOLUME_CLEANUP_LABEL
TEST_IMAGE = 'ibuildthecloud/helloworld'
TEST_IMAGE_LATEST = TEST_IMAGE + ':latest'
TEST_IMAGE_UUID = 'docker:' + TEST_IMAGE
if_docker = pytest.mark.skipif("os.environ.get('DOCKER_TEST') == 'false'",
... |
import django_filters
from django_filters import rest_framework as filters
from django_rv_apps.apps.believe_his_prophets.models.book import Book
from django_rv_apps.apps.believe_his_prophets.models.bible_read import BibleRead
from django_rv_apps.apps.believe_his_prophets.models.testament import Testament
class BookFilt... |
"""A demo of the Google CloudSpeech recognizer."""
import argparse
import locale
import logging
from aiy.board import Board, Led
from aiy.cloudspeech import CloudSpeechClient
def get_hints(language_code):
if language_code.startswith('en_'):
return ('turn on the light',
'turn off the light',
... |
from google.cloud import dialogflowcx_v3beta1
def sample_delete_experiment():
# Create a client
client = dialogflowcx_v3beta1.ExperimentsClient()
# Initialize request argument(s)
request = dialogflowcx_v3beta1.DeleteExperimentRequest(
name="name_value",
)
# Make the request
client.de... |
import gzip
import os
import fnmatch
import csv
import sys
import getopt
import time
import linecache
import utils
import config
from multiprocessing import Pool, Process
import multiprocessing
from functools import partial
def script_usage():
print 'gentotsv.py -h<help> -t<threads> -s<sourcedir> -d<destinationdir> ... |
import copy
import math
import socket
import time
import uuid
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
import six
from cinder import exception
from cinder.i18n import _, _LE, _LI, _LW
from cinder.openstack.common import loopingcall
from... |
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask import request
from flask impor... |
__author__ = "Ashwin Nanjappa"
import argparse
import collections
import json
import sys
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
class TextToTreeItem:
def __init__(self):
self.text_list = []
self.titem_list = []
def append(self, text_list, titem):
for... |
"""The tests for the Script component."""
import asyncio
from contextlib import contextmanager
from datetime import timedelta
import logging
from unittest import mock
import pytest
import voluptuous as vol
from homeassistant import exceptions
import homeassistant.components.scene as scene
from homeassistant.const impor... |
"""Simple generator and discriminator models.
Based on the convolutional and "deconvolutional" models presented in
"Unsupervised Representation Learning with Deep Convolutional Generative
Adversarial Networks" by A. Radford et. al.
"""
from __future__ import absolute_import
from __future__ import division
from __future... |
"""Models for TranspileConfig and its related components."""
from qiskit.transpiler.models import TranspileConfigSchema
from qiskit.validation import BaseModel, bind_schema
@bind_schema(TranspileConfigSchema)
class TranspileConfig(BaseModel):
"""Model for TranspileConfig.
Please note that this class only descri... |
import cPickle
import gzip
import numpy
import os
import sys
import theano
from theano.tensor.shared_randomstreams import RandomStreams
import time
from io_func.model_io import _nnet2file, _file2nnet, _cfg2file, log
from learning.sgd import train_sgd_verbose, validate_by_minibatch_verbose
from models.cnn_sat import CNN... |
import time
import json
import os
from datetime import datetime
from .world import world, logged_wait, res_filename
from nose.tools import eq_, assert_less
from bigml.api import HTTP_CREATED
from bigml.api import HTTP_ACCEPTED
from bigml.api import FINISHED
from bigml.api import FAULTY
from bigml.api import get_status
... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0072_product_order_index'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='order_index',
),
] |
cevag "Uryyb TvgUho!".rapbqr("rot13") |
"""Configure Watchmaker documentation."""
from __future__ import (absolute_import, division, print_function,
unicode_literals, with_statement)
import os
import sys
sys.path.insert(0, os.path.abspath('../src/'))
rtd = os.environ.get('READTHEDOCS', None) == 'True'
extensions = [
'myst_parser',... |
import sys
import warnings
from django.db.models.fields import FieldDoesNotExist
from django.utils.text import capfirst
from django.utils.encoding import smart_text
try:
from django.db.models.options import get_verbose_name
except ImportError:
from django.utils.text import camel_case_to_spaces as get_verbose_na... |
from typing import Any, Dict, List, Optional, Set
from annotypes import add_call_types, stringify_error
from cothread import cothread
from p4p import Value
from p4p.server import DynamicProvider, Server, ServerOperation
from p4p.server.cothread import Handler, SharedPV
from malcolm.core import (
APublished,
Blo... |
import json
import os
import subprocess
import requests
HEAT_PARAMS_PATH = '/etc/sysconfig/heat-params'
PUBLIC_IP_URL = 'http://169.254.169.254/latest/meta-data/public-ipv4'
CERT_DIR = '/etc/docker'
CERT_CONF_DIR = '%s/conf' % CERT_DIR
CA_CERT_PATH = '%s/ca.crt' % CERT_DIR
SERVER_CONF_PATH = '%s/server.conf' % CERT_CON... |
"""NCF framework to train and evaluate the NeuMF model.
The NeuMF model assembles both MF and MLP models under the NCF framework. Check
`neumf_model.py` for more details about the models.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import ... |
import pathlib
import sys
import attr
import pytest
import salt.channel.server
import salt.ext.tornado.gen
import salt.transport.ipc
import salt.utils.platform
from salt.ext.tornado import locks
pytestmark = [
# Windows does not support POSIX IPC
pytest.mark.skip_on_windows,
pytest.mark.skipif(
sys.... |
"""Deletes a global load balancer rule."""
from baseCmd import *
from baseResponse import *
class deleteGlobalLoadBalancerRuleCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""the ID of the global load balancer rule"""
"""Required"""
self.id = None
... |
class DNSDriver(object):
"""Defines the DNS manager interface. Does nothing. """
def __init__(self):
pass
def get_domains(self):
raise NotImplementedError()
def create_entry(self, _name, _address, _type, _domain):
raise NotImplementedError()
def delete_entry(self, _name, _do... |
"""
This module is a special module to define functions or other resources
which need to be imported outside of openstack_dashboard.api.nova
(like cinder.py) to avoid cyclic imports.
"""
from django.conf import settings
from glanceclient import exc as glance_exceptions
from novaclient import api_versions
from novaclien... |
from django.core.management.base import BaseCommand
from django.utils.timezone import now
from ...models import BlogEntry, RelatedBlog, Feed
from ...parser import get_all_entries, update_blog_supernav
class Command(BaseCommand):
""" Update blog entries and related blog feed data """
def handle(self, **options):... |
import logging
import random
import string
import sys
from oslo.config import cfg
logger = logging.getLogger(__name__)
stdout = logging.StreamHandler(sys.stdout)
stdout.setLevel(logging.DEBUG)
logger.addHandler(stdout)
logger.setLevel(logging.DEBUG)
default_opts = [
cfg.StrOpt('working_dir',
default=... |
"""
Volume driver for NetApp NFS storage.
"""
import os
import uuid
from oslo_utils import units
import six
from cinder import exception
from cinder.i18n import _, _LE, _LI, _LW
from cinder.image import image_utils
from cinder.openstack.common import log as logging
from cinder import utils
from cinder.volume.drivers.ne... |
from kafka.tools import log
from kafka.tools.assigner.actions import ActionModule
from kafka.tools.exceptions import ConfigurationException
class ActionClone(ActionModule):
name = "clone"
helpstr = "Copy partitions from some brokers to a new broker (increasing RF)"
def __init__(self, args, cluster):
... |
import xbmcgui
import urllib
def download(url, dest, dp = None):
if not dp:
dp = xbmcgui.DialogProgress()
dp.create("XBMCHUB...","Downloading & Copying File",' ', ' ')
dp.update(0)
urllib.urlretrieve(url,dest,lambda nb, bs, fs, url=url: _pbhook(nb,bs,fs,url,dp))
def _pbhook(numblocks, blocks... |
import os
import sys
import logging
import datetime
from future.utils import iteritems
from pandaharvester.harvesterconfig import harvester_config
try:
os.remove(harvester_config.db.database_filename)
except Exception:
pass
from pandaharvester.harvestercore.db_proxy_pool import DBProxyPool as DBProxy
from panda... |
"""Base class for implementing API proxy stubs."""
import logging
import random
import threading
from google.appengine.api import apiproxy_rpc
from google.appengine.api import request_info
from google.appengine.runtime import apiproxy_errors
MAX_REQUEST_SIZE = 1 << 20
REQ_SIZE_EXCEEDS_LIMIT_MSG_TEMPLATE = ('The request... |
"""The StarLine component."""
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from .account import StarlineAccount
from .const import (
DOMAIN,
PLATFORMS,
SERVICE_UPDAT... |
from models import Host
from models import InventoryJob
from models import InventoryJobHistory
from constants import JobStatus
from handlers.loader import get_inventory_handler_class
from context import InventoryContext
from utils import create_log_directory
from multi_process import WorkUnit
import traceback
import sy... |
'''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.functions
... |
import sys
import logging
logger = logging.getLogger(__name__)
def configure_logging():
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(name)12s %(levelname)7s - %(messag... |
"""Module for testing the update network command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestUpdateNetwork(TestBrokerCommand):
def test_100_update(self):
command = ["update", "network", "--network", "excx-net",... |
import alembic
from oslo_serialization import jsonutils
import sqlalchemy as sa
from nailgun.db import db
from nailgun.db import dropdb
from nailgun.db.migration import ALEMBIC_CONFIG
from nailgun.db.migration import make_alembic_config_from_extension
from nailgun.extensions.consts import extensions_migration_buffer_ta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.