code
stringlengths
1
199k
import logging from asyncio import CancelledError from urllib.parse import urlsplit from asyncio import Semaphore from tornado.httpclient import HTTPRequest, HTTPClientError from tornado.curl_httpclient import CurlAsyncHTTPClient import pycurl from .http import HttpResponse from .errors import ClientError, HttpError fr...
"""Compute minibatch blobs for training a RetinaNet network.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import logging import detectron.utils.boxes as box_utils import detectron.roi_data.data_...
from os.path import join, dirname, realpath import sys sys.path.insert(0, dirname(dirname(realpath(__file__)))) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME':...
"""A command line parsing module that lets modules define their own options. Each module defines its own options, e.g.:: from cyclone.options import define, options define("mysql_host", default="127.0.0.1:3306", help="Main user DB") define("memcache_hosts", default="127.0.0.1:11011", multiple=True, ...
""" Tornado REST API Request Handlers for CloudPipe """ import logging import urllib from nova import vendor import tornado.web from nova import crypto from nova.auth import users _log = logging.getLogger("api") _log.setLevel(logging.DEBUG) class CloudPipeRequestHandler(tornado.web.RequestHandler): def get(self, pa...
single_schema = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "GitRepo", "description": "Serialized GitRepo object", "type": "object", "properties": { "id": {"type": "number"}, "repo_name": {"type": "string"}, "env_id": {"type": "number"}, "git_url"...
import mock import six from senlin.api.middleware import trust from senlin.common import context from senlin.common import exception from senlin.objects.requests import credentials as vorc from senlin.tests.unit.common import base from senlin.tests.unit.common import utils class TestTrustMiddleware(base.SenlinTestCase)...
""" Django settings for CloudConfigWebserver project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ impor...
""" This module manages the HTTP and HTTPS connections to the backend controllers. The main class it provides for external use is ServerPool which manages a set of ServerProxy objects that correspond to individual backend controllers. The following functionality is handled by this module: - Translation of rest_* functi...
from google.cloud import aiplatform_v1 def sample_delete_tensorboard_time_series(): # Create a client client = aiplatform_v1.TensorboardServiceClient() # Initialize request argument(s) request = aiplatform_v1.DeleteTensorboardTimeSeriesRequest( name="name_value", ) # Make the request ...
from __future__ import absolute_import, division, print_function import types def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, eac...
import logging import uuid from django.utils.translation import ugettext_lazy as _ import horizon.forms as forms import horizon.tables as tables import horizon.workflows as workflows import openstack_dashboard.api.glance as glance_api import openstack_dashboard.api.neutron as neutron_api import openstack_dashboard.api....
from __future__ import absolute_import from __future__ import unicode_literals import sys DEFAULT_TIMEOUT = 10 HTTP_TIMEOUT = 60 IMAGE_EVENTS = ['delete', 'import', 'pull', 'push', 'tag', 'untag'] IS_WINDOWS_PLATFORM = (sys.platform == "win32") LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-number' LABEL_ONE_OF...
import json import hashlib from sys import version_info from datetime import datetime IS_PY3 = version_info[0] >= 3 if IS_PY3: import email.utils as rfc822 else: import rfc822 def rfc822_timestamp(time_string): return datetime.fromtimestamp(rfc822.mktime_tz(rfc822.parsedate_tz(time_string))) def uri_to_buck...
import eventlet from oslo_config import cfg from oslo_log import log as logging from sqlalchemy.orm import exc from sqlalchemy.sql import expression as expr from neutron.api.v2 import attributes from neutron.common import exceptions as n_exc from neutron import context as n_context from neutron.db import models_v2 from...
from mock import Mock from trove.common import cfg from trove.instance.views import InstanceDetailView from trove.instance.views import InstanceView from trove.tests.unittests import trove_testtools CONF = cfg.CONF class InstanceViewsTest(trove_testtools.TestCase): def setUp(self): super(InstanceViewsTest, ...
from sqlalchemy import Boolean, Column, DateTime, ForeignKey from sqlalchemy import Integer, MetaData, String, Table, Text def define_tables(meta): services = Table( 'services', meta, Column('created_at', DateTime), Column('updated_at', DateTime), Column('deleted_at', DateTime), ...
import webapp2 import datetime import os from google.appengine.ext.webapp import template import alarm import gae_util class IndexPage(webapp2.RequestHandler): def get(self): utcnow = datetime.datetime.utcnow() jstTime = gae_util.Utility.convert_jst_time(utcnow) if jstTime.hour >= 7: ...
from __future__ import print_function import sys from streamsx.topology.topology import Topology import streamsx.topology.context import parallel_regex_grep_functions import util_functions def main(): """ Sample continuous (streaming) regular expression grep topology application. This Python application bui...
"""Test that type checker correcly computes types for expressions. """ import tvm import numpy as np from tvm.relay.ir_pass import infer_type from tvm.relay.ir_builder import IRBuilder, func_type from tvm.relay.ir_builder import scalar_type, convert, tensor_type from tvm.relay.env import Environment from tvm.relay.o...
from isserviceup.services.models.statuspage import StatusPagePlugin class Shotgun(StatusPagePlugin): name = 'Shotgun' status_url = 'http://status.shotgunsoftware.com/' icon_url = '/images/icons/shotgun.png'
from MAT.DocumentIO import declareDocumentIO, DocumentFileIO, SaveError from MAT.Document import LoadError from MAT.Annotation import AnnotationAttributeType, StringAttributeType, FloatAttributeType, \ BooleanAttributeType, IntAttributeType, AttributeValueList, AttributeValueSet import xml.parsers.expat, xml.sax.s...
import simplejson as json import pycurl, sys, time, multiprocessing, threading numProcesses = int(sys.argv[1]) numQueriesPerProcess = int(sys.argv[2]) series = sys.argv[3] url = sys.argv[4] print numProcesses * numQueriesPerProcess data = "q=select value from " data += series print data def processWorker(numQueriesPerP...
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py """ from oslo_utils import netutils from oslotest import mockpatch from ceilometer.hardware.inspector import snmp from ceilometer.tests import base as test_base ins = snmp.SNMPInspector class FakeObjectName(object): def __init__(self, name): self....
from spark import GenericParser from ast import AST import pprint from spark import GenericASTBuilder class AutoExprParser(GenericASTBuilder): def __init__(self, AST, start='expr'): GenericASTBuilder.__init__(self, AST, start) def p_expr(self, args): """ """ # empty docstring, here is were the rules are defin...
"""Main entry point into the Identity service.""" import abc import functools import os import uuid from oslo_config import cfg from oslo_log import log from oslo_utils import importutils import six from keystone import clean from keystone.common import dependency from keystone.common import driver_hints from keystone....
from django import forms from utils.forms import ( BootstrapMixin, BulkEditForm, CustomNullBooleanSelect, DynamicModelMultipleChoiceField, StaticSelectMultiple, add_blank_choice, ) from .enums import GeneralPolicy from .models import NetworkIXLan class NetworkIXLanFilterForm(BootstrapMixin, form...
"""OWASP Dependency Check dependencies collector.""" import re from xml.etree.ElementTree import Element # nosec, Element is not available from defusedxml, but only used as type from collector_utilities.functions import parse_source_response_xml_with_namespace, sha1_hash from collector_utilities.type import Namespaces...
from django.contrib.postgres.fields import JSONField from django.db import models from common.models import AbstractBaseModel class FeedbackType: BUG = 0 FEATURE_REQUEST = 1 COMMENT = 2 CHOICES = ( (BUG, 'Bug'), (FEATURE_REQUEST, 'Feature request'), (COMMENT, 'Comment'), ) cl...
""" Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this ...
"""Details about printers which are connected to CUPS.""" import importlib import logging from datetime import timedelta import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import CONF_HOST, CONF_PORT from hom...
import json import paho.mqtt.client as mqtt from datetime import datetime message = 'ON' counter = 0 def on_connect(mosq, obj, rc): print("rc: " + str(rc)) def on_message(mosq, obj, msg): print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload)) def on_publish(mosq, obj, mid): print("mid: " + str(mid))...
import warnings as _warnings _warnings.resetwarnings() _warnings.filterwarnings('error') from tdi import _htmldecode def d(*a, **k): try: return repr(_htmldecode.decode(*a, **k)) except UnicodeError: return "unicodeerror" except ValueError, e: return str(e) for _ in xrange(10): p...
import bcrypt import concurrent.futures import sqlite3 import markdown import os.path import re import subprocess import tornlite import tornado.escape from tornado import gen import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web import unicodedata from tornado.options import define,...
""" REST helpers for DistCILib Copyright (c) 2012-2013 Heikki Nousiainen, F-Secure See LICENSE for details """ import httplib import urlparse import random class RESTHelper(object): """ Helper class for REST operations """ def __init__(self, parent): self.parent = parent @classmethod def _do_req...
""" Get view of the track and discretize it to define states for the Machine Learning step """ import sys import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from random import random, randint def dist(x1, y1, x2, y2): """ Return distance between (x1, y1) and (x2, y2) ""...
"""Access control helper. See soc.views.helper.access module. """ __authors__ = [ '"Daniel Hans <daniel.m.hans@gmail.com>', ] from soc.views.helper import access class StatisticChecker(access.Checker): """See soc.views.helper.access.Checker. """ @access.denySidebar @access.allowDeveloper def checkCanMan...
import json import mock import pytest from pyetcd import EtcdNodeExist from etcdb import LOCK_WAIT_TIMEOUT, OperationalError from etcdb.lock import Lock @pytest.mark.parametrize('db, tbl, lock_prefix, lock_name, key, author, reason', [ ( 'foo', 'bar', 'some_prefix', 'some_lock', '/foo/bar/some_prefi...
""" Network Hosts are responsible for allocating ips and setting up network. There are multiple backend drivers that handle specific types of networking topologies. All of the network commands are issued to a subclass of :class:`NetworkManager`. **Related Flags** :network_driver: Driver to use for network creation :f...
class FeaturizeFunctions: def __init__(self): pass def transform(self, corpus): self.corpus = corpus for segment in self.corpus.get_list_segments(): short_funcs = sorted(segment.get_feature('short_name_string')) long_funcs = sorted(segment.get_feature('full_name_s...
"""Function for computing a robust mean estimate in the presence of outliers. This is a modified Python implementation of this file: https://idlastro.gsfc.nasa.gov/ftp/pro/robust/resistant_mean.pro """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import nu...
from google.datacatalog_connectors.hive.entities import base, table_storage import sqlalchemy class Column(base.BASE): __tablename__ = 'COLUMNS_V2' id = sqlalchemy.Column('CD_ID', sqlalchemy.Integer, sqlalchemy.ForeignKey( tabl...
import base64 import ctypes import ctypes.util import struct import sys clib_path = ctypes.util.find_library("c") if sys.platform == "win32": if clib_path: clib = ctypes.CDLL(clib_path) else: clib = ctypes.cdll.ucrtbase # Note(mbivolan): The library name has changed in OpenSSL 1.1.0 # Ke...
from google.cloud import aiplatform_v1beta1 async def sample_read_feature_values(): # Create a client client = aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient() # Initialize request argument(s) feature_selector = aiplatform_v1beta1.FeatureSelector() feature_selector.id_matcher.ids = [...
import os import time import json from picklefield import PickledObjectField from django.conf import settings from django.contrib.gis.db import models from django.utils.html import escape from madrona.common.utils import asKml from madrona.common.jsonutils import get_properties_json, get_feature_json from madrona.featu...
import pandas as pd def topicMapToGroup(topic): if topic in ['Bidding/Buying Items', 'Account Safety - CCR', 'Unknown', 'Buyer Loyalty Programs', 'eBay Account Information - CCR', 'Listing Ended/Removed - Buyer', 'eBay Partner Sites - CCR', 'Paying for Items', 'Forgot User ID or Pa...
import unittest from tri_pen_and_hex import * class TriPenAndHexTest(unittest.TestCase): def test_next_tri_pen_and_hex(self): self.assertEqual(next_tri_pen_and_hex(1), 40755) def test_project_euler(self): self.assertEqual(next_tri_pen_and_hex(40755), 1533776805) if __name__ == '__main__': un...
from python.decorators import euler_timer from python.functions import ascending from python.functions import total_perms def dice_outcomes(num_dice, num_sides): result = {} for bottom in range(1, num_sides + 1): for dice_sum in range(1 * num_dice, num_sides * num_dice + 1): for outcome in a...
"""Test the Logitech Squeezebox config flow.""" from unittest.mock import patch from pysqueezebox import Server from homeassistant import config_entries from homeassistant.components.dhcp import HOSTNAME, IP_ADDRESS, MAC_ADDRESS from homeassistant.components.squeezebox.const import DOMAIN from homeassistant.const impor...
from datetime import datetime from babel import dates from babel.dates import format_time from google.appengine.ext import db from rogerthat.dal import parent_key from rogerthat.rpc import users from solutions import translate from solutions.common import SOLUTION_COMMON from solutions.common.consts import SECONDS_IN_H...
from flask import Flask from flask_oauth import OAuth from app import settings app = Flask(__name__) app.config.from_object('app.settings.Production') oauth = OAuth() facebook = oauth.remote_app('facebook', base_url='https://graph.facebook.com/', request_token_url=None, access_token_url='/oauth/access_token...
from product import Product masterProductList = [ Product("Porter", "1", 10), Product("Mild", "2", 30), Product("Kölsch", "4", 15), Product("Pilsener", "4", 60), Product("Lager", "3", 40), Product("Bitter", "4", 45), Product("Stout", "5", 20), Product("Brown Ale", "2", 25), Product("Blonde Ale", "1", 35), Pro...
''' Created on May 26, 2013 @author: mpastern '''
from f5_openstack_agent.lbaasv2.drivers.bigip.icontrol_driver import \ iControlDriver import json import logging import os import pytest import requests from ..testlib.bigip_client import BigIpClient from ..testlib.fake_rpc import FakeRPCPlugin from ..testlib.service_reader import LoadbalancerReader from ..testlib....
from oslo_config import cfg from oslo_log import log as logging from oslo_utils import strutils from nova import exception from nova.i18n import _LI from nova.network import base_api from nova.network import floating_ips from nova.network import model as network_model from nova.network import rpcapi as network_rpcapi f...
default_app_config = 'providers.org.socarxiv.apps.AppConfig'
"""Tests for symbolic.instructions.""" import itertools from absl.testing import absltest from absl.testing import parameterized import jax import numpy as np import sympy from symbolic_functionals.syfes.symbolic import instructions from symbolic_functionals.syfes.xc import gga jax.config.update('jax_enable_x64', True)...
""" 2. Using Arista's pyeapi, create a script that allows you to add a VLAN (both the VLAN ID and the VLAN name). Your script should first check that the VLAN ID is available and only add the VLAN if it doesn't already exist. Use VLAN IDs between 100 and 999. You should be able to call the script from the command ...
import sys from omniORB import CORBA, PortableServer import Example, Example__POA class Echo_i (Example__POA.Echo): def echoString(self, mesg): print "echoString() called with message:", mesg return mesg orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) poa = orb.resolve_initial_references("RootPOA") ei ...
__author__ = 'chris' import numpy as np class BoofGenerator(): def __init__(self, spatial_pyramid): self.spatial_pyramid = spatial_pyramid def build_feature_vectors_matrix(self, keypoints, labels): print("Building trajectory feature matrix...") num_features = self.spatial_pyramid.descrip...
import fixtures import mock from nova.tests.functional import fixtures as func_fixtures from nova.tests.functional import test_servers as base from nova.tests.unit.virt.libvirt import fake_imagebackend from nova.tests.unit.virt.libvirt import fake_libvirt_utils from nova.tests.unit.virt.libvirt import fakelibvirt class...
from pyspark import since from pyspark.rdd import ignore_unicode_prefix from pyspark.sql.column import Column, _to_seq, _to_java_column, _create_column_from_literal from pyspark.sql.dataframe import DataFrame from pyspark.sql.types import * __all__ = ["GroupedData"] def dfapi(f): def _api(self): name = f.__...
import unittest import ray from ray.rllib.agents.a3c import A2CTrainer from ray.rllib.utils.test_utils import framework_iterator class TestDistributedExecution(unittest.TestCase): """General tests for the distributed execution API.""" @classmethod def setUpClass(cls): ray.init(ignore_reinit_error=Tr...
from net_system.models import NetworkDevice, Credentials import django def main(): django.setup() creds = Credentials.objects.all() temp_rtr1 = NetworkDevice( device_type='cisco_ios', device_name='temp-rtr1', ip_address='192.168.0.254', port='22', vendor='Cisco System...
import tkinter as tk from tkinter import * AA_names1 = ['Dof','Arg','Asn','Asp','Cys','Glu','Gln','Gly','His','Ile'] AA_names2 = ['Leu','Lys','Met','Phe','Pro','Ser','Thr','Trp', 'Tyr', 'Val'] class Sequence_Builder2(object): '''This is the main class for building a peptide using buttons''' def __init__(self, master,...
"""Tests for workflow object exports.""" from os.path import abspath, dirname, join from flask.json import dumps from ggrc.app import app from ggrc_workflows.models import Workflow from integration.ggrc import TestCase from integration.ggrc_workflows.generator import WorkflowsGenerator THIS_ABS_PATH = abspath(dirname(_...
from glance import loadables class BaseFilter(object): """Base class for all filter classes.""" def _filter_one(self, obj, filter_properties): """Return True if it passes the filter, False otherwise. Override this in a subclass. """ return True def filter_all(self, filter_obj...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import time import pytest from escpos.exceptions import TimeoutException from escpos.helpers import chunks from escpos.helpers import TimeoutHelper from escpos.helpers import find_implementations def tes...
"""Integration tests for gcsio module. Runs tests against Google Cloud Storage service. Instantiates a TestPipeline to get options such as GCP project name, but doesn't actually start a Beam pipeline or test any specific runner. Options: --kms_key_name=projects/<project-name>/locations/<region>/keyRings/\ <key-...
import expr_aritmetica import calculadora class Supercalculadora: def __init__(self, parser, validador): self.calc = calculadora.Calculadora() self.parser = parser self.validador = validador def __operar__(self, expr_decompuesta): i = None res_intermedio = 0 if '*' in expr_decompuesta['Operadores']: i ...
import os import copy import time import urllib import json from xbmcswift2 import xbmc, xbmcplugin, xbmcvfs from meta import plugin, import_tmdb, import_tvdb, LANG from meta.gui import dialogs from meta.info import get_tvshow_metadata_tvdb, get_tvshow_metadata_tmdb, get_season_metadata_tvdb, get_episode_metadata_tvdb,...
"""Configuration and hyperparameter sweeps.""" from lra_benchmarks.listops.configs import base_listops_config def get_config(): """Get the default hyperparameter configuration.""" config = base_listops_config.get_config() config.model_type = "sparse_transformer" return config def get_hyper(hyper): return hype...
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bossma.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
import tornado.web import logging import time import sys import os import uuid import smtplib import hashlib import json as JSON # 启用别名,不会跟方法里的局部变量混淆 from bson import json_util import requests sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../")) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "...
from index import app from flask import render_template, request from config import BASE_URL @app.route('/') def index(): page_url = BASE_URL + request.path page_title = 'Beyond Beethoven' interview_base_url = 'http://www.vpr.net/apps/beyond-beethoven/static/audio/VPR-Inside-' interview = [ 'Men...
from tracker import np from tracker import track def gettrackcircles(tracks): circles = [] for t in tracks: circles.append(t.subject.circle) return circles def checkoverlap(x1, y1, r1, x2, y2, r2): dxy = np.sqrt(np.power(y2 - y1, 2) + np.power(x2 - x1, 2)) dr = np.power(r2 + r1, 2) if dx...
"""This file contains the public API's for interacting with LLDPAD. """ from networking_cisco._i18n import _LE from networking_cisco.apps.saf.common import dfa_logger as logging from networking_cisco.apps.saf.common import dfa_sys_lib as utils LOG = logging.getLogger(__name__) class LldpApi(object): """LLDP API Cla...
import gevent import os import sys import socket import errno import uuid import logging import coverage import cgitb cgitb.enable(format='text') import fixtures import testtools from testtools.matchers import Equals, MismatchError, Not, Contains from testtools import content, content_type, ExpectedException import uni...
import os from setuptools import setup def get_static_files(path): return [os.path.join(dirpath.replace("luigi/", ""), ext) for (dirpath, dirnames, filenames) in os.walk(path) for ext in ["*.html", "*.js", "*.css", "*.png", "*.eot", "*.svg", "*.ttf", "*.woff", "*.woff...
"""Unittests for the asan_system_interceptor_parser module.""" import system_interceptor_parser as asan_parser import logging import optparse import os import re import shutil import tempfile import unittest class TestInterceptorParser(unittest.TestCase): """Unittests for asan_system_interceptor_parser.""" def setU...
""" Common class for SMI-S based EMC volume drivers. This common class is for EMC volume drivers based on SMI-S. It supports VNX and VMAX arrays. """ import time from oslo.config import cfg from xml.dom.minidom import parseString from cinder import exception from cinder import flags from cinder.openstack.common import ...
import unittest from collections import defaultdict from mysql.utilities.common import user, server from mysql.utilities.exception import UtilError class TestUserPrivileges(unittest.TestCase): def setUp(self): dummy_s1 = server.Server({"conn_info": "user1@notexists:999999"}) dummy_s2 = server.Server...
from __future__ import print_function import os import pyos pyos.set_setting("identity_type", "rackspace") creds_file = os.path.expanduser("~/.rackspace_cloud_credentials") pyos.set_credential_file(creds_file) clb = pyos.cloud_loadbalancers vip = clb.VirtualIP() print("Virtual IP (using defaults):", vip ) vip = clb.Vir...
"""Data Flow Operations.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import hashlib import re import six from tensorflow.python.framework import common_shapes from tensorflow.python.framework import dtypes as _dtypes from tensorflow....
import importlib import logging import os import json from datetime import datetime from st2actions.runners.pythonrunner import Action from st2client.client import Client from st2client.models import KeyValuePair from lib import k8s class UpdateJenkins(Action): def run(self, source, ns): """ Entry i...
import rospy import serial import time from binascii import unhexlify class ConfigGpsSensors: # Config constant for UBLOX NEO 7 BAUD_115200 = 'B5 62 06 00 14 00 01 00 00 00 D0 08 00 00 00 C2 01' \ + ' 00 03 00 03 00 00 00 00 00 BC 5E' FREQ_5HZ = 'B5 62 06 08 06 00 C8 00 01 00 01 00 DE 6A' ...
from textblob import TextBlob b = TextBlob("Spellin iz vaerry haerd to do. I do not like this spelling product at all it is terrible and I am very mad.") print(b.correct()) print(b.sentiment) print(b.sentiment.polarity)
import os import pytest import deploy_model PROJECT_ID = os.environ["AUTOML_PROJECT_ID"] MODEL_ID = "TRL0000000000000000000" @pytest.mark.slow def test_deploy_model(capsys): # As model deployment can take a long time, instead try to deploy a # nonexistent model and confirm that the model was not found, but othe...
import os from typing import TYPE_CHECKING, Any, Dict, List, Optional from scripts.lib.zulip_tools import deport from .config import DEVELOPMENT, PRODUCTION, get_secret if TYPE_CHECKING: from django_auth_ldap.config import LDAPSearch from typing_extensions import TypedDict from zerver.lib.types import SAMLI...
import urllib.request, string import urllib.parse dict = range(30, 123) flag = '' def doit(data): url ='http://202.112.26.124:8080/fb69d7b4467e33c71b0153e62f7e2bf0/index.php' user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' values = {'uname' : data,'pwd' : '123'} data = urllib.parse.urlenco...
"""Support for Nest Thermostat sensors for the legacy API.""" import logging from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( CONF_MONITORED_CONDITIONS, CONF_SENSORS, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, PERCENTAGE, STATE_OFF, TEMP_CELSIU...
import sys import samples_common # Common bits used between samples import logging from matrix_client.client import MatrixClient from matrix_client.api import MatrixRequestError from requests.exceptions import MissingSchema def on_message(event): if event['type'] == "m.room.member": if event['membership'] ...
import RPi.GPIO class GPIO: def __init__(self, gpio=RPi.GPIO): self.gpio = gpio self.gpio.setmode(self.gpio.BOARD) def pin(self, channel): return Pin(self.gpio, channel) def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.gpio...
from google.cloud import dialogflow_v2 def sample_batch_delete_entities(): # Create a client client = dialogflow_v2.EntityTypesClient() # Initialize request argument(s) request = dialogflow_v2.BatchDeleteEntitiesRequest( parent="parent_value", entity_values=['entity_values_value_1', 'ent...
from datetime import datetime from netmiko import ConnectHandler from datetime import datetime from net_system.models import NetworkDevice, Credentials import django def main(): django.setup() start_time = datetime.now() devices = NetworkDevice.objects.all() for a_device in devices: print a_devi...
from __future__ import print_function from pyspark.ml.feature import OneHotEncoderEstimator from pyspark.sql import SparkSession if __name__ == "__main__": spark = SparkSession\ .builder\ .appName("OneHotEncoderEstimatorExample")\ .getOrCreate() # Note: categorical features are usually f...
import nltk def getFrequencyDist(bigramsCollection): print("********** Creating Frequency Distribution **********") freqDist = {} for sentiment in bigramsCollection: print("Processing sentiment " + str(sentiment) ) frequency = nltk.FreqDist(bigramsCollection[sentiment]) freqDist[sent...
""" Created on Wed May 28 03:29:55 2014 @author: dan """ from ahabSyntax import constChar , openingChars , closingChars from regroupConstHelper import regroupConstHelper from ahabErrorMessages import err2 def regroupConst( curLine ) : # ======================= # build up equationInfo # ========...
import logging from http import HTTPStatus from typing import TYPE_CHECKING, Tuple from synapse.api.errors import Codes, NotFoundError, SynapseError from synapse.federation.transport.server import Authenticator from synapse.http.servlet import RestServlet, parse_integer, parse_string from synapse.http.site import Synap...
""" Driver for Microsoft Azure Resource Manager (ARM) Virtual Machines provider. http://azure.microsoft.com/en-us/services/virtual-machines/ """ import base64 import binascii import os import time from libcloud.common.azure_arm import AzureResourceManagementConnection from libcloud.compute.providers import Provider fro...