code
stringlengths
1
199k
from api.management.commands.importbasics import * from django.db.utils import IntegrityError def import_songs(opt): local, redownload, noimages = opt['local'], opt['redownload'], opt['noimages'] events = models.Event.objects.exclude(japanese_name__contains='Score Match').exclude(japanese_name__contains='Medley...
"""Schema for our music library database. Our data model is extremely simple: * Our database contains audio file objects. * Each audio file is uniquely identified by a fingerprint. * Each audio file has many ID3 tags. * ID3 tags are partitioned into sets by a timestamp. """ from chirp.common import mp3_header f...
import unittest import numpy from functools import reduce from pyscf import lib from pyscf import scf from pyscf import gto from pyscf import cc from pyscf import ao2mo from pyscf import mp from pyscf.cc import gccsd from pyscf.cc import gccsd_rdm from pyscf.cc import ccsd from pyscf.cc import uccsd mol = gto.Mole() mo...
"""Religo URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
from collections import defaultdict, namedtuple import copy from functools import partial import warnings import numpy as np from jax import device_put, grad, hessian, jacfwd, jacobian, lax, random, value_and_grad from jax.flatten_util import ravel_pytree import jax.numpy as jnp from jax.scipy.special import expit impo...
"""Represent the Netgear router and its devices.""" from __future__ import annotations from abc import abstractmethod from collections.abc import Callable from datetime import timedelta import logging from pynetgear import Netgear from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ...
import json from io import BytesIO from unittest.mock import Mock from synapse.api.errors import SynapseError from synapse.http.servlet import ( parse_json_object_from_request, parse_json_value_from_request, ) from tests import unittest def make_request(content): """Make an object that acts enough like a re...
"""Base TestCases for the unit tests. Implementors of unit tests for Terra are encouraged to subclass ``QiskitTestCase`` in order to take advantage of utility functions (for example, the environment variables for customizing different options), and the decorators in the ``decorators`` package. """ import inspect import...
import os import httplib as http from flask import request from flask import send_from_directory from framework import status from framework import sentry from framework.auth import cas from framework.routing import Rule from framework.flask import redirect from framework.routing import WebRenderer from framework.excep...
import asyncio import os import pathlib import pytest import aiohttp from aiohttp import web from aiohttp.file_sender import FileSender try: import ssl except: ssl = False @pytest.fixture(params=['sendfile', 'fallback'], ids=['sendfile', 'fallback']) def sender(request): def maker(*args, **kwargs): ...
import urllib.request as ur url ='http://www.baidu.com' conn = ur.urlopen(url) print(conn) data = conn.read() print(data) print(conn.status,conn.getheader('Content-Type')) head_list = [(head,value) for head,value in conn.getheaders()] print(head_list) import requests url = 'http://www.baidu.com' resp = requests.get(url...
from django.forms import Form from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import validate_email from django.contrib.auth import authenticate, get_backends from django.contrib.auth.views import login as django_login_page, \ logout_then_login as djan...
import socket import struct import thread import threading import time import os import sys import json netcard=sys.argv[1] host_ip=sys.argv[2] collectTime=float(sys.argv[3]) net_data = {} d_net_info = {} cancel=True def net_data_normalize(): for key in net_data: net_data[key]="%s"%round(net_data[key]/colle...
""" Example Airflow DAG that creates, patches and deletes a Cloud SQL instance, and also creates, patches and deletes a database inside the instance, in Google Cloud. This DAG relies on the following OS environment variables https://airflow.apache.org/concepts.html#variables * GCP_PROJECT_ID - Google Cloud project for ...
import gym from ray.rllib.utils.annotations import PublicAPI @PublicAPI class FlexDict(gym.spaces.Dict): """Gym Dictionary with arbitrary keys updatable after instantiation Example: space = FlexDict({}) space['key'] = spaces.Box(4,) See also: documentation for gym.spaces.Dict """ def _...
from matplotlib import pyplot as plt from Delta import Delta if __name__ == '__main__': import numpy as np step = 1000 l = np.arange(30, 30000 + 1, step) a = np.zeros((len(l), 2)) for i in range(len(l)): e = l[i] d = Delta(energy=e, quiet=False, presise=True) a[i, 0] = d.delt...
"""Metering Label Implementations""" import logging from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils from openstackclient.i18n import _ from openstackclient.identity import common as identity_common from openstackclient.network import common LOG = logging.getLogger(__name__) ...
from ludwig.datasets.base_dataset import BaseDataset, DEFAULT_CACHE_LOCATION from ludwig.datasets.mixins.download import UncompressedFileDownloadMixin from ludwig.datasets.mixins.load import CSVLoadMixin from ludwig.datasets.mixins.process import * def load(cache_dir=DEFAULT_CACHE_LOCATION, split=False): dataset = ...
from pytest import raises from vedro.core import ScenarioFinder def test_scenario_finder(): with raises(Exception) as exc_info: ScenarioFinder() assert exc_info.type is TypeError assert "Can't instantiate abstract class ScenarioFinder" in str(exc_info.value)
import collections import copy import json import logging from operator import attrgetter import sys from django.core import exceptions as core_exceptions from django.core import urlresolvers from django import forms from django.http import HttpResponse # noqa from django import template from django.template.defaultfi...
import wx import os from datetime import datetime import wx.lib.filebrowsebutton as filebrowse import wx.lib.mixins.inspection from wx.lib.embeddedimage import PyEmbeddedImage from xls.read import read class MyPanel(wx.Panel): def __init__(self, parent, ID): wx.Panel.__init__(self, parent, ID) curre...
"""Support for Synology NAS Sensors.""" 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_NAME, CONF_HOST, CONF_USERNAME, CONF_PASS...
from write_pyomo_table import write_table args = dict( load_scen_id = "med", # "hist"=pseudo-historical, "med"="Moved by Passion" fuel_scen_id = 3, # 1=low, 2=high, 3=reference time_sample = "rps_test", # could be '2007', '2016test', 'rps_test' or 'main' load_zones = ('Oahu',), ...
"""Wrapper around 'git diff-index'. Compares the content and mode of the blobs found via a tree object with the content of the current index and, optionally ignoring the stat state of the file on disk. When paths are specified, compares only those named paths. Otherwise all entries in the index are compared. """ from _...
from direct.distributed.DistributedObjectGlobalAI import DistributedObjectGlobalAI class GlobalGroupTrackerAI(DistributedObjectGlobalAI): def announceGenerate(self): DistributedObjectGlobalAI.announceGenerate(self) def addGroupAI(self, leaderId, leaderName, shardName, category, memberIds, memberNames, s...
""" .. module:: pytfa :platform: Unix, Windows :synopsis: Thermodynamics-based Flux Analysis .. moduleauthor:: pyTFA team Tests for the pytfa module """ import pytfa.io import csv import lpdiff import pytest import os from pytfa.utils import numerics from settings import tmodel, this_directory, objective_value te...
from django.conf.urls import url, patterns from django.conf import settings from . import views urlpatterns = [ url(r'^$', views.feed, name='feed'), url(r'^create_post/$', views.create_post, name='create_post'), url(r'^logout/$', views.logout, name='logout'), url(r'^delete/$', views.delete, name='delete'), url(r'^...
from classes.dt.datatypes import DataTypeObject class Rock(DataTypeObject): tid = 'rock' _TID_FRIENDLY_NAME = 'Rock' _SHOWN_ATTRIBUTES = [ ('suporte', 'Suporte'), ('grain', 'Grain'), # ('grain', 'Grain'),' ('matrix', 'Matrix'), # ('matrix', 'Matrix') ('vp', 'V...
from traits.api import List from pychron.envisage.tasks.base_task_plugin import BaseTaskPlugin from pychron.furnace.tasks.nmgrl.preferences import NMGRLFurnaceControlPreferencesPane class NMGRLFurnaceControlPlugin(BaseTaskPlugin): canvases = List(contributes_to='pychron.extraction_line.plugin_canvases') # def _...
"""Utilities on options related types. """ import os from bdebuild.common import logutil from bdebuild.common import sysutil from bdebuild.common import blderror from bdebuild.meta import optionsparser from bdebuild.meta import optiontypes def get_default_option_rules(): """Return the default option rules. Retu...
class LockException(Exception): pass
import random import numpy import matplotlib.pyplot as plt num_bees = 1000 class Bee: at = 1 hp = 1 mp = 0 ammo = 1 signal_help = False def __init__(self): self.warmonger = numpy.random.power(2) #print self.warmonger def be_alert(self,hive,enemy): #print alert_level ...
from sklearn import datasets, metrics, cross_validation from tensorflow.contrib import skflow iris = datasets.load_iris() X_train, X_test, y_train, y_test = cross_validation.train_test_split(iris.data, iris.target, test_size=0.2, random_state=42) config_addon = skflow.addons.ConfigAddon(num_cores=3, gpu_memory_frac...
"""Commands for setting up the Bee Pollinator stack on AWS""" import argparse import os from cfn.stacks import build_stacks, destroy_stacks, get_config from ec2.amis import prune from packer.driver import run_packer current_file_dir = os.path.dirname(os.path.realpath(__file__)) def launch_stacks(icp_config, aws_profile...
"""Contains code for loading and preprocessing the MNIST data.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.compat.v1 as tf import tensorflow_datasets as tfds def provide_dataset(split, batch_size, num_parallel_calls=None, shuffle=True...
from __future__ import print_function from builtins import str from builtins import zip import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils import numpy as np def glrm_orthonnmf(): m = 1000 n = 100 k = 10 print("Uploading random uniform matrix with rows = " + str(m) + " a...
"""Tests for workflow specific imports.""" from datetime import date from os.path import abspath from os.path import dirname from os.path import join from integration.ggrc.converters import TestCase from ggrc import db from ggrc.converters import errors from ggrc_workflows.models.task_group import TaskGroup from ggrc_w...
from unittest import TestCase import time from urwid.canvas import Canvas from bzt.modules.console import TaurusConsole from bzt.modules.screen import GUIScreen class TestCanvas(Canvas): def __init__(self, value): super(TestCanvas, self).__init__() self.value = value def content(self, trim_left=...
""" Installs and configures MySQL """ import uuid import logging from packstack.installer import validators from packstack.installer import utils from packstack.installer.utils import split_hosts from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile controller = None PLUGIN_NAME = "OS-MySQ...
""" An Application which uses Keystone for authorisation using RBAC. """ import ConfigParser import abc from reporting_api.common.application import Application from keystonemiddleware.auth_token import filter_factory as auth_filter_factory class KeystoneApplication(Application): """ An Application which uses K...
import mock from nose.plugins.attrib import attr from manager_rest.test import base_test from cloudify_rest_client.exceptions import CloudifyClientError from dsl_parser import constants from dsl_parser.utils import ResolverInstantiationError @attr(client_min_version=1, client_max_version=base_test.LATEST_API_VERSION) c...
""" CellState Manager """ import collections import copy import datetime import functools import time from oslo_config import cfg from oslo_db import exception as db_exc from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import timeutils from oslo_utils import units import six ...
import yaml import json from pprint import pprint def output_format(my_list, my_str): ''' Make the output easier to read ''' print '\n\n' print '#'*3 print '#'*3+my_str print '#'*3 pprint(my_list) def main(): ''' Read YAML and JSON files. Pretty print to standard out ''' ...
import sys import os import glob import warnings import logging log = logging.getLogger(__name__) def exist_pyspark(): # check whether pyspark package exists try: import pyspark return True except ImportError: return False def check_spark_source_conflict(spark_home, pyspark_path): ...
from unittest import TestCase import string from array import array from cyhll import murmer3 class MurmerHash3TestCase(TestCase): def test_types(self): s = string.ascii_lowercase b = s.encode() primitives = [ (71840294.89317356, 667535430529636161, 1509664973462398741), ...
import json import time from random import randint from indy import ledger, did, wallet, pool from src.utils import get_pool_genesis_txn_path, run_coroutine, PROTOCOL_VERSION import logging logger = logging.getLogger(__name__) async def demo(): logger.info("Transaction Author Agreement sample -> started") # Set...
""" Audit log support for Flask routes. """ from collections import namedtuple from contextlib import contextmanager from distutils.util import strtobool from functools import wraps from json import loads from logging import DEBUG, getLogger from traceback import format_exc from uuid import UUID from flask import curre...
"""gcloud storage client for interacting with API.""" from gcloud.client import JSONClient from gcloud.exceptions import NotFound from gcloud.iterator import Iterator from gcloud.storage.bucket import Bucket from gcloud.storage.connection import Connection class Client(JSONClient): """Client to bundle configuration...
import functools from automaton import exceptions as automaton_exceptions from automaton import machines """State machine modelling. This is being used in the implementation of: http://specs.openstack.org/openstack/ironic-specs/specs/kilo/new-ironic-state-machine.html """ from ironic.common import exception as excp fro...
import itertools import numpy as np import os from torch.utils.data import ConcatDataset from fairseq.data import ( Dictionary, IndexedInMemoryDataset, IndexedRawTextDataset, MonolingualDataset, TokenBlockDataset, ) from . import FairseqTask, register_task @register_task('language_modeling') class LanguageModel...
""" test for the psurl module. """ import unittest from base_test import PschedTestBase from pscheduler.psurl import * class TestPsurl(PschedTestBase): """ URL tests. """ def test_url_bad(self): """IP addr tests""" # Missing scheme no_scheme = "no-scheme" (status, _) = ur...
import copy import logging import os import re import reportlab from reportlab.lib.enums import TA_LEFT from reportlab.lib.fonts import addMapping from reportlab.lib.pagesizes import landscape, A4 from reportlab.lib.styles import ParagraphStyle from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts imp...
from future.utils import native import flask_login from flask_login import login_required, current_user, logout_user from flask import flash from wtforms import ( Form, PasswordField, StringField) from wtforms.validators import InputRequired from ldap3 import Server, Connection, Tls, LEVEL, SUBTREE, BASE import ssl...
import os import logging import component import target import access_common import registry_access import github_access import git_access import hg_access import version import fsutils import sourceparse logger = logging.getLogger('access') def remoteComponentFor(name, version_required, registry='modules'): ''' Re...
import getpass import optparse from UcsSdk import * def getpassword(prompt): if platform.system() == "Linux": return getpass.unix_getpass(prompt=prompt) elif platform.system() == "Windows" or platform.system() == "Microsoft": return getpass.win_getpass(prompt=prompt) else: return getpass.getpass(prompt=prompt)...
import os from .command import Command, capture_stdout def git_cmd(fn): # function name is the subcommand sub_cmd = fn.__name__.replace("_", "-") def wrapper(self, *argv, **kwargs): return fn(self, sub_cmd, *argv, **kwargs) return wrapper class Git(Command): def __init__(self, git_bin=None):...
class Path: def at(self, t): pass class Bezier(Path): def __init__(self, a, b, ac, bc): self.a = a self.b = b self.ac = ac self.bc = bc def at(self, t): def calc(i): a = self.a[i] b = self.ac[i] c = self.bc[i] d ...
""" Stakeholder engagement API This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers. OpenAPI spec version: 1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git...
import configparser import json import optparse from purpleyard import gitlogs def render_graph(graph, name): """Generate a json file for graphing in d3. :param GerritGraph graph: graph to render """ # convert to list of nodes and edges nodes = [] edges = [] for edge in graph.get_strongest_e...
"""iWorkflow® system setup API REST URI ``http://localhost/mgmt/shared/system/easy-setup`` REST Kind none """ from f5.iworkflow.resource import UnnamedResource class Easy_Setup(UnnamedResource): def __init__(self, config): super(Easy_Setup, self).__init__(config) self._meta_data['required_lo...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.backend.jvm.artifact import Artifact from pants.backend.jvm.ossrh_publication_metadata import (Developer, License, ...
import contextlib import copy from datetime import datetime import json import time import uuid import mock from neutron.api.v2 import attributes as neutron_attrs from neutron.common import exceptions as n_exc_ext from neutron_lib import exceptions as n_exc from oslo_config import cfg from quark.db import api as db_api...
""" .. module:: plugin :platform: Unix :synopsis: Base class for all plugins used by Savu .. moduleauthor:: Mark Basham <scientificsoftware@diamond.ac.uk> """ import logging import numpy as np from savu.data import structures from savu.data import utils as du from savu.data.structures import Data, PassThrough fro...
"""Unit tests for encoder module.""" import optimizer import unittest import test_tools import vp9 class TestVp9(test_tools.FileUsingCodecTest): def test_Init(self): codec = vp9.Vp9Codec() self.assertEqual(codec.name, 'vp9') def test_OneBlackFrame(self): codec = vp9.Vp9Codec() my_optimizer = optimiz...
import os import sys import signal import gevent from gevent import monkey monkey.patch_all() import os import unittest import testtools import fixtures import socket from utils.analytics_fixture import AnalyticsFixture from mockcassandra import mockcassandra from mockredis import mockredis import logging from pysandes...
from datetime import datetime import locale import random import StringIO import time import threading import uuid import unittest from nose import SkipTest from ConfigParser import ConfigParser from test import get_config from test.functional.swift_test_client import Account, Connection, File, \ ResponseError from...
import kfp.deprecated as kfp from kfp.samples.test.utils import TestCase, relative_path, run_pipeline_func run_pipeline_func([ TestCase( pipeline_file=relative_path(__file__, 'retry.py'), mode=kfp.dsl.PipelineExecutionMode.V1_LEGACY, ), ])
""" Reading comprehension is loosely defined as follows: given a question and a passage of text that contains the answer, answer the question. These submodules contain readers for things that are predominantly reading comprehension datasets. """ from allennlp.data.dataset_readers.reading_comprehension.squad import Squa...
import sys import os import re import ConfigParser from glob import glob try: from io import BytesIO except ImportError: from StringIO import StringIO as BytesIO for line in open("lib/carbon_rewriter/version.py"): m = re.match('__version__ = "(.*)"', line) if m: version = m.group(1) brea...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math from .utils import get_padding_value def print_rf(layer_name, x): print("Layer {}:".format(layer_name)) print( "\theight/width: {}\n\tstride: {}\n\teq_kernel_size: {}\n\tstart: {}\n".format...
import json from sys import argv import os import urllib import urllib2 def main(member_id, page=1, index=0): url = 'http://worldcosplay.net/en/api/member/photos?member_id=%s&page=%s&limit=100000&rows=16&p3_photo_list=1' % (member_id, page) r = urllib2.urlopen(url) if r.code == 200: data = json.load...
from math import sqrt class Point: def __init__(self, _x, _y): self.x = _x self.y = _y def distance(self, p2): dx = p2.x - self.x dy = p2.y - self.y return sqrt(dx*dx + dy*dy) def __lt__(self, other): # Перегружает стандартную операцию меньше return self.y <...
"""Tests for config_lib classes.""" import os from grr.lib import config_lib from grr.lib import flags from grr.lib import test_lib class YamlConfigTest(test_lib.GRRBaseTest): """Test the Yaml config file support.""" def testParsing(self): conf = config_lib.GrrConfigManager() conf.DEFINE_list("Section1.test...
import unittest from parse.package import package class package_test(unittest.TestCase): def test_init(self): with self.assertRaises(ValueError): package(None) with self.assertRaises(TypeError): package(42) stream = 'Hello world!' pkg = package(stream) ...
import unittest2 from sqlupdater.parser import HiveDatabaseParser class HiveDatabaseParserTest(unittest2.TestCase): def test_parsing_database_name(self): _input = [ 'create table database.table', 'create external table if exists database.table', 'crete table table', ...
from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x6a\xa4\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x01\x14\x00\x00\x00\xf0\x08\x06\x00\x00\x00\xc1\xd2\x9b\x59\ \x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\ \xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x...
import testtools from designate import exceptions from designate import objects from designate.pool_manager.cache.base import PoolManagerCache class PoolManagerCacheTestCase(object): def create_pool_manager_status(self): values = { 'nameserver_id': '896aa661-198c-4379-bccd-5d8de7007030', ...
import sys import CindyScriptPygments as C from pygments.token import Token as T from .LexerBase import u, LexerBase class TestCindyJsHtmlLexer(LexerBase): lexerClass = C.CindyJsHtmlLexer def test_JSandCS(self): self.lex(u''' <html><body data-foo= "bar"><script type="text/javascript"> if(false)foo(); </...
from django.db import models from django.utils import timezone import datetime class Visit(models.Model): url = models.CharField(max_length=256) date = models.DateTimeField(editable=False) visitor = models.ForeignKey('Visitor') # Possibly extend this class in the future to make a tree # that gives s...
import pecan from pecan import rest import wsmeext.pecan as wsme_pecan from solum.api.controllers.camp import camp_v1_1_endpoint as endpoint from solum.api.controllers.camp.datamodel import platform_endpoints as model from solum.api.controllers import common_types from solum.common import exception URI_STRING = '%s/cam...
""" codebox.utils.cache ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ class _Missing(object): def __repr__(self): return 'no value' def __reduce__(self): return '_missing' _missing = _Missing() class cached_property(object): ...
from tempest.api.volume import base from tempest.common.utils import data_utils from tempest.openstack.common import log as logging from tempest.services.volume.json.admin import volume_types_client from tempest.services.volume.json import volumes_client from tempest.test import attr LOG = logging.getLogger(__name__) c...
from abc import ABCMeta, abstractmethod from enum import Enum class VehicleSize(Enum): MOTORCYCLE = 0 COMPACT = 1 LARGE = 2 class Vehicle(metaclass=ABCMeta): def __init__(self, vehicle_size, license_plate, spot_size): self.vehicle_size = vehicle_size self.license_plate = license_plate ...
from django.conf.urls import patterns from django.conf.urls import url from openstack_horizon.dashboards.project.instances import views INSTANCES = r'^(?P<instance_id>[^/]+)/%s$' INSTANCES_KEYPAIR = r'^(?P<instance_id>[^/]+)/(?P<keypair_name>[^/]+)/%s$' VIEW_MOD = 'openstack_horizon.dashboards.project.instances.views' ...
"""Implements the SmallNORB data class.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import task_adaptation.data.base as base from task_adaptation.registry import Registry import tensorflow.compat.v1 as tf import tensorflow_datasets as tfds VAL_SPLIT_PE...
""" Tests For Scheduler """ import collections import copy from datetime import datetime import ddt import mock from oslo_config import cfg from cinder.common import constants from cinder import context from cinder import exception from cinder.message import message_field from cinder import objects from cinder.schedule...
import unohelper from com.sun.star.datatransfer import XTransferable, DataFlavor class transferable(unohelper.Base, XTransferable): """Keep clipboard data and provide them.""" def __init__(self, text): df = DataFlavor() df.MimeType = "text/plain;charset=utf-16" df.HumanPresentableName = ...
from .. import authz from . import v1_core def get_secret(namespace, name, auth=True): if auth: authz.ensure_authorized("get", "", "v1", "secrets", namespace) return v1_core.read_namespaced_secret(name, namespace) def create_secret(namespace, secret, auth=True): if auth: authz.ensure_authori...
import time from c6d import Canon6DConnector def camera_main(camera): print 'camera_main', camera.guid camera.set_config('capture', 1) camera.set_config('capturetarget', 'Memory card') camera.set_config('reviewtime', 'None') camera.set_config('drivemode', 'Single') apertures = camera.get_config_...
""" 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 ...
""" Copyright 2017-present Airbnb, 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, softwa...
import datetime import lxml.etree from unittest import mock import requests_mock import dracclient.client from dracclient import exceptions import dracclient.resources.job from dracclient.resources import uris from dracclient.tests import base from dracclient.tests import utils as test_utils from dracclient import util...
""" WSGI config for Accounting project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Accounting.settings") from django.core...
from typing import List class Solution: def findCircleNum(self, M: List[List[int]]) -> int: print(M) u = UnionFind(len(M)) # Lets find edges from this matrices m, n = len(M), len(M[0]) for i in range(m): for j in range(i): # Edge discovered ...
"""A number of common glslc result checks coded in mixin classes. A test case can use these checks by declaring their enclosing mixin classes as superclass and providing the expected_* variables required by the check_*() methods in the mixin classes. """ import os.path from glslc_test_framework import GlslCTest def con...
from django.contrib import admin from CicloviaProgram.models import Ciclovia from CicloviaProgram.models import Track from CicloviaProgram.models import NeighboorInfo from CicloviaProgram.models import Document from CicloviaProgram.models import ParticipantType from CicloviaProgram.models import SimulationParameters fr...
""" The models and fields for translation support. The default is to use the :class:`TranslatedFields` class in the model, like: .. code-block:: python from django.db import models from parler.models import TranslatableModel, TranslatedFields class MyModel(TranslatableModel): translations = Translat...
import functools import itertools from warnings import warn from collections import deque import pysmt.smtlib.commands as smtcmd from pysmt.environment import get_env from pysmt.logics import get_logic_by_name, UndefinedLogicError from pysmt.exceptions import UnknownSmtLibCommandError, PysmtSyntaxError from pysmt.excep...
""" Code for the multitask experiments with the isometric/compositional model. """ import os from utils import args_util, training from lib import multitask as mt from lib.resnet_parameters import ResNetParameters def main(): """Performs a finetuning or supervised domain adaptation experiment.""" args, exp_path = a...
""" 飞船显示相关函数 """ import pygame from pygame.sprite import Sprite class Ship(Sprite): """ 飞船相关的类 """ def __init__(self, ai_settings, screen): """ 初始化飞船的相关设置 """ super(Ship, self).__init__() self.screen = screen self.ai_settings = ai_settings self.image = pygame.image.load('...