text stringlengths 1 927k |
|---|
from .camelify import camelify_dict, camelify
import os
def correct_param(name, value):
if name == "img" and not value.startswith("http"):
name = "imagePath"
if name.endswith("Path"):
name = name[:-4] + "Url"
value = "file://" + os.path.abspath(value)
elif name == "audio" or name =... |
"""
dj-stripe Account Tests.
"""
from copy import deepcopy
from unittest.mock import patch
import pytest
from django.test.testcases import TestCase
from djstripe.models import Account
from djstripe.settings import STRIPE_SECRET_KEY
from . import (
FAKE_ACCOUNT,
FAKE_FILEUPLOAD_ICON,
FAKE_FILEUPLOAD_LOGO,... |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY')
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED... |
"""permissions for FRCR review
Revision ID: eaef1147f25c
Revises: b72d4946fb3c
Create Date: 2021-01-09 08:11:26.337104
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.sql import column, table
# revision identifiers, used by Alembic.
revision = 'eaef1147f25c'
down_revision = 'b72d4946fb3c'
branch_l... |
import numpy as np
import pytest
from sklearn.linear_model import LinearRegression, LogisticRegression
from ebonite.core.analyzer.model import ModelAnalyzer
from ebonite.ext.sklearn import SklearnModelWrapper
@pytest.fixture
def inp_data():
return [[1, 2, 3], [3, 2, 1]]
@pytest.fixture
def out_data():
retu... |
from werkzeug.routing import Map, Rule
url_map = Map([
Rule('/', endpoint='home')
]) |
# Initialize weights
from torch.nn import init, Conv3d, BatchNorm3d, Linear
def xavier(x):
"""Wrapper for torch.nn.init.xavier method.
Parameters
----------
x : torch.tensor
Input tensor to be initialized. See torch.nn.init.py for more information
Returns
-------
torch.tensor
... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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... |
"""The store routes
"""
# Django Library
from django.urls import path
# Localfolder Library
from ..views.attribute import (
AttributeCreateView, AttributeDeleteView, AttributeDetailView,
AttributeListView, AttributeUpdateView)
app_name = 'PyAttribute'
urlpatterns = [
path('', AttributeListView.as_view(),... |
# test04 code prints to serial the following:
# print (sec, accel, peaks[current_peak-1], peaks_sec[current_peak-1],
# valleys[current_valley-1], valleys_sec[current_valley-1], amplitude_avg)
# we capture this here and save
import serial
import time
import csv
# Typing dmesg | tail will shows you which /d... |
#!/usr/bin/env python
# Script by Steven Black
# https://github.com/StevenBlack
#
# This Python script will update the readme files in this repo.
import json
import os
import time
from string import Template
# Project Settings
BASEDIR_PATH = os.path.dirname(os.path.realpath(__file__))
README_TEMPLATE = os.path.join(... |
from typing import Dict, List, Optional, Set
import aiosqlite
import sqlite3
from tranzact.types.blockchain_format.coin import Coin
from tranzact.types.blockchain_format.sized_bytes import bytes32
from tranzact.util.db_wrapper import DBWrapper
from tranzact.util.ints import uint32, uint64
from tranzact.wallet.util.wa... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TODO: Test FITS parsing
# STDLIB
import io
import re
import gzip
import base64
import codecs
import urllib.request
# THIRD-PARTY
import numpy as np
from numpy import ma
# LOCAL
from astropy.io import fits
from astropy import __version__ as astropy_ver... |
# -*- coding: utf-8 -*-
#
# 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... |
import tensorflow as tf
import numpy as np
from feature import Feature
import sqlite3
import pickle
db = sqlite3.connect('ptt.db')
cur = db.execute('SELECT * FROM ARTICLES LIMIT 1000')
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
f = Feature()
post_data = []
push_data = []
boo_data = []
for i in c... |
__author__ = 'thor'
import os
import pandas as pd
from pymongo import MongoClient
from pymongo.cursor import Cursor
from ut.sound import util as sutil
from ut.daf.manip import reorder_columns_as
from ut.sound.util import Sound
from ut.pstr.trans import str_to_utf8_or_bust
class MgDacc(object):
def __init__(sel... |
import random
diceList = "4, 6, 8, 10, 12, 20, 30, 100".split(", ")
for roll in diceList:
result = "d" + roll + ": " + str(random.randint(1,int(roll)))
print result |
# -*- coding: utf-8 -*-
"""Unit test package for sig2srv.""" |
from typing import Tuple, Union
import numpy as np
_np_uints = {
8: np.uint8,
16: np.uint16,
32: np.uint32,
64: np.uint64,
}
_np_ints = {
8: np.int8,
16: np.int16,
32: np.int32,
64: np.int64,
}
_np_floats = {
16: np.float16,
32: np.float32,
64: np.float64,
}
_np_complex ... |
#!/usr/bin/env python
import numpy as np
from parameters import *
from snn import TargetFollowingSNN, ObstacleAvoidanceSNN, nest_simulate
class Model:
def __init__(self):
self.snn_tf = TargetFollowingSNN()
self.snn_oa = ObstacleAvoidanceSNN()
self.turn_pre = 0.0
self.angle_pre = 0.0
self.weights_tf = []
... |
"""``cupy``-based implementation of the random module
"""
__author__ = "Taro Sekiyama"
__copyright__ = "(C) Copyright IBM Corp. 2016"
import numpy.random as r
import cupy as cp
def _to_gpu(a):
arr = cp.empty_like(a)
arr.set(a)
return arr
class RandomState:
def __init__(self, seed):
self._... |
import logging
import shutil
import tempfile
import tkinter as tk
from tkinter.filedialog import *
from PIL import Image
# 命令提示行的颜色代码
YELLOW = "\033[33m"
GREEN = "\033[32m"
CYAN = "\033[36m"
GRAY = "\033[37m"
RESET = "\033[0;39m"
# 临时放置处理文件的文件夹
TMP_ASSETS_DIR = tempfile.TemporaryDirectory()
# 日志初始化
logging.basicCon... |
import os
import cv2
import sys
import random
import math
import re
import time
import numpy as np
import tensorflow as tf
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import skimage
import glob
ROOT_DIR = os.getcwd()
sys.path.append(ROOT_DIR)
from Mask_RCNN.mrcnn import util... |
from django.db.models import Sum, F
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login, get_user_model
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib import messages
from django.urls i... |
## python to get alt fasta
import argparse, os
parser = argparse.ArgumentParser()
parser.add_argument("-name", help = "output name, eg. ENCFF758RQJ", required = True)
parser.add_argument("-input_file", help = "please give an AS bed file's path", required = True)
parser.add_argument("-fa", help = "please give the path o... |
#!/usr/bin/env python
# Copyright 2016 Vijayaditya Peddinti.
# 2016 Vimal Manohar
# Apache 2.0.
""" This script is similar to steps/nnet3/train_dnn.py but trains a
raw neural network instead of an acoustic model.
"""
from __future__ import print_function
from __future__ import division
import argpars... |
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origin... |
# -*- coding: utf-8 -*-
"""
Class definition of YOLO_v3 style detection model on image and video
"""
import colorsys
import os
from timeit import default_timer as timer
import numpy as np
from keras import backend as K
from keras.models import load_model
from keras.layers import Input
from PIL import Image, ImageFont... |
from marshmallow import Schema, fields, pre_load, post_dump
class UserSchema(Schema):
id = fields.Int()
title = fields.Str()
subtitle = fields.Str()
intro = fields.Str()
logo = fields.Str()
@pre_load
def make_user_data(self, data):
return data
@post_dump
def dump_user(self... |
from uuid import uuid4
from meniscus.openstack.common.timeutils import isotime
from meniscus.sinks import DEFAULT_SINK
class EventProducer(object):
"""
An event producer is a nicer way of describing a parsing template
for a producer of events. Event producer definitions should be
reusable and not spec... |
import pytest
import numpy as np
import torch
from openunmix import transforms
@pytest.fixture(params=[4096, 44100])
def nb_timesteps(request):
return int(request.param)
@pytest.fixture(params=[1, 2])
def nb_channels(request):
return request.param
@pytest.fixture(params=[1, 2])
def nb_samples(request):
... |
"""SCons.Variables
This file defines the Variables class that is used to add user-friendly
customizable variables to an SCons build.
"""
#
# __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 ... |
#!/usr/bin/env python
import sys
def usage():
print 'usage: %s in_file out_file_prefix' % sys.argv[0]
chrs = [
"chr1",
"chr2",
"chr3",
"chr4",
"chr5",
"chr6",
"chr7",
"chr8",
"chr9",
"chr10",
"chr11",
"chr12",
"chr13",
"chr14",
"chr15",
"chr16",
"chr17",
"chr18",
"chr19",
"chr20",
"chr21",
"chr22",
"chrX",
"chr... |
import rebound |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bui... |
import pytest
from numpy import ma, array
import numpy
import pandas as pd
from pymc3_ext import Model, Normal, sample_prior_predictive, sample, ImputationWarning
def test_missing():
data = ma.masked_values([1, 2, -1, 4, -1], value=-1)
with Model() as model:
x = Normal('x', 1, 1)
with pytest.wa... |
from django.db import models
from django.contrib.auth import get_user_model
User = get_user_model()
class Group(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(verbose_name='URL', max_length=50, unique=True, blank=True, null=True)
description = models.TextField(max_length=... |
#!/usr/bin/env python3
#
# Copyright 2015 Robert Kjaran
#
#
from collections import OrderedDict
from pprint import pprint
# Eiríkur Rögnvaldsson. Icelandic Phonetic Transcription.
ER_PHONEMES_SAMPA = {
# Consonants Plosives
'p',
'p_h',
't',
't_h',
'c',
'c_h',
'k',
'k_h',
# Cons... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of CbM (https://github.com/ec-jrc/cbm).
# Author : Guido Lemoine
# Credits : GTCAP Team
# Copyright : 2021 European Commission, Joint Research Centre
# License : 3-Clause BSD
# Version :
import time
import sys
import os
import io
import json... |
#!/usr/bin/env python
"""This illustrates the basic functionality of notify2 - creating and displaying
a notification message.
"""
import notify2
# This must be called before using notify2
notify2.init("Demo application")
# A number of stock
n = notify2.Notification("Summary", "Body text goes here",
"no... |
list1 = [1, 10, 3, 4, 6]
if 3 in list1:
print("3 is in list.")
if 11 not in list1:
print("list doesn't contain 11")
variable1 = 4
if list1[3] == variable1:
print("element in index 3 is equal to variable1")
my_string = "this is an example string"
print(my_string[0])
print(my_string[1])
print(my_string[2])
if ... |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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... |
import logging
from concurrent.futures.process import ProcessPoolExecutor
logger = logging.getLogger(__name__)
def process_pool_factory(num_workers: int):
async def process_pool(app_instance):
logger.debug("Setting up process pool with %r workers", num_workers)
pool = ProcessPoolExecutor(max_wo... |
# coding=utf-8
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
"""This module implements the built-in data types of the Scheme language, along
with a parser for Scheme expressions.
In addition to the types defined in this file, some data types in Scheme are
represented by their corresponding type in Python:
number: int or float
symbol: string
boolean: ... |
"""The runserver command"""
from __future__ import print_function
from os_tornado.commands import Command
from os_tornado.component_manager import ComponentManager
from os_tornado.exceptions import UsageError
from os_tornado.runner import Runner
class RunserverCommand(Command):
"""Command for starting server"""
... |
# regex.py
#
# Copyright 2017 Daniel Mende <mail@c0decafe.de>
#
# 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
#... |
# pylint: disable = C0111
from setuptools import find_packages, setup
with open("README.md", "r") as f:
DESCRIPTION = f.read()
setup(name="txtai",
version="1.4.0",
author="NeuML",
description="AI-powered search engine",
long_description=DESCRIPTION,
long_description_content_type="tex... |
import time
from numpy.random import seed
seed(8) #1
import tensorflow
tensorflow.random.set_seed(7)
# tensorflow.random.set_random_seed(7)
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
from tensorflow.keras import backend as K
from tensorflow.... |
from luigi.mock import MockTarget
from examples import batch as b
from luigi_batch_flow.task import Task
class FirstTask(Task):
"""
FirstTask is an example.
"""
batch = b.FirstBatch()
target = MockTarget("first_task.txt")
class SecondTask(Task):
"""
SecondTask is an example.
"""
... |
from django.apps import AppConfig, apps
from django.conf import settings
from .mapping import Indexable
from .registry import register
from .utils import import_class
import importlib
import inspect
import logging
logger = logging.getLogger(__name__)
class SeekerConfig (AppConfig):
name = 'seeker'
def re... |
import os
ids = [d for d in os.listdir(VOX_CELEB_LOCATION) if d[0:2] == 'id']
train = ids[0:int(0.7*len(ids))]
val = ids[int(0.7*len(ids)):int(0.8*len(ids))]
test = ids[int(0.8*len(ids)):]
import numpy as np
np.save('./large_voxceleb/train.npy', np.array(train))
np.save('./large_voxceleb/test.npy', np.array(test))
... |
from django import forms
from django.contrib.auth.models import User
from .models import Profile
class LoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
class UserRegistrationForm(forms.ModelForm):
password = forms.CharField(label='Password', widg... |
#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# Un... |
"""
Install the package containing the SPARQL kernel for Jupyter.
To actually use the kernel it needs to be installed into Jupyter afterwards.
"""
from __future__ import print_function
import os
import os.path
import sys
from setuptools import setup
from sparqlkernel.constants import __version__, LANGUAGE, DISPLAY_N... |
from django.shortcuts import get_object_or_404
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, generics, status, viewsets
from rest_framework.exceptions import ValidationError
from rest_framework.permissions import IsAuthenticated, IsAuthenticatedOrReadOnly
from rest_f... |
#The MIT License (MIT)
#Copyright (c) 2018 Microsoft Corporation
#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, modi... |
import unittest
import nzmath.sequence as sequence
class SequenceTest(unittest.TestCase):
def testGeneratorFibonacci(self):
gf = sequence.generator_fibonacci(40)
fibo_40 = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610,
987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368,... |
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=210)
evaluation = dict(interval=5, metric='PCK', key_indicator='PCK')
COLOR = 'black'
EXTEND = '15'
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = ... |
from lamost_cannon import *
import sys
sys.path.append('/data/jls/cyanide/comparisons/')
sys.path.append('../')
from neural_network import *
from spectro_data.lamost import *
l = load_and_match(use_dr1=True)
model = tc.CannonModel.read(
'/data/jls/GaiaDR2/spectro/lamost_cannon/lamost.cannon')
data = full_sample()[... |
class CommandLineInterface:
def __init__(self):
self.commands = dict()
def loop(self):
while True:
command = ""
if command in self.commands.keys():
pass
def add_command(self):
pass |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
# -*- coding: utf-8 -*-
import pytest
from plexapi.exceptions import NotFound
from . import conftest as utils
def test_library_Library_section(plex):
sections = plex.library.sections()
assert len(sections) >= 3
section_name = plex.library.section('TV Shows')
assert section_name.title == 'TV Shows'
... |
"""
Contains class that runs inferencing
"""
import torch
import numpy as np
from networks.RecursiveUNet import UNet
from utils.utils import med_reshape
class UNetInferenceAgent:
"""
Stores model and parameters and some methods to handle inferencing
"""
def __init__(self, parameter_file_path='', mode... |
from abc import abstractmethod
import matplotlib.pyplot as plt
import pytorch_lightning as pl
import torch
import torchvision.utils as vutils
from torch import optim
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import CelebA
from datasets.concrete_cracks import ... |
"""Basic checks for HomeKit air quality sensor."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.helpers import entity_registry as er
from tests.components.homekit_controller.common import setup_test_component
def create_air_... |
import threading
from typing import NoReturn, Union, no_type_check
class AutoResetEvent(threading.Event):
"""Like threading.Event, except that wait() resets the event automatically."""
@no_type_check # I don't know why MyPy refuses to believe that threading.Event has properties self._cond and self._flag.
... |
from collections import OrderedDict
import graphene
from django.core.exceptions import ImproperlyConfigured
from graphene.types.mutation import MutationOptions
from graphene_django.form_converter import convert_form_field
from graphene_django.registry import get_global_registry
from graphql_jwt.decorators import staff... |
""" Script to define and execute a series of Salish Sea NEMO model runs.
All use the same RC4, corr4 files but include different numbers of tidal
constituents
"""
from __future__ import absolute_import
import os
import salishsea_cmd.api
def main():
run_desc = base_run_description()
runs = ('RC4_wO1S2', ... |
from ColorPair_get_data import get_color_from_pair_number
from ColorPair_get_data import get_pair_number_from_color
def test_functionalities():
test_number_to_pair(4, 'White', 'Brown')
test_number_to_pair(5, 'White', 'Slate')
test_pair_to_number('Black', 'Orange', 12)
test_pair_to_number('Violet', 'Slate', 25)... |
# 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 ... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
from utils import tools
from optimizedGPS.data.data_generator import generate_bad_heuristic_graphs
from optimizedGPS.problems.Heuristics import RealGPS
from optimizedGPS.problems.simulator import FromEdgeDescriptionSimulator
def get_RealGPS_badness_stats(congestions=iter([])):
res = []
traffic_influence = 2
... |
# Copyright (c) 2019, 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
import os
from pathlib import Path, PurePath
import platform
import shlex
import shutil
import subprocess
import sys
import textwrap
from west import configuration as config
import pytest
GIT = shutil.which('git')
# If you c... |
from __future__ import absolute_import
from .spec.base import BaseObj
import six
def default_tree_traversal(root, leaves):
""" default tree traversal """
objs = [('#', root)]
while len(objs) > 0:
path, obj = objs.pop()
# name of child are json-pointer encoded, we don't have
# to e... |
from UdonPie import UnityEngine
from UdonPie.Undefined import *
class VerticalWrapMode:
def __new__(cls, arg1=None):
'''
:returns: VerticalWrapMode
:rtype: UnityEngine.VerticalWrapMode
'''
pass |
##################################################
# NetworkService_services_types.py
# generated by ZSI.generate.wsdl2python
##################################################
import ZSI
import ZSI.TCcompound
from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED
############... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
import argparse
import os
import numpy as np
import tensorflow as tf
import thumt.data.dataset as dataset
import thumt.data.record as record
import thumt.data.vocab as vocabulary
import thumt.models as models
import thumt.utils.hooks as hooks
impo... |
"""Test the AirNow config flow."""
from unittest.mock import patch
from pyairnow.errors import AirNowError, InvalidKeyError
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.airnow.const import DOMAIN
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGIT... |
from heapq import *
from environment.utils import distance, neighbors, direction
class Node(object):
def __init__(self, position, parent, cost, heuristic):
self.position = position
self.parent = parent
self.cost = cost
self.heuristic = heuristic
def __lt__(self, other):
... |
from typing import TypeVar, cast
import pytest
from cs.structures import BinarySearchTree, RedBlackTree, Tree
from cs.util import Comparable
T = TypeVar("T", bound=Comparable)
parametrize_tree_types = pytest.mark.parametrize(
"tree_type", ("BinarySearchTree", "RedBlackTree")
)
TEN_ELEMS = (8, 3, 6, 1, 10, 14, 13... |
"""momentsinfo_convroll4_doublescale_fs5"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learning_rate_schedule = {
... |
# -*- coding: utf-8 -*-
'''
Clase Pescado
Genera un objeto pescado sacado de un archivo STL
Hereda la clase Alimento
'''
from Alimento import Alimento
# Clase Pescado
# Campos:
# nombreArchivo (contiene el nombre del archivo STL): str
# rugosidad (si es rugoso o brillante): str
class Pescado(Alimento):
# Constru... |
import uuid
from django.db import models
# Create your models here.
class Question(models.Model):
content = models.CharField(max_length=255)
class Answer(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
recording_url = models.URLField(max_length=255)
questi... |
import unittest
from craft_ai.pandas import CRAFTAI_PANDAS_ENABLED
if CRAFTAI_PANDAS_ENABLED:
import copy
import pandas as pd
import craft_ai.pandas
from .data import pandas_valid_data
from .utils import generate_entity_id
from . import settings
AGENT_ID_1_BASE = "test_1_df_pd"
AGEN... |
from arches.app.search.components.base import BaseSearchFilter
from arches.app.search.elasticsearch_dsl_builder import Bool, Terms
details = {
"searchcomponentid": "",
"name": "Provisional Filter",
"icon": "",
"modulename": "provisional_filter.py",
"classname": "ProvisionalFilter",
"type": "",
... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'airline.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Import... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
from keras.models import Sequential
from keras.layers import Activation, Dropout, UpSampling2D, ZeroPadding2D
from keras.layers import Conv2DTranspose, Conv2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras import regularizers
def CreateModel(input_shape):
pool_size = (2, 2)
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 16:01
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
("wagtailgridder", "0001_squashed_0012_auto_20170607_1317"),
]
op... |
import argparse
from smart_fly_class import SmartFlies
ap = argparse.ArgumentParser()
ap.add_argument('-f', '--nFlies', type=int, default=200, help='Number of flies to create')
ap.add_argument('-o', '--nObstacles', type=int, default=4, help='Number of obstacles')
ap.add_argument('-g', '--nGenerations', type=int, defau... |
import csv
def ClassFactory(class_name, dictionary):
return type(class_name, (object,), dictionary)
class CsvReader:
data = []
def __init__(self, filepath):
self.data.clear()
with open(filepath) as text_data:
csv_data = csv.DictReader(text_data, delimiter=',')
fo... |
"""
This is a hybrid placement algorithm(offline mode)
"""
from sympy.solvers import solve
from sympy import Symbol
#this is testing plot
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import numpy as np
import math
import random
import Node as nd
import EH_relay as relay_nd
impor... |
# VolScan is a Binance Volatility Bot(BVT Bot)
# compatible module that generates crypto buying signals based upon negative price change & volatility.
# It does this in two different ways,
# the main one being by calculating the aggregate price change within a user defined period,
# the second way being by use of the C... |
# 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 ... |
# Copyright (c) 2013, jan and contributors
# For license information, please see license.txt
import frappe
from frappe.utils import money_in_words
from calendar import monthrange
def get_columns(filters):
columns = [
# {"label": "SL#","fieldname": "sl_number", "fieldtype": "Data", "width": "50"},
... |
from django.urls import path
from django.views.generic import TemplateView
from .views import (
EventsListView, EventDetailView, EventCreateView, EventDeleteView, DashboardView
)
app_name = "customer-portal"
urlpatterns = [
path('dashboard', DashboardView.as_view(), name='dashboard'),
path('event/', Event... |
# -*- coding: utf-8 -*- #
# Copyright 2016 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 requir... |
n, q = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = map(int, input().split())
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
c = [0] * q
d = [0] * q
for i in range(q):
c[i], d[i] = map(int, input().split())
c[i] -= 1
d[i] -= 1
from collections import d... |
"""
A Random forest model
"""
__author__ = "Jon Wiggins"
from decisiontree import *
import pandas as pd
import operator
class RandomForest:
"""
A Random forest model
"""
def __init__(self):
self.forest = []
self.target_label = None
def train(
self,
examples,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.