code stringlengths 1 199k |
|---|
import setuptools
import os
import inspect
def readme():
with open("README.rst") as f:
return f.read()
def version():
with open("VERSION") as f:
return f.read().strip()
commands = ["logic/subuser","logic/execute-json-from-fifo"]
setuptools.setup(
name="subuser",
version=version(),
description="subuser... |
"""
The I{2nd generation} service proxy provides access to web services.
See I{README.txt}
"""
import suds
import suds.metrics as metrics
from http.cookiejar import CookieJar
from suds import *
from suds.reader import DefinitionsReader
from suds.transport import TransportError, Request
from suds.transport.https import ... |
import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {"material_list": None, "material": None}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
materials = list(self.settings["materi... |
import theano
from theano import tensor as T
import theano.tensor
import numpy as np
x = T.fmatrix('x')
v = T.fmatrix('v')
y = T.transpose(x) + v
update_weight_theano = theano.function(inputs=[x, v],
outputs=[y])
def update_weight_np(x, v):
# return np.sum(x, axis=0) + v
#... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from farxiv.forms import *
import json
@login_required
def farticle_builder_view(request):
if request.method == 'POST':
title = request.POS... |
import enum
class H264SubMe(enum.Enum):
FULLPEL = 'FULLPEL'
SAD = 'SAD'
SATD = 'SATD'
QPEL3 = 'QPEL3'
QPEL4 = 'QPEL4'
QPEL5 = 'QPEL5'
RD_IP = 'RD_IP'
RD_ALL = 'RD_ALL'
RD_REF_IP = 'RD_REF_IP'
RD_REF_ALL = 'RD_REF_ALL' |
import sys
def caesar(code, shift):
mapping = {
n: start + (n - start + shift) % 26
for start, n in zip(
[65] * 26 + [97] * 26, list(range(65, 91)) + list(range(97, 123))
)
}
return code.translate(mapping)
if __name__ == "__main__":
with open("/usr/share/dict/words") ... |
print("Hello World")
if 1 == 1 :
print (" Hi Sandy") |
class Game():
def roll(self, pins):
pass
def score(self):
return -1 |
import json
import random
import time
import os
from core import pinBot
bot = pinBot()
bot_dir = os.path.dirname(__file__)
with open(os.path.join(bot_dir,'pinterestBot.json')) as json_data:
bot_config = json.load(json_data)
with open(os.path.join(bot_dir,'done_pins.json')) as json_data:
done_pins = json.load(js... |
__author__ = 'christianbuia'
import random
from Crypto.Cipher import AES
import base64
import sys
def pkcs7_padding(message_bytes, block_size):
pad_length = block_size - (len(message_bytes) % block_size)
if pad_length != block_size:
for i in range(0, pad_length):
message_bytes += bytes([pad_... |
from gi.repository import Gtk
import time
class TreeviewColumn(object):
def __init__(self, column_name, ordernum, hidden=True, fixed_size=False):
self.column_name=column_name
self.ordernum=ordernum
self.hidden=hidden
self.fixed_size=fixed_size
def add_column_to_treeview(columnname,co... |
import logging
import os
sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
sh.setFormatter(logging.Formatter("%(levelname)s\t%(filename)s\t%(message)s"))
logger = logging.getLogger()
logger.addHandler(sh)
logger.setLevel(logging.DEBUG)
_FILE_NAME = "windninja.log"
PRETTY_PRINT_JOB = False
def enable_file(folder, ... |
def correctScholarships(bestStudents, scholarships, allStudents):
return set(bestStudents) <= set(scholarships) < set(allStudents) |
import os
import pip
from pip.req import parse_requirements
from setuptools import setup, find_packages
requirements = [str(requirement.req) for requirement in parse_requirements('requirements.txt', session=pip.download.PipSession())]
setup(
name='project_generator',
version='0.6.0-alpha',
description='Proj... |
import datetime
import subprocess
import mock
import unittest
import rev2
from api.models import HouseCode
class Base(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
class BackgroundPollerTest(Base):
# @mock.patch('subprocess.Popen')
# def test_start_is_successful(self... |
import logging
from flask import jsonify, request, redirect, send_file
import flask_login
from mediacloud.error import MCException
import tempfile
import json
import os
import csv
import io
import zipfile
from server import app, auth, mc, user_db
from server.auth import user_mediacloud_client, user_name, user_is_admin
... |
import datetime
import json
import pkg_resources as pkg
import sys
import time
import mock
from oslo_config import cfg
from oslo_log import log as logging
from oslotest import base
import testtools.matchers as ttm
from mistral import context as auth_context
from mistral.db.sqlalchemy import base as db_sa_base
from mist... |
from neutron_lib.utils import runtime
from oslo_config import cfg
from oslo_log import log as logging
from oslo_upgradecheck import upgradecheck
CHECKS_ENTRYPOINTS = 'neutron.status.upgrade.checks'
LOG = logging.getLogger(__name__)
def load_checks():
checks = []
ns_plugin = runtime.NamespacedPlugins(CHECKS_ENTR... |
import logging
import concurrent
import time
from bokeh.io import curdoc
from bokeh.layouts import column, row
from bokeh.models import Select, Paragraph
import modules.air
import modules.temperature
import modules.population
import modules.precipitation
from states import NAMES
logging.getLogger('googleapiclient.disco... |
import reversion
from django.contrib.admin import ModelAdmin, register
from django.db import models
from django_handleref.admin import VersionAdmin
from tests.models import HandleRefModel, Org
@reversion.register
class VersionedOrg(HandleRefModel):
name = models.CharField(max_length=255, unique=True)
website = ... |
class Solution:
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
carry = 0
resultHead = c = ListNode(0)
while l1 or l2 or carry > 0:
num1 = l1.val if l1 else 0
num2 = l2.val if l2 e... |
import people.people_class as p
from inventory.inventory_list import inventory_list
from weapons.weapon_list import weapon_list
person = p.people()
person.name = 'skellington_1'
person.health = 2
person.descript = 'This is a spooky scary skellington'
person.weapon = weapon_list['sword']
person.armor = 0
person.hostile ... |
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 dev_tools import incremental_coverage
def test_determine_ignored_lines():
f = incremental_coverage.determine_ignored_lines
assert f("a = 0 # coverage: ignore") == {1}
assert (
f(
"""
a = 0 # coverage: ignore
b = 0
"""
)
== {2}
)
assert (... |
from cdn.storage import base
class ServicesController(base.ServicesBase):
def list(self):
services = {
"links": [
{
"rel": "next",
"href": "/v1.0/services?marker=www.myothersite.com&limit=20"
}
... |
"""Random agent for running against DM Lab2D environments."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import numpy as np
import pygame
import dmlab2d
from dmlab2d import runfiles_helper
def _make_int32_distribution(random, ... |
from collections import OrderedDict
from distutils import util
import os
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from google.api_core import client_options as client_options_lib # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_co... |
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_co... |
"""
Downloads and extracts an archive based on a provided manifest.
"""
from __future__ import print_function
import locale
import os
import signal
import sys
import threading
import time
import json
import tempfile
import tarfile
import hashlib
from etaprogress.progress import ProgressBarWget
import requests
def error... |
from eight_mile.calibration.plot.confidence_histogram import confidence_histogram
from eight_mile.calibration.plot.reliability_diagram import reliability_diagram, reliability_curve |
"""The artifacts filter file CLI arguments helper."""
from __future__ import unicode_literals
import os
from plaso.cli import tools
from plaso.cli.helpers import interface
from plaso.cli.helpers import manager
from plaso.lib import errors
class ArtifactFiltersArgumentsHelper(interface.ArgumentsHelper):
"""Artifacts f... |
from dulwich.object_store import (
MemoryObjectStore,
)
from dulwich.objects import (
Blob,
)
from dulwich.tests import TestCase
from dulwich.tests.utils import (
make_object,
make_tag,
build_commit_graph,
)
class MissingObjectFinderTest(TestCase):
def setUp(self):
super(MissingObjectFin... |
import os
import sys
from setuptools import setup, find_packages
sys.path.insert(0, 'src')
import blockdiag
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",... |
from __future__ import absolute_import
from google.cloud.aiplatform.utils.enhanced_library import value_converter
from proto.marshal import Marshal
from proto.marshal.rules.struct import ValueRule
from google.protobuf.struct_pb2 import Value
class ConversionValueRule(ValueRule):
def to_python(self, value, *, absent... |
"""VTA specific buildin for runtime."""
from __future__ import absolute_import as _abs
import tvm
from . import ir_pass
from .environment import get_env
def lift_coproc_scope(x):
"""Lift coprocessings cope to the """
x = ir_pass.lift_alloc_to_scope_begin(x)
x = tvm.ir_pass.LiftAttrScope(x, "coproc_scope", F... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.solar_collectors import SolarCollectorPerformanceFlatPlate
log = logging.getLogger(__name__)
class TestSolarCollectorPerformanceFlatPlate(unittest.TestCase):
def setUp(self):
... |
from solution import Solution
input = 1534236469
sol = Solution()
result = sol.reverse(input)
print(result) |
import logging
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db import models
from django.db.models import Case, Q, Sum, Value, When
from django.urls import reverse_lazy
from django.views.generic import CreateView, DeleteView, DetailView, ListView, UpdateView
from zentral.contrib.osquery.fo... |
import unittest
import hoverpy.tests
import doctest
def runTests():
"Run all of the tests when run as a module with -m."
suite = hoverpy.tests.get_suite()
runner = unittest.TextTestRunner()
runner.run(suite)
def runDocTests():
finder = doctest.DocTestFinder(exclude_empty=False)
suite = doctest.D... |
"""
Setup script for pywbemtools project.
"""
import os
import io
import re
import setuptools
def get_version(version_file):
"""
Execute the specified version file and return the value of the __version__
global variable that is set in the version file.
Note: Make sure the version file does not depend on... |
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import importutils
from cinder import exception
from cinder.i18n import _
from cinder import utils as cinder_utils
from cinder.volume.drivers.dell_emc.vnx import common
from cinder.volume.drivers.dell_emc.vnx import const
from cinder.vo... |
"""empty message
Revision ID: b347b202819b
Revises: ('33d996bcc382', '65903709c321')
Create Date: 2016-09-19 17:22:40.138601
"""
revision = 'b347b202819b'
down_revision = ('33d996bcc382', '65903709c321')
def upgrade():
pass
def downgrade():
pass |
import datetime as date
from com.hhj.pystock.snakecoin.block import Block
def create_genesis_block():
# Manually construct a block with
# index zero and arbitrary previous hash
return Block(0, date.datetime.now(), "Genesis Block", "0")
def next_block(last_block):
this_index = last_block.index + 1
th... |
""" Data objects in group "Humidifiers and Dehumidifiers"
"""
from collections import OrderedDict
import logging
from pyidf.helper import DataObject
logger = logging.getLogger("pyidf")
logger.addHandler(logging.NullHandler())
class HumidifierSteamElectric(DataObject):
""" Corresponds to IDD object `Humidifier:Steam... |
from babel.dates import format_date, format_datetime, format_time, format_interval, LC_TIME
class Time(object):
FULL = 'full'
LONG = 'long'
MEDIUM = 'medium'
SHORT = 'short'
def __init__(self, locale=None, time_zone=None):
"""
Constructor
:param locale: The locale to use... |
"""Tests for projectq.meta._dirtyqubit.py"""
from projectq.meta import ComputeTag, _dirtyqubit
def test_dirty_qubit_tag():
tag0 = _dirtyqubit.DirtyQubitTag()
tag1 = _dirtyqubit.DirtyQubitTag()
tag2 = ComputeTag()
assert tag0 == tag1
assert not tag0 != tag1
assert not tag0 == tag2 |
from mlflow.tracking.request_header.abstract_request_header_provider import RequestHeaderProvider
from mlflow.utils import databricks_utils
class DatabricksRequestHeaderProvider(RequestHeaderProvider):
"""
Provides request headers indicating the type of Databricks environment from which a request
was made.
... |
"""Calling Functions
Python has a lot of stuff built in that you can
just use. Much of it is exposed through **functions**.
You have already seen a common one: |print|.
A function is _called_ by placing |()| after its
name. If it accepts **arguments**, then they go
inside of the |()|. The |len| function
demonstrated he... |
"""
Copyright 2012 Pontiflex, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
from survey.objects import *
import json
"""
This module provides an example of how to construct a questionnaire in Python.
Questionnaires can be saved by calling jsonize and dumping their contents.
Jsonized surveys can be reused, manipulated, and sent via RPC to another service.
"""
q1 = Question("What is your age?"
... |
"""Connections to gcloud datastore API servers."""
import os
from gcloud import connection
from gcloud.exceptions import make_exception
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
SCOPE = ('https://www.googleapis.com/auth/datastore',
'https://www.googleapis.com/auth/userinfo.email')
"""The s... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .constants import MSG_NOSUB
from .nosub_message import NosubMessage
from .server_message_parser import ServerMessageParser
__all__ = ['NosubMessageParser']
class NosubMessageParser(ServerMessageParser):
... |
"""CIFAR-10 data pipeline with preprocessing.
The data is generated via generate_cifar10_tfrecords.py.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import tensorflow as tf
WIDTH = 32
HEIGHT = 32
RGB_MEAN = [125.31, 122.95, 113.87]
RGB_... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v8.enums",
marshal="google.ads.googleads.v8",
manifest={"AppPlaceholderFieldEnum",},
)
class AppPlaceholderFieldEnum(proto.Message):
r"""Values for App placeholder fields. """
class AppPlaceholderField(proto.E... |
for i in range(2,6):
for j in range(1,i):
print j,
print " " |
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compl... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
print(find_packages(exclude=['contrib', 'docs', 'tests']))
setup(
name='pipelines',
... |
import csv
header = ['percent', 'sex', 'sSize']
d1 = ['58.35', 'F', '537']
d2 = ['41.65', 'M', '537']
d3 = ['7', 'F', '1023']
d4 = ['12', 'M', '1023']
d5 = ['10.2', 'F', '5013']
d6 = ['19.2', 'M', '5013']
d7 = ['18', 'F', '9215']
d8 = ['26', 'M', '9215']
d9 = ['10', 'F', '15154']
d10 = ['15', 'M', '15154']
print "writi... |
import sys
import get_dictionary
def unkify(tokens, words_dict):
final = []
for token in tokens:
# only process the train singletons and unknown words
if len(token.rstrip()) == 0:
final.append('UNK')
elif not(token.rstrip() in words_dict):
numCaps = 0
... |
"""Tests for Blenderbot Tokenizers, including common tests for BlenderbotSmallTokenizer."""
import unittest
from transformers import BlenderbotTokenizer, BlenderbotTokenizerFast
from transformers.file_utils import cached_property
class Blenderbot3BTokenizerTests(unittest.TestCase):
@cached_property
def tokenize... |
import logging
import os.path
import math
from io import StringIO
from pptx.shapes.graphfrm import GraphicFrame
from pptx.chart.data import ChartData, XyChartData
from pptx.enum.chart import XL_CHART_TYPE as ct
from pptx.chart.chart import Chart
import pandas as pd
import numpy as np
from six import string_types
import... |
import logging
from base64 import b64encode
from winrm.exceptions import WinRMOperationTimeoutError
from airflow.configuration import conf
from airflow.contrib.hooks.winrm_hook import WinRMHook
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.utils.decorators import a... |
import collections
import six
from heat.engine.cfn import functions as cfn_funcs
from heat.engine import function
from heat.engine import parameters
from heat.engine import rsrc_defn
from heat.engine import template
_RESOURCE_KEYS = (
RES_TYPE, RES_PROPERTIES, RES_METADATA, RES_DEPENDS_ON,
RES_DELETION_POLICY, ... |
import TownLoader
import MMStreet
from toontown.suit import Suit
class MMTownLoader(TownLoader.TownLoader):
def __init__(self, hood, parentFSM, doneEvent):
TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent)
self.streetClass = MMStreet.MMStreet
self.musicFile = 'phase_6/audio/bg... |
import itertools
from hazelcast.future import combine_futures, ImmediateFuture
from hazelcast.protocol.codec import map_add_entry_listener_codec, map_add_entry_listener_to_key_codec, \
map_add_entry_listener_with_predicate_codec, map_add_entry_listener_to_key_with_predicate_codec, \
map_add_index_codec, map_cle... |
import string
import copy
def explicit_element_decl_with_conf(i, words, element, name_subgraph, group, type_element):
comma=[]
config=[]
word=words[i+1]
index=string.find(word, '(')
for w in word.split(','):
if string.find(w,'(')!=-1 and string.find(w,')')==-1:
config.append(w[string.find(w,'(')+1:len(w)])
... |
from tapiriik.services import *
from .service_record import ServiceRecord
from tapiriik.database import db, cachedb
from bson.objectid import ObjectId
class Service:
# These options are used as the back for all service record's configurations
_globalConfigurationDefaults = {
"sync_private": False,
... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.system_availability_managers import AvailabilityManagerHighTemperatureTurnOn
log = logging.getLogger(__name__)
class TestAvailabilityManagerHighTemperatureTurnOn(unittest.TestCase... |
import contextlib
import os
import fixtures
import mock
import webob.exc
from neutron.common import constants
from neutron.common.test_lib import test_config
from neutron.common import topics
from neutron import context
from neutron.db import db_base_plugin_v2
from neutron import manager
from neutron.plugins.nec.common... |
import requests
url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle%2C%20WA&destinations=North%20Fork%2C%20WA&avoid=highways&units=imperial&arrival_time=1614709737&traffic_model=pessimistic&mode=transit&transit_mode=bus&transit_routing_preference=less_walking&key=YOUR_API_KEY"
payload={}
hea... |
import socket
import struct
import json
import time
import sys
import re
ZABBIX_SERVER = "127.0.0.1"
ZABBIX_PORT = 10051
class ZSend:
def __init__(self, server=ZABBIX_SERVER, port=ZABBIX_PORT, verbose=False):
self.zserver = server
self.zport = port
self.verbose = verbose
self.list = ... |
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
if __name__ == "__main__":
APP = os.path.abspath(os.path.dirname(__file__))
sys.path.append(APP)
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.test_settings'
django.setup()
TestRunner = get... |
import re
import sys
import os
def get_root_dir():
script = os.path.realpath(__file__)
return os.path.normpath(os.path.join(os.path.dirname(script), "../.."))
root_dir = get_root_dir()
source_directories = [
os.path.join(root_dir, "Src"),
os.path.join(root_dir, "Src", "DLR", "Src"),
]
exclude_directori... |
import types
from context import *
from exceptions import YaqlExecutionException, NoFunctionRegisteredException
import yaql
class Expression(object):
class Callable(object):
def __init__(self, wrapped_object, context):
self.wrapped_object = wrapped_object
self.yaql_context = context
... |
import sys
from contextlib import redirect_stdout, redirect_stderr
from datetime import datetime
import copy
import io
import logging
import glob
import os
import pickle
import platform
import pandas as pd
from ray.tune.utils.util import Tee
from six import string_types
import shutil
import tempfile
import time
import ... |
import csv
import itertools
from pyomo.environ import value
import __main__ as main
interactive_session = not hasattr(main, '__file__')
csv.register_dialect("ampl-tab",
delimiter="\t",
lineterminator="\n",
doublequote=False, escapechar="\\",
quotechar='"', quoting=csv.QUOTE_MINIMAL,
skipinitialspace... |
import itertools
from logger import *
from playbook import *
from sudoku import *
class NakedGroup(Strategy):
__metaclass__ = StrategyMeta
"""
NAKED-GROUP, including single, pair, triple, quad, etc. Naked in
this context refers to all the remaining hints in the group of
nodes. A naked group has the ... |
import logging
import requests
import json
import esgfpid.utils
import esgfpid.solr.tasks.filehandles_same_dataset
import esgfpid.solr.tasks.all_versions_of_dataset
import esgfpid.solr.serverconnector
import esgfpid.defaults
import esgfpid.exceptions
from esgfpid.utils import loginfo, logdebug, logtrace, logerror, logw... |
import os
import sys
import string
import time
import datetime
import MySQLdb
import winrm
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("check_os")
path='./include'
sys.path.insert(0,path)
import functions as func
import alert_os as alert
import alert_main ... |
import json
import urllib
from tempest.common.rest_client import RestClient
class HostsClientJSON(RestClient):
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(HostsClientJSON, self).__init__(config, username, password,
auth_url,... |
"""Utilities and helper functions."""
import contextlib
import errno
import inspect
import os
import pyclbr
import shutil
import socket
import sys
import tempfile
from eventlet import pools
import netaddr
from oslo_concurrency import lockutils
from oslo_concurrency import processutils
from oslo_config import cfg
from o... |
from google.cloud import vmmigration_v1
async def sample_get_clone_job():
# Create a client
client = vmmigration_v1.VmMigrationAsyncClient()
# Initialize request argument(s)
request = vmmigration_v1.GetCloneJobRequest(
name="name_value",
)
# Make the request
response = await client.g... |
"""Tests for tensorflow.ops.resource_variable_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import gc
import os
import pickle
import re
from absl.testing import parameterized
import numpy as np
from tensorflow.core.framework import tenso... |
"""Turns arbitrary objects into tf.CompositeTensor."""
import contextlib
import functools
import threading
import numpy as np
import tensorflow.compat.v2 as tf
from tensorflow.python.framework import composite_tensor
from tensorflow.python.framework import type_spec
from tensorflow.python.ops import resource_variable_o... |
import contextlib
try:
import unittest.mock as mock
except ImportError:
import mock
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado.httputil import HTTPHeaders
class MockClient(object):
def __init__(self, ioloop):
self.ioloop = ioloop
self.mocke... |
"""Haiku types."""
import typing
from typing import Any, Callable, Mapping, Sequence
import jax.numpy as jnp
try:
# Using PyType's experimental support for forward references.
Module = typing._ForwardRef("haiku.Module") # pylint: disable=protected-access
except AttributeError:
Module = Any
Initializer = Callable... |
import ctpy.data as data
import ctpy.math as m
from bson.objectid import ObjectId
import logging as log
from collections import defaultdict
import numpy as np
from slatkin import montecarlo # https://github.com/mmadsen/slatkin-exact-tools
import itertools
import pprint as pp
class ClassificationStatsPerSimrun:
de... |
from youtrack.connection import Connection
connection = Connection('some url', 'root', 'root')
for user in connection.getUsers():
print("yet another")
if (user.login != 'root') and (user.login != 'guest'):
connection._reqXml('DELETE', '/admin/user/' + user.login, '') |
import cmd
import subprocess
class ShellEnabled(cmd.Cmd):
last_output = ''
def do_shell(self, line):
"Run a shell command"
print("running shell command:", line)
sub_cmd = subprocess.Popen(line,
shell=True,
stdout=subpr... |
"""``tornado.web`` 模块提供了一个简单的带有异步功能的web框架,来使其可以承载数以万计的开放连接,并适用于 `long polling <http://en.wikipedia.org/wiki/Push_technology#Long_polling>`_ 场景.
这是一个简单的 "Hello, world" 的样例应用:
.. testcode::
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
... |
"""VBSP Server."""
from tornado.tcpserver import TCPServer
from empower.vbsp import PRT_UE_JOIN
from empower.vbsp import PRT_UE_LEAVE
from empower.core.pnfpserver import BaseTenantPNFDevHandler
from empower.core.pnfpserver import BasePNFDevHandler
from empower.core.pnfpserver import PNFPServer
from empower.core.vbs imp... |
user_list = [('Stephen', 'Stuart', 'sstuart@google.com'),
('Chris', 'Ritzo', 'critzo@measurementlab.net'),
('Josh', 'Bailey', 'joshb@google.com'),
('Nathan', 'Kinkade', 'kinkade@measurementlab.net'),
('Matt', 'Mathis', 'mattmathis@google.com'),
('Pet... |
"""
lunaport.domain.host
~~~~~~~~~~~~~~~~~~~~
Bbusiness logic layer for host resource.
"""
import pprint
import copy
import socket
pp = pprint.PrettyPrinter(indent=4).pprint
from .. helpers import validate_net_addr
from base import BaseAdaptor, BaseEntrie
class Host(BaseEntrie):
""" Host in lunaport ter... |
<html>
Something
</html> |
"""Provides a class for managing BIG-IP L7 Policy resources."""
import logging
from operator import itemgetter
from f5_cccl.resource import Resource
from f5_cccl.resource.ltm.policy.action import Action
from f5_cccl.resource.ltm.policy.condition import Condition
from f5_cccl.resource.ltm.policy.rule import Rule
LOGGER ... |
import setuptools
setuptools.setup() |
"""
Copyright 2010-2012 Asidev s.r.l.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... |
"""Test the Vilfo Router config flow."""
import vilfo
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.vilfo.const import DOMAIN
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_ID, CONF_MAC
from tests.async_mock import Mock, patch
async def test_form(hass... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BoPress.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is real... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.