content stringlengths 5 1.05M |
|---|
# coding: utf-8
# In[ ]:
import math
import numpy as np
# In[ ]:
f1=open('predictspeed1')
f2=open('predictspeed2')
f3=open('predictt')
f4=open('predictp')
f5=open('predictu')
f6=open('predictv')
f7=open('predictw')
f=[f1,f2,f3,f4,f5,f6,f7]
g=open('realspeed')
# In[ ]:
import numpy as np
import re
# In[ ]:
d... |
'''
Build a Query to Determine the Average Age by Population
In this exercise, you will use the func.sum() and group_by() methods to first determine the average age weighted by the population in 2008, and then group by sex.
As Jason discussed in the video, a weighted average is calculated as the sum of the product of... |
# viscore.py -- core vision processing functions
# Written for the 2017 FRC Season (Steamworks)
# By Sebastian Mobo
import numpy as np
import math
import cv2
import sys
#
# Vision Target Specs:
#
# There are two vision targets on either side of the peg:
#
# |X| |X|
# |X| |X|
# |X| O |X|
# |X| |X|
# |X| |X|
#
... |
# Generated by Django 3.2 on 2021-04-22 18:45
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Semester',
fields=[
... |
import json
import os
import subprocess
import sys
from typing import Optional
import httpx
class CoverageService:
"""
Class to be used in the gitlab-ci to ensure pipeline test coverage is not dropping on commit
"""
def __init__(self) -> None:
super().__init__()
# Get ENV variables
... |
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
nums.sort()
for ind,i in enumerate(nums):
l,r = ind+1, len(nums)-1
while l<=r:
m = l + (r-l)//2
if nums[m]==i:
return i
elif nums[m]<i:
... |
import os
import pandas as pd
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.utils as vutils
from torch.utils.data import DataLoad... |
import os.path
from setuptools import setup, find_packages
# The directory containing this file
HERE = os.path.abspath(os.path.dirname(__file__))
# The text of the README file
with open(os.path.join(HERE, "README.md")) as fid:
README = fid.read()
setup(
name="LatoLog",
version="0.1.2",
author="Fábio ... |
import matplotlib.pylab as plt
import numpy as np
import pinyin
import soundfile as sf
import torch
from config import sampling_rate
from utils import text_to_sequence, ensure_folder, plot_data, Denoiser
if __name__ == '__main__':
checkpoint = 'BEST_checkpoint.tar'
checkpoint = torch.load(checkpoint)
mode... |
def matriz3():
'''Matriz 3x3'''
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for l in range(0, 3):
for c in range(0, 3):
matriz[l][c] = int(input(f'Digite um valor para [{l}, {c}]: '))
prin = (matriz[0][0] * matriz[1][1] * matriz[2][2]) + (matriz[0][1] * matriz[1][2] * matriz[2][0]) + ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
class Net(nn.Module):
"""Construct network."""
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=6, kernel_size=5... |
### Generate an optimal voice leading sequence for a sequence of chords
from freqs import *
from music21 import *
class Motion(int):
'Enumeration type for contrapuntal motion.'
parallel = 0
oblique = 1
similar = 2
contrary = 3
def __new__(cls, n1, m1, n, m):
'Motion(n1, m1, n, m) -> the type of motion from ... |
"""
Example showing the axes and grid helpers with a perspective camera.
* The grid spans the x-z plane (red and blue axis).
* The green axis (y) stick up from the plane.
* The red box fits snugly around the grid.
"""
# test_example = true
from wgpu.gui.auto import WgpuCanvas, run
import pygfx as gfx
canvas = WgpuC... |
from typing import List, Tuple
import pygame
from pygame.locals import *
from gui.guiNode import GuiNode
#from gui.guiLabel import GuiLabel
from chess.board import Board
class GuiChessBoard(GuiNode):
def __init__(self, position: List, board: Board) -> None:
super().__init__(position)
self.board = board
sel... |
print('A: Ótimo\nB: Bom\nC: Regular\nD: Ruim\nE: Péssimo')
a = 0
b = 0
c = 0
d = 0
e = 0
num = 0
sumageD = 0
maiorE = 0
maiorD = 0
maiorA = 0
for i in range(10):
vt = input('Qual sua nota de A a E? ')
age = int(input('Qual sua idade? '))
num += 1
if vt == 'A' or vt == 'a':
a += 1
if age ... |
from rest_framework.views import APIView
from rest_framework.response import Response
from django.db.models import Count, F, Q
from account.models import User
from .models import TextGenHistory
from django.utils import timezone
import datetime
class RankingGenerateAPIView(APIView):
def get(self, request):
... |
def example(Simulator):
from csdl import Model, NonlinearBlockGS
import csdl
import numpy as np
class ExampleLiterals(Model):
def define(self):
x = self.declare_variable('x', val=3)
y = -2 * x**2 + 4 * x + 3
self.register_output('y', y)
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 27 10:03:12 2021
Reference article: [1]W.-T. Wu, Y.-H. Liao, and F.-Y. Lin, “Noise suppressions in synchronized chaos lidars,” Opt. Express, vol. 18, no. 25, p. 26155, Dec. 2010, doi: 10.1364/OE.18.026155.
@author: pascalzhang
"""
import numpy as np
from numpy import si... |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.6.6, generator: @autorest/python@5.12.0)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# ------------------------------... |
from __future__ import print_function
from __future__ import division
import sys
import argparse
parser = argparse.ArgumentParser(description='Split input into mulitple file on lines based on character count')
parser.add_argument('--c', type=int, default=5000, help='Maximum number of characters per file (Default: 500... |
"""Stores implementations of input data parsers"""
from typing import List
import pandas as pd
from dataVisualizer.data_containers.compound import Compound
from dataVisualizer.exceptions import NotFound
class DataMatrix:
"""Represents Data Matrix"""
def __init__(self, compounds: List[Compound], data: pd.Da... |
#!/usr/bin/env python3
"""
run.py: run ocrevaluation-docker
usage: run.py
code source: https://github.com/nlppln/ocrevaluation-docker
20181127 erikt(at)xs4all.nl
"""
from nlppln import WorkflowGenerator
with WorkflowGenerator() as wf:
wf.load(step_file='https://raw.githubusercontent.com/nlppln... |
from rpython.rlib.unroll import unrolling_iterable
dual_implementation_opcodes = [
'Add_Subtract_Multiply_Divide_Remainder',
'AggFinal',
'AggStep',
'Affinity',
'Cast',
'CollSeq',
'Compare',
'Copy',
'EndCoroutine',
'Function',
'Gosub',
'Goto',
'IdxLE_IdxGT_IdxLT_IdxGE... |
#!/usr/bin/python3
import hardware, time, artnet, sys
class App:
def __init__(self):
self._deviceManager = None
self._running = False
self._drawers = []
self._onewire = []
self.waitForKey = True
self.currentKey = ''
self.oneWireLed = False
self.halted = False
self.disableInput = False
def handle_... |
"""
Kivy interface to show data received from UDP in real time.
"""
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.properties import StringProperty, NumericProperty, ObjectProperty
from kivy.clock import Clock
from kivy.core.window import Window
from ... |
from insertion_sort import __version__
from insertion_sort.insertion_sort import insertion_sort
def test_version():
assert __version__ == '0.1.0'
def test_insert_sorting():
actual = insertion_sort([8, 4, 23, 42, 16, 15])
assert actual == [4, 8, 15, 16, 23, 42]
|
import unittest
from dbt.exceptions import ConnectionException
from dbt.clients.registry import _get_with_retries
class testRegistryGetRequestException(unittest.TestCase):
def test_registry_request_error_catching(self):
# using non routable IP to test connection error logic in the _get_with_retries functi... |
"""
Benchmarks of isotonic regression performance.
We generate a synthetic dataset of size 10^n, for n in [min, max], and
examine the time taken to run isotonic regression over the dataset.
The timings are then output to stdout, or visualized on a log-log scale
with matplotlib.
This allows the scaling of the algorit... |
from cyberbrain import Binding, InitialValue, Symbol
from utils import assert_GetFrame
def test_unpack(tracer, rpc_stub):
l1 = [1, 2]
numbers = [1, 2, 3, 4]
m1 = m2 = {1: 2}
tracer.start()
a, b = "hi" # UNPACK_SEQUENCE
a, b = l1 # UNPACK_SEQUENCE
first, *rest = numbers # UNPACK_EX
... |
import numpy as np
import multiprocessing as mp
import pyfftw
from numpy import pi, exp, sqrt, sin, cos, conj, arctan, tanh, tan
from numpy import heaviside as heav
import matplotlib.pyplot as plt
import h5py
# ---------Spatial and potential parameters--------------
Mx = My = 64
Nx = Ny = 128 # Number of grid pts
dx... |
#!/usr/bin/env python
# Copyright 2019 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... |
# encoding=utf-8
"""
@Time: 2019/7/10 12:51
@Author: liushuo
@File: init.py
@Desc:
@Software: PyCharm
"""
from demo2sql import db
if __name__ == '__main__':
db.create_all()
|
import uuid
import django.utils.timezone
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): # lint-amnesty, pylint: disable=missing-class-docstring
dependencies = [
('student', '0001_squashed_0031_auto_20200317_1122... |
import pandas
import numpy
seed = 42
numpy.random.seed(seed)
import tensorflow as tf
tf.set_random_seed(seed)
import csv
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import Pipeline
from keras.layers.co... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from descarteslabs.common.proto.health import health_pb2 as descarteslabs_dot_common_dot_proto_dot_health_dot_health__pb2
class HealthStub(object):
"""Miss... |
import argparse
import time
# from others.logging import init_logger
# from prepro import data_builder
from transformers import BertTokenizer
def process_chinese_ids(args):
add_token_list = ['[unused1]', '[unused2]', '[unused3]', '[unused4]', '[unused5]']
print(args.temp_dir)
tokenizer = BertTokenizer.fro... |
import io
import os
import pickle
from typing import Union, Any, List
import numpy as np
import cv2
from googleapiclient.http import MediaIoBaseDownload
# For google client imports
import google
import googleapiclient
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentia... |
import sys, pygame
from item import *
pygame.init()
# size represents the size
size = width, height = 640, 480
# backgroundColor represents the background color
backgroundColor = (100, 100, 100)
# the speed of the first ball
ballSpeed1 = [2,4]
# the speed of the seoncd ball1
ballSpeed2 = [1,3]
black = (0, 0, 0)
whit... |
"""Imprime a soma dos dígitos de um número inteiro."""
numero = int(input('Digite um número inteiro: '))
soma_dos_digitos = 0
while numero > 0:
ultimo_digito = numero % 10
soma_dos_digitos += ultimo_digito
numero = numero // 10
print(soma_dos_digitos)
|
# -*- coding: UTF-8 -*-
from plc800stg.measure_events import PlcMeasureEventsParser
from plc800stg.utils import assert_list_dict_eq
from ast import literal_eval
with description('Parse meter events from PLC800 with plc800stg'):
with it('Parsing events'):
input_events_plc = open('spec/data/09EVMarmol2003140... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import time
import unittest
from syncer import sync
from pyppeteer.errors import ElementHandleError, NetworkError, TimeoutError
from .base import BaseTestCase
from .frame_utils import attachFrame, detachFrame, dumpFrames, navigateFrame
from .utils import... |
# Generated by Django 3.0.8 on 2020-07-14 04:45
import datavalidation.results
from django.db import migrations, models
import django.db.models.deletion
import enumfields.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
... |
# Copyright 2009 Yelp
#
# 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
... |
import numpy as np
import matplotlib.pyplot as plt
from bokeh import pyplot
from bokeh import plotting
x = np.linspace(-2 * np.pi, 2 * np.pi, 100)
y = np.sin(x)
plt.plot(x, y, "r-")
plt.title("Matplotlib Figure in Bokeh")
# dashed lines work
#plt.plot(x,y,"r-x", linestyle="-.")
pyplot.show_bokeh(plt.gcf(), filenam... |
import sys as _sys
from apodeixi.util.a6i_error import FunctionalTrace
from apodeixi.cli.tests_integration.cli_test_skeleton import CLI_Test_Skeleton
from apodeixi.cli.tests_integration.cli_basic_script import CLI_Basic_Script
class Test_CL... |
import numpy as np
from models import rbm as rbm_mod
def partition_function_exact(model, batchsize_exponent='AUTO'):
# We transform the DBM to an RBM with restricted connections.
rbm = rbm_mod.RBM(number_visibles = model.input + model.output,
number_hiddens = model.hidden,
... |
###############################################################################
# Copyright Maciej Patro (maciej.patro@gmail.com)
# MIT License
###############################################################################
import unittest
from cmake_tidy.parsing.cmake_parser import CMakeParser
from cmake_tidy.lexic... |
from asmdot import * # pylint: disable=W0614
from typing import Tuple
header = '''// Automatically generated file.
package {}
import (
\t"bytes"
\t"encoding/binary"
\t"errors"
\t"io"
)
// Bypass unused module error if we don't have assertions.
var _ = errors.New
var (
\tinterbuf = [8]byte{{}}
\tbyteOrder ... |
default_app_config = 'geotrek.zoning.apps.ZoningConfig'
|
import praw
import re
import sumy
import urllib
from sumy.parsers.html import HtmlParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.edmundson import EdmundsonSummarizer as Summarizer
from sumy.nlp.stemmers import Stemmer
from sumy.utils import get_stop_words
from sumy.utils import ItemsCount
from r... |
from polo2 import PoloDb
import pandas as pd
"""
Consider deleting this; it has been replaced by Elements in the Flask app. However, there may be
wisdom in putting something here for more general purpose use.
"""
class PoloReport():
def __init__(self, config, trial_name='trial1'):
# Set some values
... |
import pytest
from i3_battery_block_vgg.font_awesome_glyphs import FA_BATTERY_LIST
from i3_battery_block_vgg.html_formatter import color
from i3_battery_block_vgg.html_formatter import discern_loading_state
from i3_battery_block_vgg.html_formatter import wrap_span
from i3_battery_block_vgg.html_formatter import wrap_s... |
import pyautogui
import random
import time
import cv2
takipEdilen = []
dil = input("Diliniz nedir?\n")
saniye = float(input("Takipler arası süre varsayılan olarak rastgele 10-35 saniye arasında bir değer ile yapılır. Buna ek süre olarak kaç saniye eklemek istersin?\n"))
time.sleep(1)
print("Takip işlemi başl... |
arguments = {
"Usage": "python3 crypto.py ARGUMENT [OPTIONS]",
"Values": {
"-e": {"Name": "encrypt", "Help": "Encrypt data"},
"-d": {"Name": "decrypt", "Help": "Decrypt data"},
"-g": {"Name": "generate key", "Help": "Generate key"},
},
"MinArg": 1,
"MaxArg": 1,
"MutExc": ... |
import datetime
from .time_helpers import strptime, check_intervals
from .mappings import WEIGHT_MAP
def _unassigned_orders_in_time(orders, wh, courier = None, assign_time = None):
assigned = False
response_orders: list = []
working_hours: list = [
[strptime(str_time)
for str_time in inter... |
import argparse
import os
import sys
import chainer
import chainer.links as L
import chainer.optimizers as O
import matplotlib
import numpy as np
from chainer import training
from chainer.backends import cuda
from chainer.optimizer_hooks import GradientClipping
from chainer.training import Trainer, extensions, trigger... |
#!/usr/bin/env python3
import json
import math
from haversine import getDistance
# state cache is a singleton, every threads share the same cache
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, ... |
from django.db import models
class Produto(models.Model):
descricao = models.CharField(max_length=100)
valor_unid = models.DecimalField(max_digits=9, decimal_places=2)
data_insercao = models.DateField(auto_now_add=True)
status = models.BooleanField(default=True)
class Mesa(models.Model):
apelido =... |
from azure.cosmos import CosmosClient,PartitionKey
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
import pandas as pd
import datetime
from api_miners import key_vault as kv
""" Steps
1. Initialize the cosmos client
2. Update all videos
For eac... |
import torch
import time
import functools
from .tools import sync_between_gpu, move2cuda
def print_info(func):
@functools.wraps(func)
def wrapper(args, model, info, input, target):
total_tok = info['total_tok']
cnt = info['cnt']
total_loss = info['total_loss']
... |
#!/usr/bin/env python
import os
import sys
from ConfigParser import ConfigParser
from optparse import OptionParser
sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), os.pardir, 'lib' ) )
import galaxy.config
from galaxy.model.util import pgcalc
from galaxy.objectstore import build_object_store_from_confi... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) 2021 PaddlePaddle 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/l... |
# Copyright 2020 The MathWorks, Inc.
from setuptools import setup, find_packages
setuptools.setup(
name="jupyter-matlab-vnc-proxy",
packages=setuptools.find_packages(where='.'),
version='0.1.0',
description="Jupyter extension to provide MATLAB via VNC connection",
keywords=["Jupyter"],
entry_p... |
"""
## Max Value ##
Write a function, max_value, that takes in list of numbers as an argument.
The function should return the largest number in the list.
Solve this without using any built-in list methods.
You can assume that the list is non-empty.
"""
from time import time
# Defining a decorato... |
import time
import sys
def fibonacci_recursive(n):
if n==0:
return 0
if n==1:
return 1
fib = fibonacci_recursive(n-1) + fibonacci_recursive(n-2)
return fib
if __name__=='__main__':
n = 30
sys.setrecursionlimit(2000)
start_time = time.time()
result = fibonacci_recursive... |
# -*- coding: utf-8 -*-
"""Test: buildtool.py
"""
import unittest
import os
import sys
from io import StringIO
from builder.testutils import print_test_title
from builder import action as act
from builder import enums as em
from builder import person as psn
from builder import day as dy
from builder import stage as stg... |
import json
from configs import ES_MDR_RECORD_INDEX_NAME
from elasticsearch import Elasticsearch
elasticsearch_host = 'http://localhost:9200/'
es_client = Elasticsearch([elasticsearch_host], verify_certs=True)
# JSON file with mdr record index description
with open('./indices/mdr_record.json') as mdr_record_idx:
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 14 13:15:04 2020
@author: tom
"""
import pybamm
import numpy as np
import sys
import matplotlib.pyplot as plt
import ecm
plt.close('all')
Nspm = 20
options = {
"current collector": "potential pair",
"dimensionality": 1,
"thermal": "lumped",
}
model = pyb... |
# -*- coding: utf-8 -*-
from django.db import models
from imagekit.models import ImageSpecField
from pilkit.processors import ResizeToFit
from django.utils.safestring import mark_safe
from django.db.models.signals import post_save, pre_save, pre_delete
from social_network.core.models import (cleaning_files_pre_save,... |
""" Following are some helper functions for Assignment 1. """
def convert_pos(pos) :
""" Converts universal a pos tag to a compatible
universal pos inn Brown corpus. """
if pos=="CCONJ" :
return "CONJ"
elif pos=="AUX" :
return "VERB"
elif pos=="INTJ" :
return "X"
eli... |
#!/usr/bin/env python3
from gevent import monkey; monkey.patch_all()
from arago.actors import Actor, Root
import arago.actors.pattern_matching as matching
from arago.common.logging import getCustomLogger
logger = getCustomLogger(level="WARNING")
class PingPong(Actor):
def serve(self, opponent):
opponent.tell("Ping... |
# -*- coding: utf-8 -*-
#
# This file is part of GetTor, a Tor Browser distribution system.
#
# :authors: Israel Leiva <ilv@torproject.org>
# see also AUTHORS file
#
# :copyright: (c) 2015, The Tor Project, Inc.
# (c) 2015, Israel Leiva
#
# :license: This is Free Software. See LICENSE for lice... |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse("Saludos desde la vista app")
def suma(request,num1,num2):
op1 = int(num1)
op2 = int(num2)
html = "<html><body>La suma de los numeros es: %s </body></html>" % (op... |
import turtle
t = turtle.Turtle()
t.speed(10)
turtle.bgcolor("white")
t.color("white")
turtle.title('Netflix Logo made by Saksham Aggarwal')
t.up()
t.goto(-80,50)
t.down()
t.fillcolor("black")
t.begin_fill()
t.forward(200)
t.setheading(270)
s = 360
for i in range(9):
s = s - 10
t.setheading(s)
t.forward(10)... |
import httplib # Used only for handling httplib.HTTPException (case #26701)
import os
import platform
import re
import urllib
import urllib2
import traceback
import time
from StringIO import StringIO
from kunai.log import logger
from kunai.collector import Collector
class Mongodb(Collector):
def launch(self):
... |
import os
import unittest
from ioc.container import load_container
from ioc.container.provision import Provision
import ioc
DEPS_FILE = os.path.join(os.path.dirname(__file__), 'ioc.xml')
DEPS_FILE2 = os.path.join(os.path.dirname(__file__), 'ioc-overwrite.xml')
class ContainerInjectionTestCase(unittest.TestCase):
... |
import heapq
# Dijkstra's shortest path.
class Dijkstra:
# start_node: node where we start to search.
# end_node: node where to stop.
# max_value: value larger than sum of all possible costs.
# get_neighbors(node): get list of neighbors of node.
# get_cost(node1, node2): get cost of going from nod... |
from PySide6.QtWidgets import QApplication, QMainWindow, QLineEdit
from PySide6.QtCore import Qt
import sys
class Componentes(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Componentes")
# creamos un nuevo componente QLineEdit
linea_texto = QLineEdit()
... |
from zipfile import ZipFile
import requests
from django.conf import settings
from metadata.utils import get_metadata_queryset
__all__= ['DataSelectionZipIterator']
class DataSelectionZipIterator:
'''Iterator that returns the files corresponding to data selections as one big zip file'''
def __init__(self, data_... |
import numpy as np
from tuun.main import Tuun
from examples.branin.branin import branin
config = {
'seed': 11,
'acqfunction_config': {'name': 'default', 'acq_str': 'ei', 'n_gen': 500},
'acqoptimizer_config': {'name': 'neldermead', 'n_init_rs': 10},
'model_config': {'name': 'standistmatgp'},
}
tu = Tuun... |
import os
from django.conf import settings
from pytz import timezone
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from content_management.models import (
Build, Cataloger, Content, Coverage, Creator, Directory, DirectoryLayout, Keyword, Language, Subject, Workarea
)... |
from dataclasses import dataclass, field
from typing import List, Dict,Callable
import numpy as np
from cytoolz import curry
import ast
from pathlib import Path
from ipywidgets import (Layout,Box,HTML,Output,Text,Button)
#NOTE: not recommended use `pipenv install`.
# But using it alternative will take lot to time to ... |
from builtins import map
from builtins import range
from builtins import object
import unittest
import ROOT
import os
from PyAnalysisTools.PlottingUtils import HistTools as ht
from PyAnalysisTools.base import InvalidInputError
cwd = os.path.dirname(__file__)
ROOT.gROOT.SetBatch(True)
class PlotConfig(object):
pa... |
#! /usr/bin/env python3
#! -*- coding: utf-8 -*-
import os, struct, argparse
from PIL import Image
import fsutils
from unicodeutils import UnicodeUtils
DEF_YAML_PATH = './etl_data_def.yml'
DATA_DIR_ROOT = './etl_data'
OUTPUT_ROOT = '{}/images'.format(DATA_DIR_ROOT)
def _read_record(f, data_format):
s = f.read(... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
# from powcai
# Space O(k), k in [1, n]
if k == 1:
return head
dumm... |
from __future__ import print_function, division
import rawpy
import exifread
import numpy as np
import os.path as path
import collections
import skimage.io as io
from . import file_io
import matplotlib.pyplot as plt
image_readers = []
def retrieve_color_section(image, color):
if color is None or len(image.shape)... |
from __future__ import absolute_import
from __future__ import unicode_literals
import re
import sys
from blazeutils.helpers import tolist
from blazeutils.decorators import deprecate
def tb_depth_in(depths):
"""
looks at the current traceback to see if the depth of the traceback
matches any number in the... |
#!/usr/bin/env python
"""
Copyright (c) 2018 Robert Bosch GmbH
All rights reserved.
This source code is licensed under the BSD-3-Clause license found in the
LICENSE file in the root directory of this source tree.
@author: Jan Behrens
"""
import geometry_msgs
import visualization_msgs.msg
from roadmap_tools.scene_obj... |
#! /usr/bin/python3
import sys
sys.path.insert(0, ".")
import point
def cmp(r, t):
epsilon = 0.0001
for p in zip(r, t):
assert(abs(p[0] - p[1]) < epsilon)
def test_Point():
cmp(point.return_Point(), (193, 216))
point.receive_Point(point.Point(87, 97))
def test_Point2i():
cmp(point.re... |
#!/usr/bin/env python
# * coding: utf8 *
"""
cloudb
Usage:
cloudb enable extensions
cloudb create schema [--schemas=<name>]
cloudb create admin-user
cloudb create read-only-user
cloudb create indexes
cloudb drop schema [--schemas=<name>]
cloudb import [--missing --dry-run --skip-if-exists]
cloudb trim ... |
"""
This is a temporary module intended for testing purposes; we will move it later
to sklab-util
"""
import importlib.util
import inspect
import os
import shutil
import subprocess as sp
import sys
import tempfile
from concurrent.futures import ThreadPoolExecutor
from functools import reduce
from queue import Queue
fr... |
# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... |
import time
from scrapy import Spider
from autoinfo.decoders import ResponseDecoder, RequestBuilder
from autoinfo.services import AutoDetailsService
from scrapper.scrapper.spiders.errors import RequestBannedError, BadResponseError
class AutoInfoBaseSpider(Spider):
allowed_domains = ['online.autoinfo.com.au']
... |
class Solution:
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: bool
"""
nums.sort()
for e in nums:
if e > target:
break
elif e == target:
return True
return Fa... |
r"""
.. autofunction:: openpnm.models.physics.diffusive_conductance.ordinary_diffusion
.. autofunction:: openpnm.models.physics.diffusive_conductance.taylor_aris_diffusion
.. autofunction:: openpnm.models.physics.diffusive_conductance.generic_conductance
"""
import scipy as _sp
def ordinary_diffusion(target,
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-19 12:24
from __future__ import unicode_literals
from django.db import migrations, models
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('artcase', '0003_auto_20161001_1834'),
]
operations = [
... |
import sys
sys.path.append('..')
import gc
import numpy as np
import cv2
import os.path
from tensorflow.keras import backend as K
from tensorflow.keras.utils import plot_model
import debugger
from deeplabv3 import Deeplabv3
from deep_neural_net import *
from predict_data_generator import DataGenerator
from UserParams... |
#!/usr/bin/env python3
from turtle import position
import cv2
import depthai as dai
import contextlib
import time
import numpy as np
import math
from envHandler import toList
# size = 6.125 # paddle (inches)
size = 1.57 # ball (inches)
# define range of white color in HSV
# change it according to your need !
# paddl... |
from contextlib import contextmanager
import random
import string
import tempfile
from unittest import mock
import docker
import pandas as pd
import pytest
import pytz
from requests.auth import HTTPBasicAuth
import requests
from tzlocal import get_localzone
from jira_offline.cli.utils import _get_issue, _get_project... |
"""
https://practice.geeksforgeeks.org/problems/check-if-subtree/
Given two binary trees with head reference as T and S having at most N nodes.
The task is to check if S is present as subtree in T.
A subtree of a tree T1 is a tree T2 consisting of a node in T1 and all of its descendants in T1.
"""
class TreeNode:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.