text stringlengths 2 999k |
|---|
# Copyright 2018 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 by applicable law or a... |
from genie.ops.base import Base
class Lisp(Base):
exclude = [] |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 the rights to use, copy, modify, merge, publish,
... |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from Qubit import Qubit
sns.set(font_scale=1)
sns.set_style("whitegrid", {"font.family": "serif"})
plt.rcParams["figure.dpi"]=100
plt.rcParams["savefig.bbox"]='tight'
plt.rcParams["savefig.transparent"]=True
def frequency(qubit,detuning,Bfield):... |
# -*- coding: utf-8 -*-
"""
Exercise 1: A neurofeedback interface (single-channel)
======================================================
Description:
In this exercise, we'll try and play around with a simple interface that
receives EEG from one electrode, computes standard frequency band powers
and displays both the ... |
from collections import Counter
import aiohttp
import asyncio
import functools
import json
import time
from pprint import pprint
from typing import List, Dict, Optional, Callable
from xcha.cmds.wallet_funcs import print_balance, wallet_coin_unit
from xcha.pools.pool_wallet_info import PoolWalletInfo, PoolSingletonSt... |
import unittest
import os
import pytest
import testinfra.utils.ansible_runner
class TestIntermediateSetup(unittest.TestCase):
def setUp(self):
self.host = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_host('instance')
@pytest.mark.parametrize('fi... |
import numpy as np
import matplotlib.pyplot as plt
# 本代码用于产生四路sin信号,并对其中的三路信号进行了延迟
fs = 1e6 # 正弦信号1MHz
Fs = 256e6 # 采样率256MHz
adc_t = 1 / Fs
A = 1 # 幅度
N = 1024 # 序列长度
t = np.arange(0, N)
d1 = 20 # 延后点数
d2 = 60
d3 = 150
x1 = A * np.cos(2 * np.pi * fs * t * adc_t) # 源信号
x2 = A * np.cos(2 * np.pi * fs * (t + d... |
# 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... |
# Old fashion way to tile perfect jacobi loop nest with time step
# using unimodular transformation.
from chill import *
source('jacobi_simple.c')
destination('jacobi_simplemodified.c')
procedure('jacobi')
loop(0)
print_dep()
nonsingular([[1,0],[1,1]]) # unimodular matrix, determinant is one
tile(0,2,64)
print_co... |
import json
from configparser import ConfigParser
from parse import parse
from pathlib import Path
from flask import Flask, render_template, request, redirect, flash, url_for
from pymongo import MongoClient
app = Flask(__name__)
app.secret_key = "5b52c330e091daea8979d94b3cbf6e4ff9f43fdf685787c8"
config = ConfigParser(... |
"""
Copyright (c) 2021, Russell Wallace Butler
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
import traceback as tb
from dataclasses import dataclass
import re as re
import numpy as np
it_function_dict = {}
cla... |
# pylama:ignore=W0611
from .DataContainer import DataContainer
from .DataParams import DataParams
from .DataBundle import DataBundle
from .utils import split_df
|
from nipype.pipeline.engine import Node, Workflow
import nipype.interfaces.utility as util
import nipype.interfaces.fsl as fsl
import nipype.interfaces.io as nio
import sys
'''
Concatenating all 4 lsd runs of a subject
==========================================
'''
subject_id=sys.argv[1]
# local base and output dir... |
# A time delay class for the micropython board. Based on the scheduler class. 24th Aug 2014
# Author: Peter Hinch
# V1.0 25th Aug 2014
# Used by Pushbutton library.
# This class implements the software equivalent of a retriggerable monostable. When first instantiated
# a delay object does nothing until it trigger metho... |
from __future__ import division, print_function, absolute_import
from itertools import groupby
from warnings import warn
import numpy as np
from scipy.sparse import find, coo_matrix
EPS = np.finfo(float).eps
def validate_max_step(max_step):
"""Assert that max_Step is valid and return it."""
if max_step <= 0... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
remove_end,
)
class MailRuIE(InfoExtractor):
IE_NAME = 'mailru'
IE_DESC = 'Видео@Mail.Ru'
_VALID_URL = r'https?://(?:(?:www|m)\.)?my\.mail\.ru/(?:video/.*#video=... |
"""
This file implements the smooth gating/split function including the linear
combination of features. If given, the features are sent through a non linear
module first, which may also be optimized thanks to autograd..
"""
import torch.nn as nn
class Gate(nn.Module):
def __init__(self, input_size, initial_steepness... |
from setuptools import setup, find_packages
setup(
name='weaveenv',
version='0.8',
author='Srivatsan Iyer',
author_email='supersaiyanmode.rox@gmail.com',
packages=find_packages(),
license='MIT',
description='HomeWeave Environment',
long_description=open('README.md').read(),
install_... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v0/proto/resources/campaign_feed.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
fr... |
import math
from typing import Union
import uuid
from django.db import models
import directory.models as directory_models
class Application(models.Model):
"""
Модель rest приложений для безопасного доступа по ключам
"""
PLACES_FRACTION = 'fraction'
PLACES_APP = 'app'
PLACES_BOTH_MIN = 'both... |
# lc671.py
# LeetCode 671. Second Minimum Node In a Binary Tree `E`
# acc | 99% | 42'
# A~0g22
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def findSe... |
import numpy as np
import torch
import torch.nn.functional as F
from torch.autograd import Variable
def cross_entropy_2d(predict, target):
"""
Args:
predict:(n, c, h, w)
target:(n, h, w)
"""
assert not target.requires_grad
assert predict.dim() == 4
assert target.dim() == 3
... |
#!/usr/local/bin/python
"""
Naive strategy methods
"""
import numpy as np
from driver_utils import *
from uncertainty_utils import *
def build_naive_strategy(self, city_attributes):
for b in reversed(xrange(self.B)):
for i in xrange(len(self.city_zones)):
action_cumulative_earnings = {}
... |
"""
Convert *.mov files to *.gif format
"""
import argparse
from pymov2gif.convert import convert
def command_line_parser():
"""
Main function primarly used for the command line interface
"""
parser = argparse.ArgumentParser(prog="pymov2gif")
parser.add_argument(
"file",
help="Vide... |
import json
class ConfigParser:
@staticmethod
def read(config_file):
return json.load(open(config_file))
@staticmethod
def parse_configs(*files):
res = []
for file_ in files:
res.append(ConfigParser.read(file_))
return res
|
from hummingbot.core.api_throttler.data_types import RateLimit, LinkedLimitWeightPair
KRAKEN_TO_HB_MAP = {
"XBT": "BTC",
"XDG": "DOGE",
}
BASE_URL = "https://api.kraken.com"
TICKER_PATH_URL = "/0/public/Ticker"
SNAPSHOT_PATH_URL = "/0/public/Depth"
ASSET_PAIRS_PATH_URL = "/0/public/AssetPairs"
TIME_PATH_URL =... |
"""
Created by prakash at 02/03/22
"""
__author__ = 'Purushot14'
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="user-agent-parser", # This is the name of the package
version="0.1.1",
author="Purushot14", # Full name of the author
au... |
import o3seespy as o3 # for testing only
import pytest
@pytest.mark.skip()
def test_pfem_element_bubble():
osi = o3.OpenSeesInstance(ndm=2)
coords = [[0, 0], [1, 0], [1, 1], [0, 1]]
ele_nodes = [o3.node.Node(osi, *coords[x]) for x in range(4)]
o3.element.PFEMElementBubble(osi, ele_nodes, rho=1.0, mu=... |
# Generated by Django 3.0.7 on 2020-06-28 17:51
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='UserProfile',
... |
import torch
import torch.nn as nn
class CharbonnierLoss(nn.Module):
"""Charbonnier Loss (L1)"""
def __init__(self, eps=1e-6):
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forward(self, x, y):
diff = x - y
loss = torch.sum(torch.sqrt(diff * diff + self.eps))... |
#!/usr/bin/env python
u"""
interp_sea_level_ICESat2_ATL11.py
Written by Tyler Sutterley (10/2021)
Interpolates sea level anomalies (sla), absolute dynamic topography (adt) and
mean dynamic topography (mdt) to times and locations of ICESat-2 ATL11 data
This data will be extrapolated onto land points
(masking... |
"""generate_user_tables
Revision ID: 47e4599484a1
Revises: 89edb69f4be3
Create Date: 2018-05-10 21:33:01.943092
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '47e4599484a1'
down_revision = '89edb69f4be3'
branch_labels = None
depends_on = None
def upgrade():... |
class Point:
def __init__(self, x, y, z):
self.__x, self.__y, self.__z = x, y, z
def getx(self): return self.__x
def gety(self): return self.__y
def getz(self): return self.__z
def setx(self, x): self.__x = x
def sety(self, y): self.__y = y
def setz(self, z):... |
from __future__ import absolute_import
import os
import pandas as pd
from pytest import fixture
@fixture
def simple_df():
return pd.DataFrame(data=[[1, 1], [2, 2]], columns=["c1", "c2"])
@fixture
def pandas_data_frame():
names = ["Bob", "Jessica", "Mary", "John", "Mel"]
births = [968, 155, 77, 578, 9... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'designer/main_window.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
... |
from graphql.core.language.location import SourceLocation
from graphql.core.validation.rules import DefaultValuesOfCorrectType
from utils import expect_passes_rule, expect_fails_rule
def default_for_non_null_arg(var_name, type_name, guess_type_name, line, column):
return {
'message': DefaultValuesOfCorrec... |
#!/usr/bin/env python3
import argparse
import logging
import os
from typing import Tuple
import torch
import torchaudio
from torchaudio.models.wav2vec2.utils.import_huggingface import import_huggingface_model
from greedy_decoder import Decoder
TORCH_VERSION: Tuple[int, ...] = tuple(int(x) for x in torch.__version__.s... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "IcwProject.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. A... |
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using PostgreSQL."""
import unittest
# Really do want "import *" to get all the test clases:
from common_BioSQL import * # noqa:... |
from .class_names import get_classes, get_palette
from .eval_hooks import DistEvalHook, EvalHook
from .metrics import eval_metrics, mean_dice, mean_fscore, mean_iou
__all__ = [
'EvalHook', 'DistEvalHook', 'mean_dice', 'mean_iou', 'mean_fscore',
'eval_metrics', 'get_classes', 'get_palette'
]
|
#!/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... |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.afilias-grs.info/gi/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser i... |
"""Support for Tile device trackers."""
import logging
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import ATTR_ATTRIBUTION, CONF_P... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import json
import os
import time
import threading
from data_visualization.chartjs import chart_types
basedir = (os.path.dirname(os.path.realpath(__file__)))
data_definitions_dir = os.path.join(basedir, 'data_definitions')
class DataType(object):
def __init__(self, _... |
import pandas as pd
from Bio import SeqIO
from Bio import Seq
from Bio.SeqUtils import CodonUsage as CU
from Bio.Alphabet import generic_dna
import seaborn as sns
import numpy as np
import scipy as sp
import math
CodonsDict = {
'TTT': 0, 'TTC': 0, 'TTA': 0, 'TTG': 0, 'CTT': 0,
'CTC': 0, 'CTA': 0, 'CTG... |
# Copyright 2017 Google 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,... |
# -*- coding: utf-8 -*-
"""
esp_new
mantém as informações sobre um espera
revision 0.2 2015/nov mlabru
pep8 style conventions
revision 0.1 2014/nov mlabru
initial release (Linux/Python)
"""
# < imports >--------------------------------------------------------------------------------------
# python library
impor... |
import os
import sys
import time
def using_yolov5(phone_ip: str): # string.
# C:\Users\1\Desktop\wica\tools\yolo\yolov5-master\yolov5-master>python detect.py --source http://admin:admin@192.168.0.104:8081
"""
phone_ip -> the ip of the phone.
using the yolov5(through the phone camera...)
return no... |
#encoding: utf-8
from django.contrib import admin
from accounts.models import User, Profile, PasswordReset, Account
admin.site.register(User)
admin.site.register(Profile)
admin.site.register(PasswordReset)
admin.site.register(Account) |
# 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 RCorpcor(RPackage):
"""Efficient Estimation of Covariance and (Partial) Correlation"""
... |
import threading
import logging
from api.http import app
from collector.basic import basic_collect
from collector.iis import iis_collect
from collector.sqlserver import sqlserver_collect
from collector.reporter import status_report
run_period = 60
class APIThread(threading.Thread):
'''
http se... |
#!/usr/bin/env python
from distutils.core import setup
config = {}
setup(**config)
|
from sympy.concrete.summations import Sum
from sympy.core.exprtools import gcd_terms
from sympy.core.function import (diff, expand)
from sympy.core.relational import Eq
from sympy.core.symbol import (Dummy, Symbol, Str)
from sympy.functions.special.tensor_functions import KroneckerDelta
from sympy.matrices.dense ... |
'''
Created on 15 Sep 2017
@author: gavin
'''
from .basehandler import TcpHandler
class netbios(TcpHandler):
NAME = "NetBIOS Session"
DESCRIPTION = '''Responds to NetBIOS session requests. To be used along side SMB handler.'''
CONFIG = {}
def __init__(self, *args):
'''
Constructor... |
#!/usr/bin/python
#
# Copyright 2015 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... |
"""
Uses the seismic package from Fatiando to create 2D finite difference
models for wave propogation in different velocity fields.
The BP velocity model is 67km long and 12km deep, and was built on a 6.25m x 12.5m grid.
In order for Fatiando to work the cells have to be square so I ignore this.
http://softwar... |
# -*- 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... |
from __future__ import annotations
import asyncio
from typing import Any, AnyStr, Awaitable, Callable, Dict, Generator, NoReturn, Optional, overload
from hypercorn.typing import HTTPScope
from werkzeug.datastructures import CombinedMultiDict, Headers, MultiDict
from werkzeug.exceptions import BadRequest, RequestEntit... |
"""
Optuna example that optimizes multi-layer perceptrons using Tensorflow (Eager Execution).
In this example, we optimize the validation accuracy of hand-written digit recognition using
Tensorflow and MNIST. We optimize the neural network architecture as well as the optimizer
configuration.
"""
from packaging impor... |
# Copyright 2015 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 by applicable law or ag... |
# coding: utf-8
"""
NiFi Rest Api
The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ... |
# Copyright (C) 2008 Valmantas Paliksa <walmis at balticum-tv dot lt>
# Copyright (C) 2008 Tadas Dailyda <tadas at dailyda dot com>
#
# Licensed under the GNU General Public License Version 3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
#!/usr/bin/env python
# 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
# "Li... |
import datetime
from context_manager.db_context_manager import DBContextManager
from util.constants import QUERIES
def export_results(data, controller_name, trajectory_name, database_path):
def get_table_name(controller, trajectory, date_time):
return '_'.join([controller,
trajec... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2022 Nobuo Tsukamoto
This software is released under the MIT License.
See the LICENSE file in the project root for more information.
"""
from absl.testing import absltest
from absl.testing import parameterized
import jax
from jax import num... |
import os
import json
import re
from PyQt5.QtCore import Qt
from PyQt5 import QtWidgets
from PyQt5 import QtCore
from PyQt5 import QtGui
def _convertDataToColor(data=None, alternate=False, av=20):
"""
Convert a list of 3 (rgb) or 4(rgba) values from the configuration
file into a QColor.
:param data:... |
# -*- coding: utf-8 -*-
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 require... |
#!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
import requests
from xml.dom import minidom
import json
import os
import re
from flask import Fl... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
_base_ = 'base.py'
# optimizer
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001,
paramwise_options={'\Ahead.': dict(lr_mult=100)})
|
'''
* Project : Screenipy
* Author : Pranjal Joshi, Swar Patel
* Created : 18/05/2021
* Description : Class for managing multiprocessing
'''
import multiprocessing
import pandas as pd
import numpy as np
import sys
import os
import pytz
from queue import Emp... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class ConnectionAssociation(pulumi.Cu... |
import mock
import tornado.web
from shelter.core.config import Config
from shelter.core.web import BaseRequestHandler, NullHandler
def test_base_request_handler():
app = tornado.web.Application([], context=1, interface=2)
req = mock.Mock()
h = BaseRequestHandler(app, req)
assert h.context == 1
... |
"""
This module lets you practice one form of the ACCUMULATOR pattern,
namely, the "IN GRAPHICS" form which features:
-- DRAWING OBJECTS via ACCUMULATING positions and/or sizes,
as in: x = x + pixels
Additionally, it emphasizes that you must
** DO A CONCRETE EXAMPLE BY HAND **
before you can implement a sol... |
#!/usr/bin/env python3
import sys
sys.path.append(".")
from pynet import *
a = Node()
start()
finish()
|
# Demonstrate the use of acceleration test
import sys
import os
import numpy as np
from fastsim import simdrive, vehicle, cycle
def create_accel_cyc(length_in_seconds=300, spd_mph=89.48, grade=0.0, hz=10):
"""
Create a synthetic Drive Cycle for acceleration targeting.
Defaults to a 15 second acceleration... |
# -*- coding: utf-8 -*-
"""
@author: Satoshi Hara
"""
import sys
sys.path.append('../')
import numpy as np
import xgboost as xgb
from defragTrees import DefragModel
# load data
Ztr = np.loadtxt('./train.csv', delimiter=',')
Zte = np.loadtxt('./test.csv', delimiter=',')
Xtr = Ztr[:, :-1]
ytr = Ztr[:, -1]
Xte = Zte[:,... |
#!/bin/env python3
#
# split_spice.py --
#
# Script that reads the SPICE output from the convert_spectre.py script,
# which typically has parsed through files containing inline subcircuits
# and recast them as normal SPICE .subckt ... .ends entries, and pulled
# any model blocks inside the inline subckt out. This scri... |
import pandas as pd
from genomics_data_index.api.query.GenomicsDataIndex import GenomicsDataIndex
from genomics_data_index.api.query.features.MutationFeaturesComparator import MutationFeaturesComparator
from genomics_data_index.storage.SampleSet import SampleSet
from genomics_data_index.storage.model.db import Sample
... |
'''
################################################################
# Modern Deep Network Toolkits for Tensorflow-Keras
# Yuchen Jin @ cainmagi@gmail.com
# Requirements: (Pay attention to version)
# python 3.6+
# tensorflow r1.13+
# This is a pakage for extending the tensorflow-keras to modern
# deep network desig... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# 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 cop... |
from core.plant import Plant
from core.schedule import Schedule
class Simulator(object):
def __init__(self, plant):
assert type(plant) == Plant
self.plant = plant
def run(self, schedule):
assert type(schedule) == Schedule
pass # TODO
|
#-------------------------------------------------------------------------------
# Name: Enables My Esri Access
# Purpose: This script enables My Esri Access for the entire organization.
# Please be aware of the following information that will be available
# to esri ... |
"""The tests for the Mqtt vacuum platform."""
import json
import pytest
from homeassistant.components import mqtt, vacuum
from homeassistant.components.mqtt import (
CONF_COMMAND_TOPIC, vacuum as mqttvacuum)
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.components.vacuum impor... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... |
copas = [1990, 1994, 1998, 2002, 2006, 2010, 2014, 2018]
campeoes = ["Alemanha", "Brasil", "França", "Brasil", "Itália", "Espanha", "Alemanha", "França"]
sedes = ["Itália", "Estados Unidos", "França", "Coreia do Sul", "Alemanha", "África do Sul", "Brasil", "Rússia"]
cont = 0
nA = copas.index(2010)
nB = copas.ind... |
"""
This module provides a large set of colormaps, functions for
registering new colormaps and for getting a colormap by name,
and a mixin class for adding color mapping functionality.
"""
from __future__ import print_function
import os
import numpy as np
from numpy import ma
import matplotlib as mpl
import matplotl... |
"""
QCRI
"""
# pylint: disable=I0011, wrong-import-position, invalid-name, redefined-builtin,
# pylint: disable=I0011, no-member
from __future__ import print_function
from distutils.util import strtobool
import os
import sys
import argparse
import getpass
import logging
import pythoncom
# modify path
PTH = os.path.... |
import cv2
# 混淆矩阵
# 1 0
# 1 TP FP
# 0 FN TN
def cal(binary_GT,binary_R):
row, col = binary_GT.shape # 矩阵的行与列
TP,TN,FP,FN = 0, 0, 0, 0
for i in range(row):
for j in range(col):
if binary_GT[i][j] == 255 and binary_R[i][j] == 255:
TP += 1;
if binary_... |
from ..factor import TableFactor
import numpy as np
import pandas as pd
from itertools import combinations
def discrete_entropy(x):
def make_factor(data, arguments, leak=1e-9):
factor = TableFactor(arguments, list(data.columns))
factor.fit(data)
factor.table += leak
factor.normaliz... |
from flatland.core.grid.grid4_utils import get_new_position
from flatland.envs.agent_utils import RailAgentStatus
from flatland.core.grid.grid4 import Grid4TransitionsEnum
def check_if_all_blocked(env):
"""
Checks whether all the agents are blocked (full deadlock situation).
In that case it is pointless t... |
from cas.common.models import BuildEnvironment
from typing import Mapping
import logging
class BaseCompiler:
"""
Base compiler class from which all compilers should extend.
"""
def __init__(self, env: BuildEnvironment, config: Mapping, platform: str):
self._env = env
self._config = c... |
import luigi
import pandas as pd
import numpy as mp
from sklearn import preprocessing
from tasks.reg.combiner import CombineFeatures
from pathlib import Path
from common import utils
from sklearn import decomposition
from sklearn import pipeline
from sklearn import feature_selection
class Preprocess(luigi.Task):
... |
from . import ExcelFormulaParser, ExcelFormulaLexer
import struct
from .antlr import ANTLRException
class Formula(object):
__slots__ = ["__s", "__parser", "__sheet_refs", "__xcall_refs"]
def __init__(self, s):
try:
self.__s = s
lexer = ExcelFormulaLexer.Lexer(s)
... |
# This code was developed by Man Yi Yim (manyi.yim@gmail.com) under Python 2.7.13.
# Note that the figure order, label and the content may have changed during revision.
import numpy as np
import pylab
import matplotlib as mpl
import pickle
import itertools
import os
figpath = './figure/'
if not os.path.exists(figpath)... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from absl import flags
from absl.flags import FLAGS
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import (
Add,
Concatenate,
Conv2D,
Input,
Lambda,
LeakyReLU,
MaxPool2D,
UpSampling2D,
ZeroPadding2D,
BatchNormalization,
... |
from django.conf.urls import url
from approvals import views
urlpatterns = [
url(r'^approvals/$', views.ApprovalList.as_view(), name='approval_list'),
url(r'^approvals/(?P<pk>\d+)/$', views.ApprovalDetails.as_view(), name='approval_detail'),
url(r'^approvals/(?P<pk... |
from .handle import *
from .output import * |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.