text stringlengths 2 999k |
|---|
# coding=utf-8
# Copyright 2021 The Tensor2Tensor Authors.
#
# 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... |
from pandac.PandaModules import Point3, VBase3, Vec4
objectStruct = {'Objects': {'1155772882.54fxlara0': {'Type': 'Building Interior','Name': 'Vip Room','Instanced': True,'Objects': {'1165353000.84kmuller': {'Type': 'Light_Fixtures','Hpr': VBase3(-1.038, 0.0, 0.0),'Pos': Point3(-0.4, -0.252, 14.037),'Scale': VBase3(1.2... |
from django.test.testcases import TestCase
from lsapling.ordering.generic import POSITIONS
from testapp.models import NoCustomFieldsOrderedTree
class OrderedTestCase(TestCase):
@classmethod
def setUpTestData(cls):
pass
def test_001_order_upstream(self):
'''
Build the example tree... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import htpc
import cherrypy
import json
import logging
import time
import math
from cherrypy.lib.auth2 import require, member_of
from htpc.helpers import striphttp, sizeof
import requests
from requests.auth import HTTPDigestAuth
class Qbittorrent(object):
session = r... |
"""App entry point."""
from application import create_app
app = create_app()
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)
|
# -:- encoding: UTF8 -:-
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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.ap... |
import pytest
from pydantic import ValidationError
from gmso.core.topology import Topology
from gmso.core.bond import Bond
from gmso.core.atom_type import AtomType
from gmso.core.bond_type import BondType
from gmso.core.atom import Atom
from gmso.tests.base_test import BaseTest
class TestBond(BaseTest):
def tes... |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 b... |
from lr.lib.harvest import harvest
from lr.lib.schema_helper import TombstoneValidator, ResourceDataModelValidator
from lr.tests import *
from lr.util.decorators import ForceCouchDBIndexing, PublishTestDocs, SetFlowControl, ModifiedServiceDoc, update_authz, make_gpg_keys
from lr.util.testdata import getTestDataForRepla... |
import typing
from qtpy import QtCore as QC
from qtpy import QtWidgets as QW
from qtpy import QtGui as QG
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusImageHandling
fr... |
print('Colégio 3 milênio')
print('=================')
nome = input('Digite o nome do aluno: ')
n1 = float(input('Qual a sua primeira nota? '))
n2 = float(input('Qual a sua segunda nota? '))
print('O aluno {}, que tirou {} na primeira prova e {} na segunda, ficou com média {:.2f}'.format(nome, n1, n2, (n1 + n2) / 2))
|
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# 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 la... |
#!/usr/bin/env python2
# Copyright (c) 2014-2020 The Bitcoin Core Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test InvalidateBlock code
#
from test_framework import BitcoinTestFramework
from bitcoinrpc.authprox... |
import io
from typing import Text
import gym
from gym import spaces
from PIL import Image
import numpy as np
import scipy.special
from driving.world import World
from driving.entities import TextEntity, Entity
from driving.agents import Car, Building, Goal
from driving.geometry import Point
from typing import Tuple
im... |
import polygnomeObject
import pureTensor
import tensor
import abstractPolynomial
class tensorAlgebra(polygnomeObject.polygnomeObject):
"""
File: tensorAlgebra.py
Author: Chris Campbell
Email: c (dot) j (dot) campbell (at) ed (dot) ac (dot) uk
Github: https://github.com/campbellC
Description: Th... |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# 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 appli... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2021 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""
export RESET_TEST=true
export TEST_PATH=/tmp/test_persistent
mkdir -p ${TEST_PATH}/bin/{particl,mon... |
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system's.
sys.path.pop(0)
from setuptools import setup
sys.path.append("..")
import sdist_upip
setup(name='micropython-inspect',
version='0.1.2',
description='inspect module for MicroPython',
long... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""AIS Cursor-on-Target Gateway Functions."""
import datetime
import pycot
__author__ = 'Greg Albrecht W2GMD <oss@undef.net>'
__copyright__ = 'Copyright 2020 Orion Labs, Inc.'
__license__ = 'Apache License, Version 2.0'
def ais_to_cot(ais_sentence: dict) -> pycot.Even... |
import logging
import re
from typing import Optional
from semver import VersionInfo
from daktari.check import Check, CheckResult
from daktari.command_utils import get_stderr, run_command
from daktari.os import OS
java_version_pattern = re.compile('^.*version "(.*?)".*$', re.MULTILINE)
javac_version_pattern = re.comp... |
import os
from options.test_options import TestOptions
from data import CreateDataLoader
from models import create_model
from util.visualizer import save_images
from util import html
if __name__ == '__main__':
opt = TestOptions().parse()
opt.nThreads = 1 # test code only supports nThreads = 1
opt.batchS... |
#############################################################################
# Copyright 2016 Mass KonFuzion
#
# 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/l... |
# -*- coding: utf-8 -*-
# vim: ts=2 sw=2 et ai
###############################################################################
# Copyright (c) 2012,2021 Andreas Vogel andreas@wellenvogel.net
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentatio... |
#!/usr/bin/python
# This script takes a username and spits out a list of links to all
# works drawn by that user.
import cgi
import cgitb
from database_tables import DrawingHistory
from webserver_utils import *
def printList(artist):
print "Content-type: text/html"
print
matches = DrawingHistory.select(... |
# License: BSD Style.
from ...utils import verbose
from ..utils import _data_path, _get_version, _version_doc
@verbose
def data_path(path=None, force_update=False, update_path=True, download=True,
verbose=None):
"""
Get path to local copy of the kiloword dataset.
This is the dataset from [... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
actionMap = {'move 1 -2,move 1 -2': 0, 'switch 1,move 1 -2': 1, 'pass,move 1 -2': 2, 'move 1 -2,switch 1': 3, 'switch 1,switch 1': 4, 'pass,switch 1': 5, 'move 1 -2,pass': 6, 'switch 1,pass': 7, 'pass,pass': 8, 'team 1': 9, 'move 2 -2,move 1 -2': 10, 'switch 2,move 1 -2': 11, 'pass,move 2 -2': 12, 'move 2 -2,switch 1':... |
from enum import Enum, auto
class FormatType(Enum):
HTML = auto()
MD = auto()
|
# -------------------------------------------------------------------------------------------------
# system
from PyQuantum.Common.STR import *
import sys
# -------------------------------------------------------------------------------------------------
# BipartiteGeneralLindblad
from PyQuantum.BipartiteGeneralLindbla... |
import idocp
import numpy as np
import math
LF_foot_id = 12
LH_foot_id = 22
RF_foot_id = 32
RH_foot_id = 42
contact_frames = [LF_foot_id, LH_foot_id, RF_foot_id, RH_foot_id]
path_to_urdf = '../anymal_b_simple_description/urdf/anymal.urdf'
baumgarte_time_step = 0.04
robot = idocp.Robot(path_to_urdf, idocp.BaseJointTy... |
"""Tasks for use with Invoke.
(c) 2020-2021 Network To Code
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 t... |
__author__ = 'Blake'
import os
import re
import json
import shutil
from synpost.globals import Values as Globals
import synpost.objects.content as Content
from synpost.objects.action import Action
from synpost.fn.io import collect_files_from, create_folders_from_dict
from synpost.fn.conversions import path_to_asset
... |
import smtplib
import pandas as pd
#Read Emails
e=pd.read_excel('emails.xlsx') #here provide the excel file which is contaning the email addresses.
emails_to_send=e['students'].values #students is the header for the emails.
print(emails_to_send)
#Create and log to server
server = smtplib.SMTP('smtp.gmail.com' , 587) ... |
class AlreadyRegisteredLevel(Exception):
"""Exception to be raised when a Level identifier collision appears
in history at register time"""
pass
class EntrypointDoesNotExist(Exception):
"""Exception to be raised when a queried entrypoint does not exist in
story"""
pass
class EntrypointNotE... |
"""
Python Markdown
A Python implementation of John Gruber's Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (ht... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Recipe, Tag, Ingredient
from recipe.serializers import RecipeSerializer, RecipeDetailSerializer
RECIPES... |
from fibonacci import Fibonacci
def ans():
total = 0
num = 1
while num < 4000000:
if num % 2 == 0:
total += num
num = Fibonacci.after(num)
return total
if __name__ == '__main__':
print(ans())
|
# Lint as: python3
# Copyright 2019, The TensorFlow Federated Authors.
#
# 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 ... |
# Copyright 2019 The OpenRadar Authors. All Rights Reserved.
# 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... |
from flask import Flask
from flask_restx import Api, Resource, fields
import joblib
from model_deployment_proyecto.m09_model_deployment import predict_price
app = Flask(__name__)
api = Api(
app,
version='1.0',
title='Car Prices Prediction API',
description='Car Prices Prediction API')
ns = api.name... |
import pandas as pd
class Reader:
ENGINE = None
@property
def engine(self):
return self.ENGINE.lower() if self.ENGINE else None
def execute(self, query, *ignore, accuracy: bool = False):
raise NotImplementedError("Execute must be implemented on the inherited class")
def _to_df(s... |
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import os
import math
get_ipython().run_line_magic('matplotlib', 'inline')
def grayscale(img):
"""Applies the Grayscale transform
This will return an image with only one color channel... |
#!/usr/bin/env python
# encoding: utf-8
import sys, unittest
from helpers import test
from optparse import OptionError
from hadoop.runner import Runner
class MockJob(object):
def __init__(self):
super(MockJob, self).__init__()
self.actions = []
def get_actions(self):
x = self.actions
self.actio... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic... |
import numpy as np
import cv2, argparse, pickle, sys, PIL.Image
import openmesh as om
from tqdm import trange
sys.path.append("../src/")
from predictor import joint_predictor
from predictor import anchor_predictor
from mesh_edit import fast_deform_dja
from mesh_edit import fast_deform_dsa
from renderer import SMPLRende... |
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import ElementTree,Element
tree = ET.parse("1raw.xml")
root = tree.getroot()
def create_node(tag, property_map, content):
'''新造一个节点
tag:节点标签
property_map:属性及属性值map
co... |
# -*- encoding: utf-8 -*-
'''
@File : test.py
@Time : 2021/07/5 16:47:49
@Author : ShareJing
@Email : yymmjing@gmail.com
@Desc : 测试每一个模块
'''
import takin
"""
测试数据清洗函数
"""
# print(takin.delete_escape_character("Today is sunday.\nwe are \thappy.", lang="en"))
# print(takin.delete_extra... |
import asyncio
import logging
import os
from aidboxpy import AsyncAidboxClient
from fhirpy.base.exceptions import ResourceNotFound
from aiohttp import BasicAuth, ClientSession
from .db import DBProxy
from .db_migrations import sdk_migrations
logger = logging.getLogger('aidbox_sdk')
class SDK(object):
def __init_... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 09:21:40 2018
@author: @gary.allison
This code is used to take ODNR files for Brine disposal fee and
eventually create a file to be used to show overall injection volumes.
The ODNR data have several limitations that we must find and account for:
- data type con... |
""" Advent of code 2021 day 11 / 2 """
from os import path
import math
from functools import reduce
pos = [(-1, 0), (1, 0), (0, -1), (0, 1), (-1, 1), (-1, -1), (1, -1), (1, 1)]
class Code(object):
def __init__(self, lines):
self.lines = lines
self.height = len(lines)
self.width = len(lin... |
from typing import ClassVar, List, Optional
from ...constants import ApiKey, ErrorCode, ResourceType
from ..base import ResponseData
class ConfigSynonym:
config_name: str
config_value: Optional[str]
config_source: int
def __init__(self, config_name: str, config_value: Optional[str], config_source: ... |
# 브루트 포스
N = int(input())
result = 0
for i in range(N):
str_i = str(i)
sum = i
for j in range(len(str_i)):
sum += int(str_i[j])
if(sum == N):
result = i
break
print(result)
|
#! /usr/bin/env python
"""
galaxy_config_merger.py
Created by Anne Pajon on 31 Jan 2012
Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute.
This source file is licensed under the Academic Free License version
3.0 available at http://www.opensource.org/licenses/AFL-3.0.
Permission is hereby granted... |
import json
import random
import numpy as np
SAMPLE = 'SAMPLE' # A sample of ammo breakdowns. Holds up to SAMPLE_SIZE many elements.
SAMPLE_SIZE = 50
RESERVOIR_COUNTER = 'RESERVOIR_COUNTER' # Helper int that is used for "reservoir sampling", single pass fair sampling.
# https://stackoverflow.com/a/47626762
class ... |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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.... |
"""
1. Clarification
2. Possible solutions
- Brute force
- HashSet
3. Coding
4. Tests
"""
# # T=O(mn), S=O(1)
# class Solution:
# def numJewelsInStones(self, jewels: str, stones: str) -> int:
# return sum(s in jewels for s in stones)
# T=O(m+n), S=O(m)
class Solution:
def numJewelsInStones(s... |
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Updates the Fuchsia SDK to the given revision. Should be used in a 'hooks_os'
entry so that it only runs when .gclient's target_os i... |
class AlternateCounty:
def __init__(self, obj):
"""
See "https://smartystreets.com/docs/cloud/us-zipcode-api#zipcodes"
"""
self.county_fips = obj.get('county_fips')
self.county_name = obj.get('county_name')
self.state_abbreviation = obj.get('state_abbreviation')
... |
# Tencent is pleased to support the open source community by making ncnn available.
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the... |
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from care.facility.api.serializers import TIMESTAMP_FIELDS
from care.facility.api.serializers.facility import FacilityBasicInfoSerializer
from care.facility.models import CATEGORY_CHOICES, Facility, PatientRegistration
from ca... |
"""
missing types & inference
"""
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import NaT, iNaT
from .common import (
_NS_DTYPE,
_TD_DTYPE,
ensure_object,
is_bool_dtype,
is_complex_dtype,
... |
#!/usr/bin/env python
from io import open
from setuptools import find_packages, setup
def readall(path):
with open(path, encoding="utf-8") as fp:
return fp.read()
setup(
name="django-debug-toolbar",
version="1.11",
description="A configurable set of panels that display various debug "
... |
#!/usr/bin/env python3
#
# This file is part of LiteDRAM.
#
# Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import xcu1525
fr... |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test running processes.
"""
from __future__ import nested_scopes, generators
from twisted.trial import unittest
from twisted.python import log
import gzip
import os
import popen2
import sys
import signal
import warnings
from ppri... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
"""
Collect fit parameters and plot their values
Calculate stats over full set of stars
Mostly just copied form stats rho stats
"""
from __future__ import print_function, division
import glob
import galsim
import treecorr
import numpy as np
import os
from matplotlib.figure import Figure
from matplotlib.backends.backe... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
from __future__ import print_function, division
import sys
import time
import torch
import pdb
from .util import AverageMeter, accuracy
import math
def train_vanilla(epoch, train_loader, model, criterion, optimizer, opt):
"""vanilla training"""
model.train()
batch_time = AverageMeter()
data_time = Av... |
from sqlalchemy.orm import Session
from ..database.models import BatchSchemeInfo
def get_scheme(db: Session, batch: int) -> int:
"""Obtain Scheme of Given Batch.
Args:
db (Session): SQLAlchemy Database.
batch (int): Batch to be Found.
Raises:
NoResultFound
Returns:
... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
import random
from vehicle import Vehicle
import pdb
class Road(object):
ego_rep = " *** "
ego_key = -1
def __init__(self, speed_limit, traffic_density, lane_speeds, visible_length):
self.visible_length = visible_length
self.num_lanes = len(lane_speeds)
self.lane_speeds = lane_... |
import pandas as pd
import numpy as np
import os
from fire import Fire
from pipeline.tensorflow.Reader import Reader
class Datasets(Reader):
def __init__(self, data_path):
self.data_path = data_path
super(Datasets, self).__init__()
def read(self):
train_file = os.path.join(self.d... |
# Field script for entering Ellinel Fairy Academy
MIDSUMMER_NIGHTS_FOREST_ELLINEL_LAKE_SHORE = 101070000 # MAP ID
sm.invokeAfterDelay(5000, "warp", MIDSUMMER_NIGHTS_FOREST_ELLINEL_LAKE_SHORE, 0)
|
# -*- coding: utf-8 -*-
"""
Restructures the rawFileIndex from PRISM_pyBDP to contain ONLY the science
images, and break those up into individual groups based on changes in
1) OBJECT (object name)
2) FILTER (optical filter value)
3) EXPTIME (the exposure time of the images)
4) BINNING (the 1x1, 2x2, 3x3, or 4x4 binnin... |
import sys
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pathlib
import matplotlib.style as style
import alpha_vantage
import plot_style
def show_variance(symbol, interval='MONTHLY'):
returns = alpha_vantage.get_stock_returns_history(symbol, interval)
variance = np.var(returns)
... |
# Alternative solutions:
# - Get classes names from:
# ~/.keras/models/imagenet_class_index.json
# - Get classes at http://image-net.org/challenges/LSVRC/2014/browse-synsets
import conf
from keras.applications.vgg19 import VGG19
from keras.applications.vgg19 import decode_predictions
import numpy as np
from pprint im... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (3,0,0):
new_instancemethod = lambda func, inst, cls: _BRepBui... |
"""Generate emojione data."""
import os
import json
current_dir = os.path.dirname(os.path.abspath(__file__))
LICENSE = """
MIT license.
Copyright (c) http://www.emojione.com
"""
def get_unicode_alt(value):
"""Get alternate Unicode form or return the original."""
return value['unicode_alt']
def parse(repo,... |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# 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 ... |
from spyne import Application, rpc, ServiceBase, Iterable, Integer, Unicode
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
class HelloWorldService(ServiceBase):
@rpc(Unicode, Integer, _returns=Iterable(Unicode))
def say_hello(ctx, name, times):
"""Docstrings for ... |
""" Unit tests for the Driver base class."""
from __future__ import print_function
from distutils.version import LooseVersion
from six import StringIO
import sys
import unittest
import numpy as np
import openmdao
from openmdao.api import Problem, IndepVarComp, Group, ExecComp, ScipyOptimizeDriver
from openmdao.util... |
#!/usr/bin/env python
"""
Wrapper classes for providing a minimal consistent interface to cheminformatics toolkits
Currently supported toolkits:
* The `OpenEye Toolkit <https://docs.eyesopen.com/toolkits/python/quickstart-python/index.html>`_
* The `RDKit <http://www.rdkit.org/>`_
* `AmberTools <http://ambermd.org/Am... |
# 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 u... |
# Copyright 2020 Audio, Speech and Language Processing Group @ NWPU (Author: Xian Shi)
# Apache 2.0
import codecs
import sys
dict = sys.argv[1]
input = sys.argv[2]
output = sys.argv[3]
unk = sys.argv[4]
warning = sys.argv[5]
unit_name = sys.argv[6]
map = {}
units = []
with codecs.open(dict, 'r', encoding='utf-8') a... |
from sqlalchemy import (
MetaData,
Table,
Column,
Integer,
NVARCHAR,
BOOLEAN,
DateTime,
Date,
)
from sqlalchemy.sql.sqltypes import Boolean
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
t = Table("edge_site_study", meta, autoload=True)
# Drop ... |
#
# (C) Copyright IBM Corp. 2020
#
# 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 writi... |
import threading
import socket
import sys
import struct
import time
import signal
import numpy as np
"""
ArIA control
Actuators : 18 servos
"""
class Aria:
# interrupt handler
def interrupt_handler(self,signal, frame):
print ('You pressed Ctrl+C! Aria will stop in the next 3 seconds ')
if sel... |
#!/usr/bin/env python
'''
gabor_threads.py
=========
Sample demonstrates:
- use of multiple Gabor filter convolutions to get Fractalius-like image effect (http://www.redfieldplugins.com/filterFractalius.htm)
- use of python threading to accelerate the computation
Usage
-----
gabor_threads.py [image filename]
'''
#... |
import os
import argparse
import yaml
# Collects config for all modules
def collect(beat_name, beat_path, full=False):
base_dir = beat_path + "/module"
path = os.path.abspath(base_dir)
# yml file
config_yml = "\n#========================== Modules configuration ============================\n"
... |
import math
from typing import Any
import numpy
import pytest
from optuna._transform import _SearchSpaceTransform
from optuna._transform import _untransform_numerical_param
from optuna.distributions import BaseDistribution
from optuna.distributions import CategoricalDistribution
from optuna.distributions import Float... |
import sys, mood_db
import matplotlib.pyplot as plt
import mplcursors
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon
from pathlib import Path
from datetime import datetime
cur_dir = Path.cwd()
class Canva... |
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data.tokenizers import PretrainedTransformerTokenizer
class TestPretrainedTransformerTokenizer(AllenNlpTestCase):
def test_splits_roberta(self):
tokenizer = PretrainedTransformerTokenizer("roberta-base")
sentence = "A, <mask> Alle... |
"""
Override the app config of the linkcheck app
"""
from linkcheck.apps import LinkcheckConfig
class ModifiedLinkcheckConfig(LinkcheckConfig):
"""
Use the legacy field for automatic primary keys
"""
default_auto_field = "django.db.models.AutoField"
|
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from abc import ABC, abstractmethod, abstractproperty
from datetime import datetime... |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 requir... |
'''Code adapted from https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix'''
import numpy as np
import os
import ntpath
import time
import visdom
from . import visutil as util
from . import html
from make_html import HTML
import os.path as osp
import pdb
from .logger import Logger
# from loguru import logger
from .... |
import logging
import os
import json
import datetime
from rest_framework.views import APIView
from rest_framework.response import Response
from auth_API.helpers import get_or_create_user_information, get_user_information
# Get an instance of a logger
from experiment.models import ExperimentContext
logger = logging.ge... |
#!/user/bin/python
import matplotlib.pyplot as plt
from numpy import *
def readfile(file):
from netCDF4 import MFDataset
return MFDataset(file)
def make_spatial_plot(cmaqvar, x, y, date, m, dpi=None, savename='', levs=arange(0, 100, 10), cmap='YlGnBu'):
fig = plt.figure(figsize=(12, 6), frameon=False)
... |
import json
import logging
import os.path
import re
import webbrowser
from concurrent import futures
from json import JSONDecodeError
from os import path
from time import sleep
from typing import Dict, Optional, List
import boto3
import dpath.util
import requests
import urllib3
from botocore.exceptions import ClientEr... |
"""
Copyright (c) 2022 Intel Corporation
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 writin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.