text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# 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... |
class UndergroundSystem:
def __init__(self):
#checkins[id]={startSation,time}
self.checkins={}
#trips[start+end]={totalduration,count}
self.trips={}
def checkIn(self, id: int, stationName: str, t: int) -> None:
self.checkins[id]=(stationName,t)
def... |
# Copyright (c) 2015 Pavel Roskin <proski@gnu.org>
# Copyright (c) 2015 Steven Myint <hg@stevenmyint.com>
# Copyright (c) 2015 Ionel Cristian Maries <contact@ionelmc.ro>
# Copyright (c) 2015 Rene Zhang <rz99@cornell.edu>
# Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com>
# Licensed under the GPL: https://w... |
# Generated by Django 3.0.8 on 2020-08-19 15:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Continent',
fields=[
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import copy
import gc
import json
import os
import random
import warnings
from collections import defaultdict
from typing import Dict
import matplotlib.pyplot as plt
import scipy.misc
import habitat_sim
import gc
import magnum as mn
import quaternion
from habitat_sim.utils.common import quat_to_magnum, quat_from_magnu... |
import subprocess
import plistlib
factoid = 'build_version'
def fact():
'''Returns the macOS build version'''
result = 'None'
try:
proc = subprocess.Popen(
['/usr/sbin/sysctl', '-n', 'kern.osversion'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
... |
from sqlalchemy import create_engine, Column, String, Integer, Float, Numeric, MetaData, Table, type_coerce, ForeignKey
from sqlalchemy.orm import mapper, create_session, relationship
from sqlalchemy.ext.declarative import declarative_base
import sqlalchemy.types as types
import re
import os
import glob
def main():
... |
"""Reducing Functions in Python
Tjh
""" |
# Lint as: python3
"""Setup script for beam pipeline."""
import setuptools
REQUIRED_PACKAGES = [
"absl-py==0.9.0",
"gin-config==0.3.0",
"numpy==1.18.3",
"tensorstore==0.1.1"
]
PY_MODULES = [
"compute_dfbyf",
"compute_percentiles",
"reshard_tensor"
]
setuptools.setup(
name="tensorstore... |
# pylint: disable=g-bad-file-header
# Copyright 2016 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/LICENS... |
import numpy as np
import os
# Initialize directories
env_MEDIA_DIR = os.getenv("MEDIA_DIR")
if env_MEDIA_DIR:
MEDIA_DIR = env_MEDIA_DIR
elif os.path.isfile("media_dir.txt"):
with open("media_dir.txt", 'rU') as media_file:
MEDIA_DIR = media_file.readline().strip()
else:
MEDIA_DIR = os.path.join(
... |
"""
Example to load and save images using argparse
"""
# Import the required packages
import argparse
import cv2
# We first create the ArgumentParser object
# The created object 'parser' will have the necessary information
# to parse the command-line arguments into data types.
parser = argparse.ArgumentParser()
# Ad... |
#!/usr/bin/env python
# coding: utf-8
import os,sys
import glob
from collections import OrderedDict,defaultdict
import pipes
import pprint
import tempfile
import re
import argparse
import gc
#from pyfaidx import Fasta
def get_genome_sequence(fa_file):
f = open(fa_file,"r")
line = f.readline()
line = line.... |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Particl Core developers
# Copyright (c) 2020 The Falcon Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_particl import ParticlTestFramew... |
from flask import Blueprint, flash, redirect, abort
from libs.admin_authentication import authenticate_admin_study_access
from pipeline.boto_helpers import get_aws_object_names
from pipeline.index import create_one_job, refresh_data_access_credentials
data_pipeline_api = Blueprint('data_pipeline_api', __name_... |
# 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... |
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Graph(Component):
"""A Graph component.
Keyword arguments:
- id (string; optional): The ID of this component, used to identify dash components
in callbacks. The ID needs to be unique across all of... |
#!/usr/bin/env python
import re
import requests
import json
import math
from bs4 import BeautifulSoup
location = raw_input("Enter your address [Blank to use ip address] ")
if location == '':
loc = requests.get("http://freegeoip.net/json/").text.strip()
loc = json.loads(loc)
lat = loc['latitude']
lon = loc['long... |
import logging
import math
import os
import _pickle as cPickle
import cv2
import numpy as np
import torch
from tqdm import tqdm
def align_rotation(sRT):
""" Align rotations for symmetric objects.
Args:
sRT: 4 x 4
"""
s = np.cbrt(np.linalg.det(sRT[:3, :3])) # det求行列式, cbrt求element-wise立方根
... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... |
import unittest
import numpy
from six import moves
from chainer import cuda
from chainer import testing
from chainer.testing import attr
from chainer.utils import conv
class TestConv(unittest.TestCase):
def check_conv_outsize(self, size, k, s, p, d):
# When cover_all == False, `outsize` is the maximum ... |
#
# Handler library for Linux IaaS
#
# Copyright 2014 Microsoft 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 requi... |
#!/bin/python3
# author: Jan Hybs
class Singleton(type):
"""
Singleton metaclass pattern
A metaclass is the class of a class; that is, a class is an instance of its metaclass
https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
"""
_instances = {}
def __call__(cls, ... |
import numpy as np
import datetime
from datetime import timedelta
import sys
import os
import pickle
#debug_logs_directory = r'C:\PROJECTS\TEMP'
# Based on QA Band - https://landsat.usgs.gov/collectionqualityband
QA_BAND_NUM = 7
landsat_5_clear_pix_vals = [672, 676, 680, 684]
#landsat_8_clear_pix_vals = [2720, 2724... |
import base64
import json
import os
import pytest
import random
import signal
import socket
import time
from contextlib import contextmanager
from typing import Dict, Any, Optional, Union, List
import requests
import yaml
import dbt.flags
from dbt.adapters.factory import get_adapter, register_adapter
from dbt.logger ... |
# 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... |
# -*- coding: utf-8 -*-
# @Time : 2020/10/18 12:39
# @Author : ooooo
from typing import *
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> Lis... |
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.30
Contact: customer_support@bmc.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from clients.ctm... |
from struct import pack, unpack
import hashlib
import sys
import traceback
from electrum import ecc
from electrum.bitcoin import TYPE_ADDRESS, int_to_hex, var_int, is_segwit_script_type
from electrum.bip32 import BIP32Node
from electrum.i18n import _
from electrum.keystore import Hardware_KeyStore
from electrum.transa... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Google Chrome autofill entries database plugin."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import chrome_autofill as _ # pylint: disable=unused-import
from plaso.lib import definitions
from plaso.parsers.sqlite_plu... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from ...ops.iou3d_nms import iou3d_nms_utils
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...ops.pointnet2.pointnet2_batch import pointnet2_modules
from ...utils import box_coder_utils, box_utils, common_utils, loss_... |
# Copyright 2015 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... |
# SPDX-License-Identifier: Apache-2.0
import warnings
from uuid import uuid4
from .proto import get_latest_tested_opset_version
from .common._topology import convert_topology
from .common.utils_sklearn import _process_options
from ._parse import parse_sklearn_model
# Invoke the registration of all our converters and ... |
# Copyright 2019 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.
from blinkpy.common.host_mock import MockHost
from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.w3c.gerrit_mock import MockGerritAPI... |
from __future__ import division
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from Model import *
from Utils.Estimation import Estimation
import Utils
class NADE(Model):
"""A NADE abstract class"""
def __init__(self, n_visible, n_hidden... |
import click
from flask.cli import with_appcontext
from .models import db, User, OAuth
@click.command(name="createdb")
@with_appcontext
def create_db():
db.create_all()
db.session.commit()
print("Database tables created")
def shell_context_processor():
return {"db": db, "User": User, "OAuth": OAuth}... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Dtrun3(Package):
"""Simple package which acts as a run dependency"""
homepage = "http... |
#! /usr/bin/env python3
""" Gets the census block code for a given set of coordinates.
This makes use of the FCC census block lookup API, which takes
a (lat,lon) point at outputs some XML with information
about that position.
This does not support multithreading to make sure that it does
not overload anything. The l... |
r"""
Check for phitigra
"""
from . import PythonModule
class Phitigra(PythonModule):
r"""
A :class:`sage.features.Feature` describing the presence of phitigra.
Phitigra is provided by an optional package in the Sage distribution.
EXAMPLES::
sage: from sage.features.phitigra import Phitigra
... |
import argparse
import cPickle
import h5py
import json
import numpy as np
import os
from policy_network import PolicyNetwork
from dataloader import DataLoader
import tensorflow as tf
import time
from rllab import config
import ipdb
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--save_di... |
print("""You enter a dark room with two doors.
Do you go through door #1 or door #2?""")
door = input( "> ")
if door == "1":
print("There's a giant bear here eating a cheese cake.")
print("What do you do?")
print("1. Take the cake.")
print("2. Scream at the bear.")
bear = input("> ")
if b... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from flask import render_template, session, request
def render(file_name : str, **kwargs) -> str:
"""
Render a Jinja template, given with a few basis variables
as context to know better how to render the template.
"""
values = {
'logged_in' : 'user' in session and session['use... |
from assemblyline_core.metrics.metrics_server import HeartbeatManager
from assemblyline.common import forge
if __name__ == '__main__':
config = forge.get_config()
with HeartbeatManager(config=config) as metricsd:
metricsd.serve_forever()
|
# -*- coding: utf-8 -*-
import os
from setuptools import setup # type: ignore
VERSION = '4.2.1'
setup(
name='conllu',
packages=["conllu"],
package_data={
"": ["py.typed"]
},
version=VERSION,
description='CoNLL-U Parser parses a CoNLL-U formatted string into a nested python dictionary... |
# -*- coding: UTF-8 -*-
import torch
import torch.nn as nn
import numpy as np
from torch.nn.utils import clip_grad_norm_
# RNN语言模型
class RNN(nn.Module): #RNNLM类继承nn.Module类
def __init__(self, vocab_size, embed_size, hidden_size, num_layers):
super(RNN, self).__init__()
#嵌入层 one-hot形式(vocab_size,1... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'OA.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ... |
""" This file contains defines parameters for dipy that we use to fill
settings in setup.py, the dipy top-level docstring, and for building the
docs. In setup.py in particular, we exec this file, so it cannot import dipy
"""
# dipy version information. An empty _version_extra corresponds to a
# full release. '.dev'... |
from django.conf import settings
from django.db import models
from django.core.urlresolvers import reverse
from restaurants.models import RestaurantLocation
class Item(models.Model):
# associations
user = models.ForeignKey(settings.AUTH_USER_MODEL)
restaurant = models.ForeignKey(Restaurant... |
#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... |
from flask import Flask
from redis import Redis, RedisError
import os
import socket
# Connect to Redis
redis = Redis(host="redis", db=0, socket_connect_timeout=2, socket_timeout=2)
app = Flask(__name__)
@app.route("/")
def hello():
try:
visits = redis.incr("counter")
except RedisError:
visits... |
from telethon.sync import TelegramClient
from multiprocessing import Process
from binance_listing import BinanceListing
from supertrend import SuperTrend
import local
def run_in_parallel(*fns):
proc = []
for fn in fns:
p = Process(target=fn)
p.start()
proc.append(p)
for p in proc:
... |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import pytest
from pants.engine.fs import EMPTY_DIGEST, CreateDigest, Digest, DigestContents, FileContent
from pants.engine.internals.scheduler import ExecutionError
from pants... |
# Copyright 2018 AT&T Intellectual Property. All other 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... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# metadata
'''
Load metadata (DocType) class
Example:
meta = frappe.get_meta('User')
if meta.has_field('first_name'):
print "DocType" table has field "first_name"
'''
from __future__ import unicode_literals
im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (С) ABBYY (BIT Software), 1993 - 2019. All rights reserved.
"""
Все что связано с callbacks для обучения и валидации
"""
import os
import keras.backend as K
import tensorflow as tf
from keras import callbacks
from keras.callbacks import ModelCheckpoint, ReduceLROnP... |
from setuptools import setup, find_packages
from os import path
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Financial and Crypto",
"Programming Language :: Python",
"Operating System :: OS Independent",
"Natural Language :: English",
"License :: MIT License",
"Pr... |
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
"""
Global Logger config dictionary used by all loggers (in their own subkeys)
"""
import logging
import structlog
LOGGERNAME = "decisionengine"
DELOGGER_CHANNEL_NAME = "engine"
# name of loggers for all channels
# not... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
"""
Field types
"""
FIELD_TYPE_DECIMAL = 0x00
FIELD_TYPE_TINY = 0x01
FIELD_TYPE_SHORT = 0x02
FIELD_TYPE_LONG = 0x03
FIELD_TYPE_FLOAT = 0x04
FIELD_TYPE_DOUBLE = 0x05
FIELD_TYPE_NULL = 0x06
FIELD_TYPE_TIMESTAMP = 0x07
FIELD_TYPE_LONGLONG = 0x08
FIELD_TYPE_INT24 = 0x09
FIELD_TYPE_DATE = 0x0a
FIELD_TYPE_TIME = 0x0b
FIELD_... |
"""
"""
from ray import tune
from collections import OrderedDict
from mdp_playground.config_processor import *
num_seeds = 5
timesteps_total = 3000000
var_env_configs = OrderedDict(
{
"irr_state_space_dim": [
2,
4,
8,
16,
32,
],
"... |
from numpy import empty as npempty
from numpy import int8 as npint8
from numpy import stack as npstack
from numpy import squeeze as npsqueeze
from numpy import where as npwhere
from numpy import absolute as npabsolute
from numpy import shape as npshape
from astropy.io import fits
import re
import sys
from gethdrinfo im... |
"""
File contains functions used to traing Logistic Regression.
Author: Dominik Macko
"""
from typing import Dict, Any, Union, Callable, Tuple, Optional
import numpy as np
import pandas as pd
#from sklearn.linear_model import LogisticRegression
# this should be then easier to interpret - just a simple scikit-learn w... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RBit(RPackage):
""" A class for vectors of 1-bit booleans."""
homepage = "https://clo... |
from flask import redirect, request
from webViews.dockletrequest import dockletRequest
from webViews.view import normalView
import json
class grouplistView(normalView):
template_path = "user/grouplist.html"
class groupdetailView(normalView):
@classmethod
def post(self):
return json.dumps(dockletRe... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 1998-2018 by authors (see AUTHORS.txt)
#
# This file is part of LuxCoreRender.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... |
# Copyright (c) 2015
#
# All rights reserved.
#
# This file is distributed under the Clear BSD license.
# The full text can be found in LICENSE in the root directory.
import rootfs_boot
from devices import board, wan, lan, wlan, prompt
class SNMPSysDescrWAN(rootfs_boot.RootFSBootTest):
'''Runs SNMP sysDescr on WA... |
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize("HMP_EMP_ObsPred.pyx"))
|
import re
def cjk_detect(texts):
# korean
if re.search("[\uac00-\ud7a3]", texts):
return "ko"
# japanese
if re.search("[\u3040-\u30ff]", texts):
return "ja"
# chinese
if re.search("[\u4e00-\u9FFF]", texts):
return "zh"
return None
|
# 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
from ... import _utilities, _tables
from... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from .messages import msg_getheaders, msg_headers, CBlockHeader
from .mininode import P2PInterface, minin... |
import pytest
from aos_sw_api import IpAddress
from aos_sw_api.enums import IpAddressVersionEnum, TimeServerProtocolEnum
def test_get_system_client(client):
print(client.system.get_system())
def test_update_system_client(client):
test_location = "hej"
old_system = client.system.get_system()
client.... |
"""
Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
from packaging import version
from sklearn.cross_decomposition import PLSRegression as pls
from smt.surrogate_models.krg_based import KrgBased
from smt.utils.kriging_utils import compone... |
#what is the point of this file here?
|
# Autogenerated constants for HID Joystick service
from jacdac.constants import *
JD_SERVICE_CLASS_HID_JOYSTICK = const(0x1a112155)
JD_HID_JOYSTICK_REG_BUTTON_COUNT = const(0x180)
JD_HID_JOYSTICK_REG_BUTTONS_ANALOG = const(0x181)
JD_HID_JOYSTICK_REG_AXIS_COUNT = const(0x182)
JD_HID_JOYSTICK_CMD_SET_BUTTONS = const(0x80... |
import os
from time import gmtime, strftime
DEBUG=0
INFO=1
WARN=2
ERROR=3
LEVEL = DEBUG
_idx2str = ['D', 'I', 'W', 'E']
get_logger = lambda x:Logger(x)
class Logger():
def __init__(self, name='') -> None:
self.name = name
if self.name != '':
self.name = '[' + self.name + ']'
... |
# -*- coding: utf-8 -*-
import sys
sys.path.append('..')
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
import features.build_features as buif
@click.command()
@click.argument('input_filepa... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-23 01:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('datasource', '0001_initial'),
]
operations = [
migrations.AlterUniqueTogether(
... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
import logging
from datetime import timedelta
from ngenicpy.models.measurement import MeasurementType
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE,
HV... |
import numpy as np
def compute_cost_with_regularization_test_case():
np.random.seed(1)
Y_assess = np.array([[1, 1, 0, 1, 0]])
W1 = np.random.randn(2, 3)
b1 = np.random.randn(2, 1)
W2 = np.random.randn(3, 2)
b2 = np.random.randn(3, 1)
W3 = np.random.randn(1, 3)
b3 = np.random.r... |
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
""" Defines constants for named column indices to gencost matrix.
Some examples of usage, after defining the constants using the line above,
are::
start = ge... |
import sys
import os
import math
import time
sys.path.append(os.path.join(os.getcwd() , "lib"))
import Leap
import pickle
from sound_player import SoundPlayer
import qdarkstyle
SOUND_FILES_PATH = os.path.join(os.getcwd() , "sound_files")
class SampleListener(Leap.Listener):
__current_frame_counter = 0
__cupture... |
commands = []
inr = "inr"
dcr = "dcr"
cma = "cma"
daa = "daa"
nop = "nop"
mov = "mov"
stax = "stax"
ldax = "ldax"
add = "add"
adc = "adc"
sub = "sub"
sbb = "sbb"
ana = "ana"
xra = "xra"
ora = "ora"
cmp = "cmp"
rlc = "rlc"
rrc = "rrc"
ral = "ral"
rar = "rar"
sta = "sta"
lda = "lda"
shld = "shld"
lhld = "lhld"
cmc... |
from libcity.data import get_dataset
from libcity.utils import get_logger, get_executor, get_model
if __name__ == '__main__':
config = {
'log_level': 'INFO',
'input_window': 12,
'output_window': 12,
'train_rate': 0.7,
'eval_rate': 0.1,
'cache_dataset': True,
... |
'''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data, make sure your corpus
has at le... |
import matplotlib.pyplot as plt
# Objects included in this file:
# Functions included in this file:
# # plot_empty (mpl)
def plot_empty(xlabel=None, ylabel=None,
title=None,
figsize=(8, 5)):
"""Initialize fig object for seaborns objects that do not include fig by default
"""
... |
# -*- coding: utf-8 -*-
# Copyright 2015-2021 CERN
#
# 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 a... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import tensorflow as tf
import os
import time
def make_training_data():
n_samples = 500 #Number of training data samples
n_inputs = 2 #Number of input parameters
n_out... |
# HEAD
# Modules - Understanding and using import key with file module
# DESCRIPTION
# Describes usage of import statements
# and using a file function as a import
# RESOURCES
#
# main module since no __name__ has been specified
# Using multiple specific imports instead of *
# Will only make the following ava... |
#################################################################
# File name: ex008 #
# Author: Leonardo Almeida #
# GitHub: leo_nardow #
########################################################... |
# 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 typing import List
from gym.spaces import Space
from gym.spaces import Tuple as GymTuple
class Tuple(GymTuple):
"""A tuple (i.e., p... |
import os, sys
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import sa_utils
import netgen_csg
import numpy as np
if __name__ == '__main__':
prefix = 'oht_8layers_3patches'
logger = sa_utils.LogWrapper(prefix+'/'+prefix)
netgen_csg.create_patches(box = np.array([0., 0., ... |
"""we_slam_32294 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... |
from chainer_chemistry.training.extensions import batch_evaluator # NOQA
from chainer_chemistry.training.extensions import r2_score_evaluator # NOQA
from chainer_chemistry.training.extensions import roc_auc_evaluator # NOQA
# import class and function
from chainer_chemistry.training.extensions.batch_evaluator impor... |
#
# Copyright (c) 2008-2016 Citrix Systems, 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 l... |
from fastapi import status, HTTPException, Depends, APIRouter
from app import schemas, models, utils, oauth2
from sqlalchemy.orm import Session
from fastapi.security.oauth2 import OAuth2PasswordRequestForm
from app.dbconn import get_db
router = APIRouter(
prefix="/login",
tags=["Authentication"]
)
@router.pos... |
"""Diagnostics support for Omnik Inverter integration."""
from __future__ import annotations
from dataclasses import asdict
from typing import Any
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_IP_... |
'''
AUTHOR:
Akshit (Axe) Soota
VERSION: 1.0
Class to convert a list of LatLng pairs into Encoded Polyline Algorithm Format
Steps follow the guide at:
https://developers.google.com/maps/documentation/utilities/polylinealgorithm
'''
class PolylineEncoder:
def twosComplement(self, number):
if numbe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.