text stringlengths 1 927k |
|---|
# Copyright (c) 2021, University of Washington
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of condi... |
from sqlalchemy.testing import assert_raises_message, assert_raises
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy import Integer, String
from sqlalchemy.testing.schema import Table, Column
from sqlalchemy.orm import mapper, relationship, \
create_session, class_mapper, \
Mapper, column_... |
from commands.command import Command, table_print
class PersonComm(Command):
COMM_STR = "person"
HELP_STR = """\
The 'person' command allows you to explore different characters
within the game.
----------------------------------------------------------------------
The command 'person' alone will display chara... |
from __future__ import print_function
from __future__ import unicode_literals
import re
import os
import socket
import select
import hashlib
import base64
import queue
import random
import string
from threading import Thread, Event
import ttfw_idf
def get_my_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGR... |
import torch.nn as nn
import torch
from ..models.base import BiomedicalBlock, DownSample, UpSample, PreActBlock, crop_center
SCALE_FACTORS = ((5, 5, 5), (3, 3, 3), (1, 1, 1))
FEATURE_MAPS = (30, 30, 40, 40, 40, 40, 50, 50)
FULLY_CONNECTED = (250, 250)
DROPOUT = (.0, .5, .5)
class Path(BiomedicalBlock):
def __ini... |
import rope.base.codeanalyze
import rope.base.evaluate
from rope.base import worder, exceptions, utils
from rope.base.codeanalyze import ArrayLinesAdapter, LogicalLineFinder
class FixSyntax(object):
def __init__(self, pycore, code, resource, maxfixes=1):
self.pycore = pycore
self.code = code
... |
# encoding: utf-8
"""
yang/model.py
Created by Thomas Mangin on 2020-09-01.
Copyright (c) 2020 Exa Networks. All rights reserved.
"""
import os
import sys
import json
import glob
import shutil
import urllib
import urllib.request
class Model(object):
namespaces = {
'ietf': 'https://raw.githubusercontent.... |
from machine import Pin
import time
BP_7 = Pin(7, Pin.IN, Pin.PULL_UP)
BROCHE_8 = Pin(8, Pin.OUT)
while True:
if BP_7.value() == 0:
BROCHE_8.value(0)
time.sleep(250)
BROCHE_8.value(1)
time.sleep(250)
else:
BROCHE_8.value(0) |
from django.apps import AppConfig
class ServerConfig(AppConfig):
name = 'server' |
#added after changing folder structure
import os
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY')
# SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://cherucole:cherucole@localhost/blog'
UPLOADED_PHOTOS_DEST ='app/static/photos'
# email configurations
MAIL_SERVER = 'smtp.googlemail.com'
... |
# -*- coding: utf-8 -*-
import time
from gevent import socket
from mock import Mock, patch
from nose.tools import *
from gsocketpool.connection import Connection
from gsocketpool.connection import TcpConnection
class TestConnection(object):
def test_reconnect(self):
conn = Connection()
conn.op... |
# -*- coding: utf-8 -*-
"""Tests for Requests."""
from __future__ import division
import json
import os
import pickle
import collections
import contextlib
import warnings
import re
import io
import requests
import pytest
from requests.adapters import HTTPAdapter
from requests.auth import HTTPDigestAuth, _basic_auth_... |
#%%
import os
import pylab
import numpy as np
#%%
NUM_EDGES = 2474
EXACT_SOLUTION = 1430
samples = np.loadtxt(os.path.join("results", "FFNN", "100vertexGraph","stateAdvanced_1000steps.txt"))
loaded_matrix = np.loadtxt("data/g05_100.0", skiprows=0, dtype=np.int32)
edgelist = [[loaded_matrix[i, 0] - 1, loaded_matrix[i... |
set = {}
print(set)
set={1,2,3,4,5,6,7,8,9,0}
print(set)
set={1.4,2.0,"hello",4,'a'}
print(set)
print("next")
set={1,2,3,4,5,5,6,6,6,7,8,8,8}
print(set)
set={1,2,3}
print(set) |
# 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 RIntervals(RPackage):
"""intervals: Tools for Working with Points and Intervals"""
ho... |
# ----------------------------------------------------------------------
# |
# | AnyOfTypeInfo_UnitTest.py
# |
# | David Brownell <db@DavidBrownell.com>
# | 2018-04-28 19:37:12
# |
# ----------------------------------------------------------------------
# |
# | Copyright David Brownell 2018-22.
# | Distributed... |
# Generated by Django 2.2.10 on 2020-04-30 09:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_integrations', '0003_auto_20200430_0742'),
]
operations = [
migrations.AlterField(
model_name='linkedinapi',
na... |
# Generated by Django 3.1.12 on 2021-08-30 13:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("river", "0006_remove_error_exception"),
]
operations = [
migrations.RemoveField(
model_name="batch",
name="resource_ids",
... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
"""LISTA02_Q03 Faça um programa que dada uma seqüência de n números,
imprimi-la na ordem inversa à da leitura."""
lista = []
while True:
try:
num = int(input("Digite um numero [999] para: "))
if num == 999:
break
else: lista.append(num)
except:
print("Dados inválido... |
#!c:\python27\python.exe -u
import cgi
import cgitb; cgitb.enable();
cgi.test()
import mapscript
print "<h2>mapscript module attributes</h2>"
print dir(mapscript) |
# Copyright 2022 AI Singapore
#
# 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... |
import sqlite3
con = sqlite3.connect("ogrenciler.db")
cursor = con.cursor()
def tabloolustur():
cursor.execute("CREATE TABLE IF NOT EXISTS ogrenciler(ad TEXT,soyad TEXT,numara INT,ogrenci_notu INT)")
def degerekle():
cursor.execute("INSERT INTO ogrenciler VALUES('Gulay Busenur','Elmas','2014010213007','78'... |
import numpy as np
from PIL import Image
from ch08.deep_convnet import DeepConvNet
from common.functions import softmax
def predictNumber(img):
img = img.convert("L") # 흑백처리
img = np.array(img) / 255 # normalize 해줘야함..
img = img * -1 + 1 # 흑백반전도 해줘야함.. 검은배경에 흰 글자로 나오도록!
imgArray = img.reshape(1,28,28,... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Jiao Lin
# California Institute of Technology
# (C) 2007-2009 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... |
# Copyright 2020 Google LLC 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... |
#!/usr/bin/env python3
##
# Copyright (c) 2018 Samsung Electronics Co., Ltd. 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... |
import numpy as np
from pytest import raises
from iqrm import iqrm_mask
def generate_noise(nchan=1024, seed=0):
# IMPORTANT: set the random seed for reproducible results
np.random.seed(seed)
return np.random.normal(size=nchan)
def generate_noise_with_outlier_range(start, end, nchan=1024, seed=0):
s... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from discord.ext import commands
from dateutil.relativedelta import relativedelta
import asyncio
import datetime
import discord
import holidays
import logging
import mat... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2018 -- Lars Heuer - Semagia <http://www.semagia.com/>.
# All rights reserved.
#
# License: BSD License
#
"""\
Tests against the colors module.
"""
from __future__ import absolute_import, unicode_literals
import pytest
from segno import colors
def test_illegal():
w... |
from .Loader import Loader
from .fashion_mnist import FashionMnist
from .mnist import MNIST
from .uci import UCI
from .cifar10_augmentation import CIFAR10Aug
from .twenty_news import TwentyNews |
# Generated by Django 3.2.4 on 2021-08-17 11:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('papers', '0003_userproject'),
]
operations = [
migrations.AddField(
model_name='userproject',
name='description',
... |
'''
social movement environment (Roboschool for poses)
'''
from roboschool.scene_abstract import Scene, SingleRobotEmptyScene
import os
import numpy as np
import gym
from OpenGL import GLE # fix for opengl issues on desktop / nvidia
import cv2
PATH_TO_CUSTOM_XML = os.path.join(os.path.dirname(__file__), "xml_files")... |
from __future__ import print_function
import argparse
import io
import os
import json
import shutil
import web3
from web3 import Web3, HTTPProvider
from web3.contract import ConciseContract
from solc import install_solc, compile_files
# load configs from config.json
contracts_settings = './contracts_settings.json'
... |
# Copyright 2017 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 ... |
class Animal:
def __init__(self, name, gender, age, money_for_care):
self.name = name
self.gender = gender
self.age = age
self.money_for_care = money_for_care
def __repr__(self):
return f"Name: {self.name}, Age: {self.age}, Gender: {self.gender}" |
from ..context import Context
from ..internal.logger import get_logger
from .utils import get_wsgi_header
log = get_logger(__name__)
# HTTP headers one should set for distributed tracing.
# These are cross-language (eg: Python, Go and other implementations should honor these)
HTTP_HEADER_TRACE_ID = 'x-datadog-trace-... |
"""
Django settings for server project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
from pathlib im... |
"""Python sync/async framework for Interactive Brokers API"""
import dataclasses
import sys
from eventkit import Event
from . import util
from .client import Client
from .contract import (
Bag, Bond, CFD, ComboLeg, Commodity, ContFuture, Contract,
ContractDescription, ContractDetails, Crypto, DeltaNeutralCon... |
# Copyright 2014 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 telemetry.page import page as page_module
from telemetry.page import shared_page_state
class KeyMobileSitesPage(page_module.Page):
def __init__(self... |
from django.contrib import admin
from .models import Link
# Register your models here.
class LinkAdmin(admin.ModelAdmin):
readonly_fields = ('created', 'updated')
def get_readonly_fields(self, request, obj=None):
if request.user.groups.filter(name="Terafamiliar").exists():
return ('key', '... |
# Copyright 2015-2016 Yelp 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 writin... |
# Copyright 2021 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, ... |
a = set(['1', '2' ,'3'])
print a.discard(1)
print a.difference()
print a.intersection('3') |
# -*- coding: utf-8 -*-
import os
from textrank.TextRank4Keyword import TextRank4Keyword
from textrank.TextRank4Sentence import TextRank4Sentence
from document.document import get_document
from document.utils.util import ModefyPath
from document.result import save_result
from pyecharts import Graph
current_path = os.pa... |
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Use this to run several variants of the tests.
ALL_VARIANT_FLAGS = {
"code_serializer": [["--cache=code"]],
"default": [[]],
"future": [["--future"... |
import Eva
from collections import defaultdict
from cdlib import AttrNodeClustering
import networkx as nx
from cdlib.utils import convert_graph_formats
from cdlib.algorithms.internal.ILouvain import ML2
__all__ = ['eva', 'ilouvain']
def eva(g, labels, weight='weight', resolution=1., randomize=False, alpha=0.5):
... |
from pathlib import Path
import click
import numpy as np
import pandas as pd
from covid_model_seiir_pipeline.lib import (
cli_tools,
math,
static_vars,
)
from covid_model_seiir_pipeline.pipeline.regression.data import RegressionDataInterface
from covid_model_seiir_pipeline.pipeline.regression.specificatio... |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
import pandas as pd
import h5py
# Paths
DATA_HOME = "/content/drive/My Drive/Yelp-Restaurant-Classification/Model/data/"
FEATURES_HOME = '/content/drive/My Drive/Yelp-Restaurant-Classification/Model/features/'
# Get photo->business mapping from the file provided
train_photo_to_biz_ids = pd.read_csv(DATA_HOME + 'train... |
#!/usr/bin/env python3
# Copyright 2021 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 ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
import json
from collections import defaultdict
from sc2reader import log_utils
from sc2reader.utils import Length
from sc2reader.factories.plugins.utils import (
PlayerSelection,
GameState,
JSONDate... |
# Lint as: python2, python3
# Copyright 2020 Google LLC. 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 req... |
from api_wrap import ApiWrapper
from garch import MyGARCH
from stock import Stock
def print_movers(companies):
"""
Print obtained companies symbols with responding values to choose
:param companies: list of companies symbols
"""
print("\n------------------- List of companies symbols --------------... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from actionlib/TestRequestResult.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class TestRequestResult(genpy.Message):
_md5sum = "61c2364524499c7c5017e2f3fce7ba06"
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 10 02:41:05 2021
@author: r00526841
"""
from utils import *
from PIL import Image
#import imagehash
import cv2
def getImageStatistics(df, ppath_to_dir, ppath_to_label_dir=None):
for index, row in df.iterrows():
ppath_to_image = ppath_to_dir / row["image_nam... |
#!/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.
"""Test the wallet."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.... |
#! /usr/bin/env python
import serial
class PlotData:
def __init__(self, serialPort, maxLength):
self.s = serial.Serial(serialPort, 115200)
self.x = deque([0.0]*maxLength)
self.y = deque([0.0]*maxLength)
self.maxLength = maxLength
def |
from fewshot_re_kit.data_loader import get_loader, get_loader_pair, get_loader_unsupervised
from fewshot_re_kit.framework import FewShotREFramework
from fewshot_re_kit.sentence_encoder import FasttextSentenceEncoder, CNNSentenceEncoder, BERTSentenceEncoder, \
BERTPAIRSentenceEncoder, RobertaSentenceEncoder, Roberta... |
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
"""Volatility 3 - An open-source memory forensics framework"""
import inspect
import sys
from importlib import abc
from typing import... |
import json
import os
import threading
from typing import List
import yara
from assemblyline.common.str_utils import safe_str
from assemblyline_v4_service.common.base import ServiceBase
from assemblyline_v4_service.common.result import Result, ResultSection, BODY_FORMAT
from yara_.helper import YaraMetadata
class Y... |
print("$3=0x00000400")
z = 0
for i in range(0, 0x400 + 1):
z += i
print("skip\n$1=0x%08x\n$2=0x%08x" % (z, i + 1))
print("skip") |
__copyright__ = "Copyright 2016-2018, Netflix, Inc."
__license__ = "Apache, Version 2.0"
import numpy as np
import scipy.linalg
from vmaf.core.train_test_model import TrainTestModel, RegressorMixin
class NiqeTrainTestModel(TrainTestModel, RegressorMixin):
TYPE = 'NIQE'
VERSION = "0.1"
@classmethod
... |
# sql/base.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Foundational utilities common to many sql modules.
"""
from __future__ import ann... |
import os
import shutil
import urllib
import urllib.request
from datetime import datetime
from rastervision2.pipeline.filesystem import (FileSystem, NotReadableError,
NotWritableError)
from urllib.parse import urlparse
class HttpFileSystem(FileSystem):
@staticmethod... |
import retri
import time
class App(retri.App):
def __init__(self):
super().__init__(160, 120, 4)
data = self.bank(0).data
data[0, 0] = 7
data[0, 1] = 3
data[0, 2] = 7
data[1, 0] = 8
data[2, 0] = 7
data[7, 7] = 7
self.x = 0
self.cou... |
# Copyright (C) 2020 by University of Edinburgh
#from numpy import *
import delayrepay.backend
from .delayarray import *
import delayrepay.random
import delayrepay.fft
if delayrepay.backend.backend.__name__ == 'cupy':
import cupy
cuda = cupy.cuda
fft = delayrepay.fft
pi = delayrepay.backend.backend.np.pi |
__author__ = "emmanuel" |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The DFTz Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.mininode import *
from test_framework.test_framework import DFTzTestFramewo... |
# Copyright (c) 2020, Soohwan Kim. 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... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
#!/usr/bin/env python
import sys
import argparse
import os
from os.path import expanduser, normpath
from shutil import copy2
from shutil import move
from glob import glob
from clint.textui import puts, progress, colored, indent
from wand.image import Image
from wand.color import Color
import subprocess
#
# Creating ... |
import scipy.sparse as ssp
import numpy as np
counts = ssp.load_npz('./counts_norm.npz')
np.savetxt('./counts_norm.csv', counts.todense(), delimiter=',', fmt='%.3f') |
import numpy as np
from scipy import ndimage
__all__ = ['gabor_kernel', 'gabor_filter']
def _sigma_prefactor(bandwidth):
b = bandwidth
# See http://www.cs.rug.nl/~imaging/simplecell.html
return 1.0 / np.pi * np.sqrt(np.log(2)/2.0) * (2.0**b + 1) / (2.0**b - 1)
def gabor_kernel(frequency, theta=0, band... |
"""Torch module for GCN."""
import torch
import torch.nn as nn
import torch.nn.functional as F
from grb.utils.normalize import GCNAdjNorm
class GCN(nn.Module):
r"""
Description
-----------
Graph Convolutional Networks (`GCN <https://arxiv.org/abs/1609.02907>`__)
Parameters
----------
in... |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
# Copyright 2019-2020 Fortinet, Inc.
#
# This program 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 ... |
# -*- coding: utf-8 -*-
# common
import matplotlib.pyplot as plt
_LALLOWED_AXESTYPES = [
'cross', 'hor',
'matrix',
'timetrace',
'profile1d',
'image',
'misc'
]
# #############################################################################
# #################################################... |
# 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, software
# d... |
"""Create your api serializers here."""
import numpy as np
from django.core.serializers.json import DjangoJSONEncoder
from rest_framework import serializers
class NpEncoder(DjangoJSONEncoder):
"""Encoder for numpy object."""
def default(self, o):
"""Serialize implementation of NpEncoder serializer.
... |
from keras import Model, optimizers, initializers, regularizers
from keras.layers import Input, Dense, Activation
from keras.layers.normalization import BatchNormalization
from keras.utils import to_categorical
from keras.datasets import fashion_mnist
import matplotlib.pyplot as plt
# パラメータ + ハイパーパラメータ
img_shape = (28... |
# Owner(s): ["oncall: distributed"]
import contextlib
from copy import deepcopy
from functools import partial
import torch
import torch.nn as nn
from torch.distributed._fsdp.fully_sharded_data_parallel import (
FullyShardedDataParallel as FSDP,
CPUOffload,
)
from torch.distributed.algorithms._checkpoint._chec... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
from data import *
from yolact_utils.augmentations import SSDAugmentation, BaseTransform
from yolact_utils.functions import MovingAverage, SavePath
from yolact_utils.logger import Log
from yolact_utils import timer
from layers.modules import MultiBoxLoss
from yolact import Yolact
import os
import sys
import time
import... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class ActorNetwork(nn.Module):
def __init__(self,input_size,hidden_size,action_size):
super(ActorNetwork, self).__init__()
self.fc1 = nn.Linear(input_size,hidden_size)
self.fc2 = nn.Linear(hidden_size,hidden_size)
s... |
"""
This file contains various fitting functions for general use with SAMI codes.
Currently included:
GaussFitter - Gaussian Fitter (1d)
GaussHermiteFitter - Fits a truncated Gauss-Hermite expansion (1d)
TwoDGaussFitter - Gaussian Fitter (2d, optionally w/ PA and different widths)
Would be nice:
Exponential Fitter?... |
import dash
#import dash_core_components as dcc
from dash import dcc
from dash import html
#import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import plotly.express as px
from plotly import graph_objects as go
import pandas as pd
# https://dash-boots... |
import os
import sys
import pytest
import shlex
import subprocess
from os_fast_reservoir.cmdline import execute
def call(cmdline, env=None, **kwargs):
if env is None:
env = os.environ.copy()
if env.get('COVERAGE', None) is not None:
env['COVERAGE_PROCESS_START'] = os.path.abspath('.coveragerc'... |
# -*- coding: utf-8 -*-
from clint.textui import puts, indent
from clint.textui import colored
from HTMLParser import HTMLParser
class Bunch(dict):
def __init__(self, **kw):
dict.__init__(self, kw)
self.__dict__ = self
def __getstate__(self):
return self
def __setstate__(self, st... |
def Lps(p):
n = len(p)
table = [0] * n
k = 0
for i in range(1, n):
while k > 0 and p[i] != p[k]:
k = table[k - 1]
if p[i] == p[k]:
k += 1
table[i] = k
return table
def Find(s, p):
k = 0
c = 0
table = Lps(p)
for i in range(len(s)):
... |
# coding: utf-8
from ac_engine.actions.abstract import AbstractAction
class AbstractStatistics(AbstractAction):
EXCLUSION_SET = ()
@property
def data_container_class(self):
return None
def prepare_data(self):
for offer in self.offers:
if offer:
self.offe... |
# 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 ... |
#!/usr/bin/env python3
"""
This module updates all Powershell scripts in Intune if the configuration in Intune differs from the JSON/YAML file.
Parameters
----------
path : str
The path to where the backup is saved
token : str
The token to use for authenticating the request
"""
import json
import os
import b... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from pip.req import parse_requirements
import re, ast
# get version from __version__ variable in kts_custom/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('kts_custom/__init__.py', 'rb') as f:
version = str(ast.literal_... |
a = "Jingle bells, Jingle bells Jingle all the way Oh what fun it is to ride"
print(a[0])
print(a[1])
print(a[0:10])
print(a[0:10:2])
print(a[::3])
print(a[::-1]) |
###########################################################################
#
# 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/l... |
# Train and fine-tune a Decision Tree for the oons dataset
# by following these steps:
# a. Use make_moons(n_samples=10000, noise=0.4)
#
# b. Use train_test_split() to split the datset in to a training
# set and test set.
#
# c. Use grid search with cross-validation (with the help of the
# GridSearchCV class) to find g... |
bl_info = {
"name": "Materials Toolbox",
"author": "monika ouza",
"blender": (2, 76),
"location": "View3D > CTR +SHIFT+ M key",
"description": "Menu of Material Tools for Simulation: Loads Predefined Materials, Change from Infrared to Radar Materials and viseversa, Define new Materials, Use paramete... |
import re
from functools import total_ordering
from typing import Sequence
indentation_chars = 4
class ParsedLine:
def __init__(self, orig):
self._orig = orig
leading_white_space_re = re.compile('^( *)(.*)')
m = leading_white_space_re.match(self._orig)
if m:
indentat... |
from .Utils.MLP import MLP, MNISTCNN, CIFAR10CNN, SubMNISTCNN
from .Utils.NormalizingFlowFactories import *
from .Conditionners import AutoregressiveConditioner, DAGConditioner, CouplingConditioner, Conditioner
from .Normalizers import AffineNormalizer, MonotonicNormalizer
from .Utils.Distributions import * |
"""The motionEye integration."""
from __future__ import annotations
import asyncio
import logging
from typing import Any, Callable
from motioneye_client.client import (
MotionEyeClient,
MotionEyeClientError,
MotionEyeClientInvalidAuthError,
)
from motioneye_client.const import KEY_CAMERAS, KEY_ID, KEY_NAM... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.