text stringlengths 2 999k |
|---|
"""ContainerWidget class.
Represents a container that can be used to group other widgets.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the ... |
import argparse
# from AnnotatorCore import *
import sys
import csv
import requests
import os.path
import logging
import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from datetime import date
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('CnaAnnotator')
d... |
import numpy as np
import scipy
from scipy.spatial.distance import cdist
import lap # 0.4.0
from cython_bbox import bbox_overlaps as bbox_ious
from . import kalman_filter
def merge_matches(m1, m2, shape):
O,P,Q = shape
m1 = np.asarray(m1)
m2 = np.asarray(m2)
M1 = scipy.sparse.coo_matrix... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
def get_package_data():
return {'tardis.io.tests':['data/*.dat', 'data/*.yml']}
|
import pytest
import itertools
import pandas as pd
import numpy as np
from scTenifoldXct.core import null_test
def generate_fake_df_nn(n_ligand=3000, n_receptors=3000, n_cands=200):
gene_names = [f"GENE{i}" for i in range(max(n_ligand, n_receptors))]
iteration = itertools.product(gene_names, gene_names)
... |
#Review Seperator
def reviewToList(strDataLocation): #reviewToList(str_DataLocation)
file = open(strDataLocation)
listFile=(file.readlines())
firstReviewItem=0
lastReviewItem=0
listReviews = []
reviewText =""
for item in range(len(listFile)):
if('<review_text>\n'==listFile[item]):
... |
"""
Lab 4
"""
import re
from ngrams.ngram_trie import NGramTrie
def tokenize_by_sentence(text: str) -> tuple:
if not isinstance(text, str):
raise ValueError
sents = re.split(r'[.?!]', text)
tokenized_sent = []
for sent in sents:
tokens = re.sub(r'[^a-z \n]', '', sent.lower()).split()... |
from django.apps import AppConfig
class ConfConfig(AppConfig):
name = 'conf'
|
# Copyright 2017 IBM 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... |
#!/usr/bin/env python
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
renderer = vtk.vtkRenderer()
renWin.AddRenderer(renderer)
src1 = vtk.vtkSphereSource()
src1.SetRadius(5)
src1.SetPhiResolution(20)
src1.SetThetaResolution(20)
mapper = vtk.vtkPolyDataMapper()
mapper... |
#! /usr/bin/env python
# Like mkdir, but also make intermediate directories if necessary.
# It is not an error if the given directory already exists (as long
# as it is a directory).
# Errors are not treated specially -- you just get a Python exception.
import sys, os
def main():
for p in sys.argv[1:]:
m... |
# 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, ... |
# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""ResNet models for Keras.
"""
from __future__ import print_function as _print_function
import sys as _sys
from tensorflow.python.keras.applications.resnet import ResNet101
from tensorfl... |
################################################################
# System's dependencies
################################################################
import os
import sys
import time
import argparse
################################################################
# Local dependencies
##############################... |
import json
import sys
from . import app
from . import bdev
from . import iscsi
from . import log
from . import lvol
from . import nbd
from . import net
from . import nvmf
from . import pmem
from . import subsystem
from . import vhost
def start_subsystem_init(client):
return client.call('start_subsystem_init')
... |
import numpy as np
import pandas as pd
import pickle
import tensorflow as tf
import sklearn.metrics
import matplotlib.pyplot as plt
# Load the training and test data from the Pickle file
with open("../datasets/credit_card_default_dataset.pickle", "rb") as f:
train_data, train_labels, test_data, test_labels = pic... |
# flake8: noqa
from user.views.user_views import *
from user.views.gatekeeper_view import GatekeeperViewSet
from user.views.organization_view import OrganizationViewSet
|
import pytest
from dagster import DagsterInvalidConfigDefinitionError, Noneable, Selector, execute_solid, solid
def test_kitchen_sink():
@solid(
config_schema={
'str_field': str,
'int_field': int,
'list_int': [int],
'list_list_int': [[int]],
'di... |
"""
1、case顺序:加-除-减-乘
2、fixture方法在case前打印【开始计算】,结束后打印【计算结束】
3、fixture方法存在在conftest.py,设置scope=module
4、控制case只执行顺序为:加-减-乘-除
5、结合allure生成本地测试报告
"""
import allure
import pytest
import yaml
from test_Calculator.src.calculator import Calculator
def get_data():
with open('./data.yml') as data_x:
data = yaml.saf... |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Define the siamese network for one-shot learning,
for french short labels
02/06/2021
@author: milena-git, from jeremylhour courtesy
"""
import torch
import torch.nn as nn
def _createEmbeddingLayer(weights_matrix, non_trainable=False):
"""
_createEmbeddingLay... |
# Copyright 2021 The FastEstimator 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 appl... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import face_pb2 as face__pb2
class FaceServiceStub(object):
"""faceRecognition.FaceService 人脸服务
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
""... |
"""
CardIO is a library that works with electrocardiograms.
Documentation - https://analysiscenter.github.io/cardio/
"""
from setuptools import setup, find_packages
import re
with open('cardio/__init__.py', 'r') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
... |
#!/usr/bin/env python3.8
from account import Account
from credential import Credential
from termcolor import colored, cprint
import os
import time
import pickle
# Functions that implement the behaviours in account class.
def create_account(username, fname, lname, p_word):
'''
Function to create new account
... |
# Copyright 2020 The Kubernetes 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 law or agreed to ... |
from rest_framework import permissions
class IsAuthenticated(permissions.BasePermission):
def has_permission(self, request, view):
return (
request.user
and request.user.is_authenticated
and request.user.is_email_verified
)
class IsAuthenticatedOrReadOnly(perm... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#~ The MIT License (MIT)
#~ Copyright 2018 ©klo86min
#~ 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 with... |
# -*- coding: utf-8 -*-
# Copyright 2020 Tomaz Muraus
#
# 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 ... |
"""
Django settings for sharinator project.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os... |
import numpy as np
from qmt.geometry import PropertyMap, MaterialPropertyMap
from qmt.materials import Materials
class DummyPartMap:
def __init__(self, part_ids):
assert len(part_ids) == 2
self.partIds = part_ids
def __call__(self, x):
assert np.ndim(x) >= 1
x = np.asanyarray... |
# 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... |
# Copyright (c) 2012 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 ... |
# Copyright (C) 2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ycmd... |
"""Edge weights.
"""
__author__ = "Rémi Barat"
__version__ = "1.0"
import math
import random
from crack.models.weights import condition_models, format_crit
#####################################################
### Format the models for init_EWeights functions ###
##################################################... |
# This file defines the back end of the Tetris game
#
# GameState is the base class of GameClient.
#
# GameClient.Run() will start two threads:
# - _ProcessActions: Process the action list every x seconds
# - _AutoDrop: Auto drops the current piece.
#
# GameClient:
# - current piece
# - held piece
# - piece list... |
#_*_ coding: utf-8 _*_
def needsclap(x):
return x==2 or x==3 or x==5 or x==7
for i in range(1,101):
one = needsclap(i%10)
ten = needsclap(i/10)
if one and ten: print i,"짝짝"
elif one or ten: print i,"짝"
else: print i
print [1,2,3] + ["ff"]
print [1,2] * 3
a = [1,2,3,4,5,6,7,8,9]
a[1] = 5
print a[-2]
print a[3:... |
"""
Will open a port in your router for Home Assistant and provide statistics.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/upnp/
"""
import asyncio
from ipaddress import ip_address
import aiohttp
import voluptuous as vol
from homeassistant.config_e... |
# Copyright 2020 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... |
import torch
import numpy as np
import itertools
from itertools import product
import math
import random
import unittest
import warnings
import operator
from functools import partial
from torch._six import inf, nan
from torch.testing._internal.common_utils import (
TestCase, iter_indices, TEST_WITH_ASAN, run_test... |
from sympy import Rational, Symbol, latex, UnevaluatedExpr
import sympy as sp
import numpy as np
u = lambda x : UnevaluatedExpr(x)
# Helper functions
def explain_add(a, b):
assert(np.shape(a) == np.shape(b))
rows, columns = np.shape(a)
return sp.Matrix([[Symbol(f"({latex(u(a[i,j]))} + {latex(u(b[i,j]))})"... |
import logging
from numpy import degrees, pi, radians
from beyond.frames import get_frame, create_station
from beyond.errors import UnknownFrameError
from .wspace import ws
from .utils import dms2deg, deg2dms
log = logging.getLogger(__name__)
class StationDb:
def __new__(cls):
if not hasattr(cls, "_i... |
# -*- coding: utf-8 -*-
import requests
from urllib.parse import urljoin
from os import getenv
import types
class Fieldbook(object):
"""
Client for Fieldbook API: https://github.com/fieldbook/api-docs
Initialize with a fieldbook_id and optionally the api key (name) and secret.
"""
BASE_UR... |
"""
BROS
Copyright 2022-present NAVER Corp.
Apache License v2.0
Do 2nd preprocess on top of the result of the 'preprocess.sh' file.
Reference: https://github.com/microsoft/unilm/blob/master/layoutlm/deprecated/examples/seq_labeling/run_seq_labeling.py
"""
import json
import os
from collections import Counter
from t... |
import pytest
from hypothesis import given, settings
from hypothesis import strategies as st
from vyper import ast as vy_ast
@pytest.mark.fuzzing
@settings(max_examples=50, deadline=1000)
@given(
idx=st.integers(min_value=0, max_value=9),
array=st.lists(st.integers(), min_size=10, max_size=10),
)
def test_su... |
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2014-2018 <see AUTHORS.txt>
#
# 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 limitati... |
#!/usr/bin/env python
import yaml, json
with open("testlist.yml", "r") as f:
y = yaml.load(f)
print "Here's the pretty YAML:"
print yaml.dump(y)
with open("testlist.json", "r") as f:
j = json.load(f)
print "Here's the pretty JSON:"
print json.dumps(j, indent=4)
|
from babel import localedata
from grow.pods import errors
from grow.pods import messages
import pickle
import os
import babel
import re
class Locales(object):
def __init__(self, pod):
self.pod = pod
def list_groups(self):
if 'locales' not in self.pod.yaml:
return []
retur... |
"""
#Trains a ResNet on the CIFAR10 dataset.
"""
from __future__ import print_function
import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, LearningRa... |
from assembler import ASM
from roomEditor import RoomEditor
import entityData
def addMultiworldShop(rom):
# Make a copy of the shop into GrandpaUlrira house
shop_room = RoomEditor(rom, 0x2A1)
re = RoomEditor(rom, 0x2A9)
re.objects = [obj for obj in shop_room.objects if obj.x is not None and obj.type_i... |
# -*- coding: utf-8 -*-
# Copyright 2016 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 ... |
def _gcs_upload_impl(ctx):
targets = []
for target in ctx.files.data:
targets.append(target.short_path)
ctx.file_action(
output = ctx.outputs.targets,
content = "\n".join(targets),
)
ctx.file_action(
content = "%s --manifest %s --root $PWD -- $@" % (
ctx.attr.uploader.files_... |
# from code.transformer_vid.utils import convert_weights
# import rotary_embedding_torch
from torch.nn.modules.activation import GELU, ReLU
# from data.OneCombo3.trainer import TrainerConfig
import math
import numpy as np
import itertools
import logging
import torch
import torch.nn as nn
from torch.nn import functiona... |
from . import PrioritizationTechnique
from collections import Counter
class UniqueSearch(PrioritizationTechnique):
def __init__(self, binary, target_os, target_arch, similarity_func=None):
super(UniqueSearch, self).__init__(binary=binary, target_os=target_os, target_arch=target_arch)
self... |
# Synthesis of multifractal random walk and derived processes.
#
# Roberto Fabio Leonarduzzi
# January, 2019
import numpy as np
from .fbm import fgn
from .pzutils import gaussian_cme, gaussian_chol
from numpy.fft import fft, ifft
# import math
# import matplotlib.pyplot as plt
def mrw(shape, H, lam, L, sigma=1, meth... |
import unittest
from pyregex.file_extensions import is_audio, is_img
class FileExtTests(unittest.TestCase):
def test_1(self):
self.assertEqual(is_audio("Nothing Else Matters.mp3"), False)
def test_2(self):
self.assertEqual(is_audio("NothingElseMatters.mp3"), True)
def test_3(self):
... |
"""Helper functions for validating LFOM.
Created on September 18, 2020
@author: jcs528@cornell.edu
"""
from aguaclara.core.units import u
import aguaclara.core.physchem as pc
import aguaclara.core.constants as con
def flow_lfom_vert(height, d_ori, h_ori, n_oris):
"""Returns the flow through the LFOM as a functi... |
#!/usr/bin/env python
from __future__ import absolute_import
import locale
import logging
import os
import sys
import warnings
# 2016-06-17 barry@debian.org: urllib3 1.14 added optional support for socks,
# but if invoked (i.e. imported), it will issue a warning to stderr if socks
# isn't available. requests uncondi... |
# -*- coding: utf-8 -*-
import datetime
import warnings
import pandas as pd
import numpy as np
from rqdatac.utils import to_datetime, to_date
from rqdatac.validators import (
ensure_date_range,
ensure_date_or_today_int,
ensure_list_of_string,
check_items_in_container,
ensure_order,
ensure_orde... |
from django.db import models
# Create your models here.
class Endpoint(models.Model):
"""
The Endpoint object represents ML API endpoints
Attributes:
name: The name of the endpoints, it will be used in API URL,
owner: The string with owner name,
created_at: The date when endpoint w... |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['PolyTrend'] , ['Seasonal_Hour'] , ['MLP'] ); |
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from theano.sandbox.rng_mrg import MRG_RandomStreams
@treeano.register_node("randomized_relu")
class RandomizedReLUNode(treeano.NodeImpl):
"""
from "Empirical Evaluation of Rectified Activations in Convolutio... |
import click
import psycopg2 as pg2
from flask import current_app, g
from flask.cli import with_appcontext
from psycopg2.extras import DictCursor
def get_db():
if 'db' not in g:
g.db = pg2.connect(
**current_app.config['DATABASE'],
)
g.db.cursor_factory = DictCursor
retu... |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.... |
# Copyright 2013-2018 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 Phist(CMakePackage):
"""The Pipelined, Hybrid-parallel Iterative Solver Toolkit provides
... |
#!/usr/bin/python
import sys
import os
if len(sys.argv) >= 3 :
filename = sys.argv[1]
refFlat_filename = sys.argv[2]
else:
print("usage: python exp_len.py refSeq_MLE_output.tab known.gpd")
print("or ./exp_len.py refSeq_MLE_output.tab known.gpd")
sys.exit(1)
########################################... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import operator
import numpy as np
import pytest
import openvino.runtime.opset8 as ov
from tests.runtime import get_runtime
from tests.test_ngraph.util import run_op_node
@pytest.mark.parametrize(
"ng_api_helper,numpy_function",
... |
#!/usr/bin/python3
import glob
import re
lgs=open("locallanguages.txt").read().split('\n')
terms=open("localsubjectterms.txt").read().split('\n')[::-1]#reverse to avoid double indexing
print("found %i language names for autoindexing" % len(lgs))
print("found %i subject terms for autoindexing" % len(terms))
files = g... |
# Copyright (C) 2016 Allen Li
#
# 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 -*-
from .processor import QueryProcessor
class MySqlQueryProcessor(QueryProcessor):
def process_insert_get_id(self, query, sql, values, sequence=None):
"""
Process an "insert get ID" query.
:param query: A QueryBuilder instance
:type query: QueryBuilder
... |
from simmate.toolkit.creators.vector.uniform_distribution import (
UniformlyDistributedVectors,
)
from simmate.toolkit.creators.vector.normal_distribution import (
NormallyDistributedVectors,
)
|
import asyncio
from asyncio import Future
from asyncio.tasks import ensure_future
from functools import partial
from prompt_toolkit.application.current import get_app
from prompt_toolkit.layout.containers import HSplit
from prompt_toolkit.layout.dimension import D
from prompt_toolkit.widgets import Button, Label, Prog... |
import json
class Configuration():
# class to organize Netlogo simulation parameters
def __init__(self):
# costants
self.constants={
'strategy?' : 3,
'drone.radius': 0.2,
'drone.speedMax': 8.5,
'drone.cruisingSpeed': 2,
'drone.acceleration... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
"""Return the squared distance beetween the intersection of a and b."""
from .intersection_nth_variation import intersection_nth_variation
from typing import Dict
def intersection_squared_variation(a: Dict, b: Dict, overlap: bool=False)->float:
"""Return the squared distance beetween the intersection of a and b.""... |
class SecurityFlavor(basestring):
"""
any|none|never|krb5|ntlm|sys
Possible values:
<ul>
<li> "any" - Any,
<li> "none" - Anonymous Access Allowed If Security Type
Not Already Listed,
<li> "never" - Never,
<li> "krb5" - Kerberos 5 Authentication,
<li> "ntlm" - ... |
#Weather
#Functions TODO
# precip accumilation works well hourly
# sign up for storm alert per IKON or EPIC resort
# timer to check the 3 day for storms
# highest winter in state
from datetime import datetime, timedelta
from dateutil import tz
import discord
import googlemaps
import aiohttp
import as... |
from CmdBase import *
from PersistentModules import *
# Cmd
# turn left deg
# turn right deg
# turn to deg
# turn rate deg
class CmdRotate(CmdBase):
def __init__(self, controller, line, engage_object = None):
super().__init__(controller, line, engage_object)
def start(self):
self.mystate_mo... |
import pytest
import numpy as np
from numpy import isclose
from numpy.random import RandomState
from cascade_at.model.priors import (
Constant,
Gaussian,
Uniform,
Laplace,
StudentsT,
LogGaussian,
LogLaplace,
LogStudentsT,
PriorError,
)
def test_happy_construction():
Uniform(-1... |
from torch.autograd import Variable
from models.proposal_target_layer_cascade import *
import torchvision.models as models
from models.proposal import *
#bocknet
class ResNet(nn.Module):
def __init__(self, block, layers, num_classes=1000,dropout_prob=0.2):
self.inplanes = 64
super(ResNet, self).__i... |
import os
from django.contrib.gis.utils import LayerMapping
from .models import WorldBorder
world_mapping = {
'fips': 'FIPS',
'iso2': 'ISO2',
'iso3': 'ISO3',
'un': 'UN',
'name': 'NAME',
'area': 'AREA',
'pop2005': 'POP2005',
'region': 'REGION',
'subregion': 'SUBREGION',
'lon': 'L... |
from django.shortcuts import get_object_or_404
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, generics, views, exceptions
from rest_framework.response import Response
from core import models
from core.models.base import GameStatus
from service import serializers
from ... |
# 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 numpy as np
import scipy.signal
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.evaluation.postprocessing import Postprocessing
from algorithms.curiosity import INTRINSIC_REWARD
INTRINSIC_VALUE_TARGETS = "intrinsic_value_targets"
INTRINSIC_VF_PREDS = "intrinsic_vf_preds"
def discount(x, ... |
"""
Based on the implementation of https://github.com/jadore801120/attention-is-all-you-need-pytorch
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from maskrcnn_benchmark.modeling.utils import cat
from .utils_motifs import obj_edge_vectors, to_onehot, nms_overlaps, encode_box... |
import logging
import numpy as np
import os
import PIL
import PIL.Image
import tensorflow as tf
from tensorflow.keras.layers import Layer, Conv2D, MaxPool2D, Dense, Flatten, Dropout, GlobalAveragePooling2D
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras import layers
from tensorflow.keras i... |
import torch.nn as nn
from .base import BaseLM
class IpaLM(BaseLM):
name = 'lstm'
def __init__(self, vocab_size, hidden_size, nlayers=1, dropout=0.1, embedding_size=None, **kwargs):
super().__init__(
vocab_size, hidden_size, nlayers=nlayers, dropout=dropout, embedding_size=embedding_size... |
# Copyright 2018 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, ... |
#
# PySNMP MIB module SW-STRCTURE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-STRCTURE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:12:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
from manimlib.constants import *
from manimlib.mobject.types.vectorized_mobject import VMobject, VGroup
from manimlib.mobject.geometry import Arc, Line, Dot, Polygon, Sector, Circle
from manimlib.utils.color import color_gradient
from manimlib.mobject.number_line import DecimalNumber
from manimlib.mobject.svg.tex_mobje... |
import tensorflow as tf
from tensorflow.keras.callbacks import Callback
class ExtraValidation(Callback):
"""Log evaluation metrics of an extra validation set. This callback
is useful for model training scenarios where multiple validation sets
are used for evaluation (as Keras by default, provides function... |
from .anoflows import AnoFlows
|
from flask_unchained.bundles.admin import ModelAdmin
from flask_unchained.bundles.admin.templates import details_link, edit_link
from ..models import Role
class RoleAdmin(ModelAdmin):
model = Role
name = 'Roles'
category_name = 'Security'
menu_icon_value = 'fa fa-check'
column_searchable_list =... |
"""image_optimizer_demo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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'... |
countries = ["Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia",
"Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus",
"Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "B... |
# -*- coding:utf-8 -*-
"""
@author: Alden
@email: sunzhenhy@gmail.com
@date: 2018/4/5
@version: 1.0.0.0
"""
class Solution(object):
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
nums = sorted(nums)
s... |
import os, logging, sys, subprocess, argparse, time
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.log import setLogLevel, info
from mininet.cli import CLI
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from p4_mininet import P4Switch, P4Host
from nc_config import ... |
import cgi
import datetime
import email.message
import json as jsonlib
import typing
import urllib.request
from collections.abc import MutableMapping
from http.cookiejar import Cookie, CookieJar
from urllib.parse import parse_qsl, urlencode
import chardet
import rfc3986
from .config import USER_AGENT
from .decoders i... |
# Copyright 2017 Battelle Energy Alliance, 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 agreed t... |
#Explicit type conversion from int to float
num1 = 10
num2 = 20
num3 = num1 + num2
print(num3)
print(type(num3))
num4 = float(num1 + num2)
print(num4)
print(type(num4))
#Explicit type conversion from float to int
num1 = 10.2
num2 = 20.6
num3 = (num1 + num2)
print(num3)
print(type(num3))
num4 = int(num1 + num2)
print(n... |
from database import (
fix_ids,
ImageModel,
CategoryModel,
AnnotationModel,
DatasetModel,
TaskModel,
ExportModel
)
# import pycocotools.mask as mask
import numpy as np
import time
import json
import os
from celery import shared_task
from ..socket import create_socket
from mongoengine impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.