text stringlengths 3.07k 12.6k |
|---|
from .context import assert_equal, x, y, _Add, _Mul, _Pow
import pytest
from sympy import Rational, Mod, sqrt, pi
def _Mod(*args):
return Mod(*args, evaluate=False)
def test_mod_usual():
assert_equal("128\\mod 3", _Mod(128, 3))
assert_equal("7\\mod 128", _Mod(7, 128))
assert_equal("5\\mod 10", _Mod(... |
import inspect
import platform, re
from enum import Enum
from subprocess import run
from pathlib import Path
from coldtype.geometry import Rect
from coldtype.color import normalize_color
from coldtype.animation import Timeable, Frame
from coldtype.animation.timeline import Timeline
from coldtype.text.reader import nor... |
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2022 appliedAIstudio LLC"
__version__ = "0.0.1"
# needed to read the environment variables
import os
# needed to run the ai
from ai_framework.ai import AI
# needed to run the ai as a remote server
import rpyc
# needed to start the server in its own thread
from rp... |
"""Compiled Theano functions, as well as NumPy equivalents of other symbolic functions."""
import sys
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
import theano
import theano.tensor as T
from ucs.constants import EPS, hues, M_SRGB_to_XYZ
from ucs import Conditions, symbolic
_srgb_to_ucs = None
_ucs_t... |
__author__ = 'disaster'
import unittest
import mock
from cattle import Client
from fr.webcenter.backup.Rancher import Rancher
def fakeCallApiList(section):
if section == "service":
service = {}
service['type'] = "service"
service['name'] = "test"
service["state"] = "active"
... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd
from scipy.integrate import odeint,quad
from scipy.stats import kde,beta
import seaborn as sns
from importlib import reload
pi=np.pi
import ucovid
####### Calcul de l'indicateur P de Heesterbek et Roberts
#... |
# copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
import skimage.draw as skd
import skimage.io as skio
import numpy as np
import h5py
import itertools
import random
from typing import List
from dataclasses import dataclass, field
def default_float(n=1,low=0.0,high=1.0):
if n == 1:
return field(default_factory = lambda: np.random.uniform(low, high) )
e... |
#!/usr/bin/env python3
"""
Copyright (c) 2013, <NAME> <<EMAIL>>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUT... |
from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.types import CallbackQuery, ParseMode
import re
from aiogram.utils.markdown import hbold
from meest_api.get_payment_data import get_payment_data
from meest_api.location import search_my_parcels
from meest_api.pay import pay_by_portmone_m... |
# =============================
# tomato-clock.py
# this is a simple application to arrange your time more properly
# author @NearlyHeadlessJack (https://github.com/NearlyHeadlessJack)
# copyright (c) 2022 N.H.J.
# =============================
# import=======================
from pyecharts.charts import Bar
import ti... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
import numpy as np
import unittest
import faiss
import tempfile
import os
import io
import sys
import warnings
from mu... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# This program is free software: you can redistribute it and/or modify
# it under... |
import gzip
import json
import time
import urllib
import urllib.request
from io import StringIO
import config
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36'
defaultHeaders = {'User-Agent': USER_AGENT,
'Accept': "text/html,a... |
"""Collect training data from MIDI files."""
import argparse
from pathlib import Path
import numpy as np
from pypianoroll import Multitrack, Track
FAMILY_NAMES = [
"drum",
"bass",
"guitar",
"string",
"piano",
]
FAMILY_THRESHOLDS = [
(2, 24), # drum
(1, 96), # bass
(2, 156), # guita... |
# Copyright 2015 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.
import logging
import os
import socket
import infra_libs
from infra_libs.event_mon.protos.chrome_infra_log_pb2 import (
ChromeInfraEvent, ServiceEvent)
fr... |
from algorithms.common.stopping_criterion import MaxGenerationsCriterion, ErrorDeviationVariationCriterion
from algorithms.common.neural_network.neural_network import create_network_from_topology
from algorithms.semantic_learning_machine.mutation_operator import Mutation2, Mutation3, Mutation4
from algorithms.simple_ge... |
# Copyright 2020 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... |
"""
A Graphical User Interface for inspecting a HDF5 file.
"""
import argparse
import logging
import sys
import traceback
import h5py
from pathlib import Path
from PyQt5.QtCore import Qt, QModelIndex
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QApplication, QTreeView
from Py... |
import cv2
import os
import os.path as osp
import sys
from multiprocessing import Pool
import numpy as np
import glob
try:
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from utils.util import ProgressBar
except ImportError:
pass
def main():
train_or_test = 'train'
qp = 37
... |
"""
This script follows closely the Mathematica script from Sandri, 1996 (see
Sandri_1996_script/ for more details) and tries to reproduce the results
therein.
"""
import matplotlib.pyplot as plt
import mpl_extras as me
import tpsim as tp
import numpy as np
sigma = 16
beta = 4
rho = 45.92
def F(t, state):
"""... |
from csv import reader as csvreader
def colume_seperator(colume_select, colume_names, contents):
for content in contents:
data = {}
for name, value in zip(colume_names, content):
if name in colume_select:
data[name] = value
yield data
def format_ballot(ballot)... |
# -*- coding: utf-8 -*-
import contextlib
import pytest
import sys
import subprocess as sp
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_condition... |
"""
Sensor for Sleep as android states
"""
import logging
import json
from homeassistant.helpers.entity import Entity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.components.mqtt import subscription
from homeassistant.const import STATE... |
import os
import time
import aiohttp
from japronto import Application
TOKEN = os.getenv('TOKEN', 'SECRET_TOKEN')
RANCHER_NODEPOOL_URL = os.getenv('RANCHER_NODEPOOL_URL', None)
RANCHER_VERIFY_SSL = bool(int(os.getenv('RANCHER_VERIFY_SSL', '0')))
RANCHER_TOKEN = os.getenv('RANCHER_TOKEN', None)
RANCHER_CORDONED_CPU = i... |
import os
import zipfile
from pathlib import Path
import tensorflow as tf
from fashionnets.callbacks.garabe_collector.delete_checkpoints import DeleteOldModel
from fashionnets.models.states.HistoryState import HistoryState
from fashionnets.models.states.OptimizerState import OptimizerState
from fashionnets.train_jobs.... |
# Copyright 2021 The HuggingFace Team. 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 applicabl... |
from common.caching import cached
from . import dataio
import numpy as np
import tkinter as tk
import skimage.io
import os
import glob
import random
import time
class BodyPartLabelerGUI(object):
def __init__(self, master, files, labels):
self.master = master
self.files = files
self.image... |
# Copyright (c) 2020-2021, NVIDIA 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... |
from rest_framework.fields import REGEX_TYPE
from .serializers import MemantSerializer
from django.shortcuts import render
from .models import Memant
from rest_framework.parsers import JSONParser
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
from rest_framework.resp... |
#!/usr/bin/env python3
# -*- coding:utf8 -*-
import PyQt5,sys,traceback
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from tkinter import Tk
from tkinter.messagebox import showinfo
import RC_tray
import os,sys
from googletrans import Translator
def showbug(message):
Tk().withdra... |
import argparse
import collections
from enum import Enum
import functools
import itertools
import sys
from dupescan import (
core,
fs,
log,
)
from dupescan.cli._common import add_common_cli_args, set_encoder_errors
__all__ = ("correlate", "generate_report", "run")
def get_arg_parser():
p = argparse... |
from flask import Blueprint, render_template, request, redirect, url_for, flash, jsonify
from flask_login import current_user, login_required
from src.models.product import Product, Inventory, Rating
from src.models.user import db, User, Order_item
from sqlalchemy import func
from datetime import datetime
product_bluep... |
from django.shortcuts import render, redirect, reverse
from django.http import HttpResponse
from django.contrib.auth.models import User, Group
from django.contrib.auth import authenticate, login, logout
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from datetime import da... |
import os
from urllib.parse import urlparse
from get import HTML, JSON, Download, TextDownload
HOSTNAME = 'https://8ch.net/'
class CSS(TextDownload):
def __init__(self, name):
#convert abs url to rel url
if name[0] == '/':
name = name[1:]
url = HOSTNAME+name
else:
url = name
parseObj = urlparse(u... |
import numpy as np
from PIL import Image
import sys
# 2018.05.29
# create Color R,G,B Range
Color_Range = []
Color_Diff = int(256 / 4)
for r in range(256):
for g in range(256):
for b in range(256):
if r % Color_Diff == 0 and g % Color_Diff == 0 and b % Color_Diff == 0:
Color_Ra... |
from socket import *
import random
import time
import json
from collections import deque
# constant
WIDTH = 1000
HEIGHT = 1000
DELAY = 0.1 # speed of the game
MAX_CLIENTS = 2
MAX_LENGTH = 100 #length to win
REAL_WIDTH = WIDTH/20
REAL_HEIGHT = HEIGHT/20
# Global scope
playercount = 0
players = []
... |
import ast
import sys
import dace
from dace.transformation.transformation import Transformation
from dace.transformation.dataflow import MapFission
from typing import Any, Dict, Set
import warnings
from dace import registry, sdfg as sd, symbolic
from dace.properties import make_properties
from dace.sdfg import nodes, ... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import os
import sys
import argparse
import zipfile
import math
abs_path = os.path... |
import collections
import functools
import json
import math
from dimagi.utils import parsing as dateparse
from datetime import datetime, timedelta
from casexml.apps.stock import const
from casexml.apps.stock.models import StockTransaction
from dimagi.utils.dates import force_to_datetime
DEFAULT_CONSUMPTION_FUNCTION = ... |
import logging
import time
import os
import platform
import json
import uuid
import threading
class Agent(object):
"""An agent for data aquisition and dispatch supporting alternate
callback handlers and high-level functionality.
"self._configuration" data is used to connect to a configuration
reposi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <NAME>, <EMAIL>
from sys import version_info
if version_info[0] < 3:
raise Exception('python3 required')
try:
import rospy
import rosbag
except ImportError as e:
link = 'https://github.com/OTL/cozmo_driver#super-hack-to-run-rospy-from-python3'
raise(... |
from flask import render_template,request,redirect,url_for,abort,flash
from ..models import User,Post,Comments, Subscribers
from . import main
from .forms import PostForm, UpdateProfile,CommentForm, CommentForm2,SubscribeForm
from flask_login import login_required,current_user
from .. import db,photos
from flask_mail i... |
# <NAME>, <EMAIL>
# Code for Generating Semester 6 Dates
import datetime
from collections import defaultdict
from num2words import num2words
import re
MONTHS = (
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September,'
'October',
'November',
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-03-12 11:53
from __future__ import unicode_literals
from django.db import migrations
from job.deprecation import JobInterfaceSunset
from job.seed.manifest import SeedManifest
INTERFACE_NAME_COUNTER = 0
def get_unique_name(name):
global INTERFACE_NAME... |
import os
working_dir = os.path.dirname(__file__)
import argparse
import torch
from easydict import EasyDict as edict
from tqdm import tqdm
from data_loaders import CartoonDefaultDataLoader
from models import StarGenerator, MappingNetwork
from utils.misc import read_json
import numpy as np
import cv2
from fid_score imp... |
import logging
import pickle
import httplib2
from googleapiclient.discovery import build
from googleapiclient import errors
from oauth2client.client import FlowExchangeError, flow_from_clientsecrets, \
Credentials
SAVED_CREDENTIALS = './saved_credentials.json'
CLIENTSECRETS_LOCATION = './client_id.json'
REDIRECT... |
import numpy as np
import pmd_dust_test.cam_util.cy_collection_util as cu
import roypy
import roypy_platform_utils
import roypy_sample_utils
import sample_camera_info
import argparse
from collections import deque
import sys
import traceback
from dependencies.display_util.string_display_util import print_warning, pri... |
import warnings
from os.path import join, abspath, dirname
from os import makedirs, environ
import sys
import collections
import re
import yaml
try:
from yaml import CLoader as Loader
except:
from yaml import Loader as Loader
from datetime import datetime
from snakemake.logging import logger
from snakemake.w... |
# -*- coding: utf-8 -*-
# Copyright (C) 2021-2022 by SCICO Developers
# All rights reserved. BSD 3-clause License.
# This file is part of the SCICO package. Details of the copyright and
# user license can be found in the 'LICENSE' file distributed with the
# package.
"""Parameter tuning using :doc:`ray.tune <ray:tune/... |
from openie import StanfordOpenIE
import spacy
import neuralcoref
from difflib import SequenceMatcher
import nltk
from nltk.corpus import stopwords
import argparse
import random
parser = argparse.ArgumentParser()
parser.add_argument('--file', type=str)
parser.add_argument('--outfile', type=str)
parser.add_argument('--... |
from resources.matutil import identity
from resources.vecutil import list2vec
from resources.GF2 import one
def problem_6_13_13(S, T, scalars):
'''
>>> R_std_basis = identity(set(range(3)), 1)
>>> S_1 = {list2vec([2, one, 2]), list2vec([one, one, one])}
>>> T_1 = {list2vec([one, 0, 0])}
>>> scalars... |
""" Copyright 2018, 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, software
d... |
"""
ViP Architecture in PyTorch
Copyright 2021 <NAME>
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from timm.models.layers import trunc_normal_
Norm = nn.LayerNorm
def apply_pos(tensor, pos, num_heads):
if pos is None:
return tensor
elif len(ten... |
import argparse
from rlkit.envs.robosuite_wrapper import RobosuiteStateWrapperEnv
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.exploration_strategies.base import PolicyWrappedWithExplorationStrategy
from rlkit.exploration_strategies.ou_strategy import OUStrategy
from rlkit.launchers.la... |
"""
Logic for model creation, training launching and actions needed to be
accomplished during training (metrics monitor, model saving etc.)
"""
import os
import time
import json
import numpy as np
import tensorflow as tf
from datetime import datetime
from tensorflow.keras import Sequential
from src.datasets import loa... |
import os
import json
import copy
import argparse
# parser = argparse.ArgumentParser(description='Script to change datasource for dashboard')
# parser.add_argument("--old_dshbd", default = None, type=str, help = "Old dashboard json object")
# parser.add_argument("--new_dshbd_name", default = "dash_new", type=str, help... |
"""File IO for Flickr 30K images and text captions.
Author: <NAME>
Contact: <EMAIL>
Date: September 2019
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl import logging
import numpy as np
def load_flickr30k_splits(splits_dir... |
# Ecrit ton programme ici ;-)
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
from adafrui... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2021 IBM 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 r... |
from rest_framework import serializers
from qapi.utils import generate_fields
from apps.utils.file_uri import file_uri
from .models import DeliveryPrinter, DeliveryAccount, Sender, DeliveryRecords
class DeliveryAccountSerializer(serializers.ModelSerializer):
remark_content = serializers.CharField(
label=... |
import os
import textwrap
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from orchestra.forms import UserCreationForm, UserChangeForm
from . import settings
from .models import SystemUser
from .validators import validate_home, valid... |
# Modules
import string
import inspect
import importlib
from os import listdir
from os.path import exists
from ..utils.colors import color
from ..utils.logging import error
from .runtime.exec import Executer
from ..utils.bases import BaseCommand
from .runtime.globals import generate_globals
# Storage object
class ... |
import inspect
import logging
import warnings
import numpy as np
import astropy.units as u
from spectral_cube import SpectralCube
from . import scDerivativeRoutines as scdr
warnings.filterwarnings("ignore")
def _nicestr(quantity):
if quantity.value == int(quantity.value):
return(str(int(quantity.value))... |
import numpy as np
from math import log,sqrt
import torch
import torch.nn as nn
from torch import optim
from torch.autograd import Variable
import torch.nn.functional as F
import math
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class BanditNet(nn.Module):
def __init__(self, state_dim, a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 31 18:43:23 2018
@author: <NAME>
@email : <EMAIL>
"""
import pyorb_core.pde_problem.fom_problem as fp
import numpy as np
def ns_theta_f( _param, _q = 0 ):
return 1.0
def ns_full_theta_f( _param ):
return np.array([1.0])
class ns_theta_fs... |
# -*- coding: utf-8 -*-
"""Custom Service implementation from MazeRunner."""
from __future__ import unicode_literals, absolute_import
import os
import sys
import time
import logging
from threading import Thread
from multiprocessing import Process
import six
import docker
from attr import attrs, attrib
from six.moves.... |
# commishinfo.py
import error
import define as d
from decimal import Decimal
import re
_MAX_PRICE = 99999999
CURRENCY_PRECISION = 2
def convert_currency(target):
"""
Return the target string as a price integer; for example, "$1.23" becomes
123 which can then be stored in the database.
"""
if no... |
#!/usr/bin/env python
# LICENSE
#
# Copyright (C) 2010-2018 GEM Foundation, <NAME>, <NAME>, <NAME>
#
# The Hazard Modeller's Toolkit (openquake.hmtk) is free software: you can
# redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free Software Foundation, eith... |
# coding: utf-8
"""
StatisticsVolumeCorrection - Clinica Utilities.
"""
def peak_correction(t_map, t_threshold, output_name=None):
"""
Threshold the t_map with t_threshold. Pixel intensities that are less than t_threshold are set to 0, other values
are left unchanged.
Args:
t_map: (str) path... |
"""
Test module for project generation
"""
import datetime
import os
import subprocess
import sys
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Generator
import pytest
from cookiecutter.utils import rmtree
from pytest_cookies.plugin import Cookies, Result
_DEPENDENCY_FILE = "... |
import curses
import datetime
import locale
import os
import subprocess
import typing
import sys
from plotman import archive, configuration, manager, reporting, archive_job, plot_util
import time
import psutil
ON_POSIX = 'posix' in sys.builtin_module_names
class TerminalTooSmallError(Exception):
pass
def curses... |
from vibration import Const, Margin, Plant, Controller, ControlParam
from scipy import signal
import control as ct
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import numpy as np
def x_get():
myctparam = ControlParam()
notch_number = 4
line_number = 1000
ext_meth = 'last' # 'i... |
import bpy, bmesh
import socket
from struct import unpack
import numpy
from .common import PROTOCOL_VERSION, send_protobuf, receive_protobuf, receive_buffer, receive_into_numpy_array
from .connection import Connection
from .messages_pb2 import ClientMessage, HelloResult, QueryBoundResult, ServerStateResult
# XXX if t... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 <NAME> <<EMAIL>>
# 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,... |
import pandas as pd
import time
import seaborn
import numpy as np
from matplotlib import pyplot as plt
from sklearn import linear_model
import kernelml
train=pd.read_csv("data/kc_house_train_data.csv",dtype = {'bathrooms':float, 'waterfront':int, 'sqft_above':int, 'sqft_living15':float, 'grade':int, 'yr_renovated':int... |
"""U-Net Memory Benchmark"""
import platform
from typing import Any, Callable, Dict, List, Optional, Tuple, cast
import click
import torch
from torch import Tensor, nn
import torch.nn.functional as F
from torch.optim import SGD
import torchgpipe
from torchgpipe import GPipe
from unet import unet
Stuffs = Tuple[nn.Mo... |
'''
Utilities for logging things that happen during the skeleton/rig creation so
the users can be warned appropriately.
'''
from pymel.core import cmds, dt, listRelatives
import pdil
from . import node
def findRotatedBones(joints=None):
'''
Checks joints (defaulting to the )
'''
if not joints:
... |
"""
Copyright 2020 Universitat Politècnica de Catalunya
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 applicab... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 14:43:48 2020
@author: arnou
"""
import os
import errno
import numpy as np
import librosa
import pandas as pd
import more_itertools
from sklearn.preprocessing import StandardScaler
def segment_audio(signal, fs, win_size, win_step):
print('segment')
win... |
import collections
import logging
import bob.bio.base
import bob.bio.face
from . import utils
logger = logging.getLogger(__name__)
def normalize_annotations(annotations, validator, max_age=-1):
"""Normalizes the annotations of one video sequence. It fills the
annotations for frames from previous ones if th... |
import logging
from d4rl.pointmaze import waypoint_controller
from d4rl.pointmaze import maze_model, maze_layouts
import numpy as np
import pickle
import gzip
import h5py
import argparse
import os
import tqdm
START_POS = np.array([10., 24.])
TARGET_POS = np.array([18., 8.])
def reset_data():
return {'states': [... |
from typing import List, Tuple
from scipy.sparse import lil_matrix, eye
from scipy.sparse.csgraph import structural_rank, breadth_first_order
from scipy.sparse.linalg import inv
from sksparse.cholmod import cholesky
from torch_sparse import SparseTensor
from thgsp.alg import dsatur
from .utils import laplace, biparti... |
"""Example code for the epd2in13bc driver."""
import argparse
import logging
from time import sleep
from typing import Dict
import requests
from emoji.unicode_codes import EMOJI_UNICODE_ENGLISH
from PIL import Image
from einkd.display import Display
from einkd.drivers.base import BaseDriver
from einkd.gui.components ... |
import pytest
from markupsafe import Markup
def test_adding(escape):
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
safe = Markup("<em>username</em>")
assert unsafe + safe == str(escape(unsafe)) + str(safe)
@pytest.mark.parametrize(
("template", "data", "expect"),
(
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import functools
from collections import OrderedDict
import random
import os
import math
import pickle
def load_state_dict(model, fname):
"""
Set parameters converted from Caffe models authors of VGGFace2 provide.
See h... |
# Copyright 2021 Northern.tech AS
#
# 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... |
import sys
import cPickle as pickle
import os.path
import py
import subprocess
from rpython.tool.udir import udir
from rpython.rtyper.ootypesystem import ootype
from rpython.translator.cli.rte import Query
from rpython.translator.cli.sdk import SDK
from rpython.translator.cli.support import log
Assemblies = set()
Type... |
#
# Written by <NAME>, Sept-2020
#
# This file is part of the bueno project. See the LICENSE file at the
# top-level directory of this distribution for more information.
#
'''
Bueno run script for the SN Application Proxy (SNAP).
'''
import re
import io
import csv
import typing
from bueno.public import container
fro... |
import os
import subprocess
import urllib.request
import numpy as np
from dezero import as_variable
from dezero import Variable
def _dot_var(v, verbose=False):
dot_var = '{} [label="{}", color=orange, style=filled]\n'
name = '' if v.name is None else v.name
if verbose and v.data is not None:
if v... |
import os
import time
import serial
import colorama
import pyautogui
import playsound
import pywinauto
import configparser
from threading import Thread
from termcolor import colored
from pywinauto import application
from filemanagement import teams_downloads_function #own zip file function
from pywinauto.findwindow... |
# coding: utf-8
import os
import urllib
from .generic_utils import readable_bytes
from .monitor_utils import progress_reporthook_create
from .print_utils import pretty_3quote
from ._colorings import toBLUE, toRED, toGREEN
# Use Specific Opener
opener = urllib.request.build_opener()
opener.addheaders=[('User-Agent','M... |
from pathlib import Path
from io import StringIO
from dstools.exceptions import SourceInitializationError
from dstools.pipeline.tasks.Task import Task
from dstools.pipeline.sources import (SQLScriptSource,
SQLQuerySource,
GenericSource)
from d... |
#!/usr/bin/env python
import argparse
import os
def process(src_dir, out_dir, dataset):
entry_filename = os.path.join(src_dir, 'entries.' + dataset)
src_filename = os.path.join(out_dir, 'lang8-' + dataset + '.en')
tgt_filename = os.path.join(out_dir, 'lang8-' + dataset + '.gec')
rtl_src_filename = os.... |
"""Contains all schedules spreadsheet settings commands related to Tosurnament."""
from discord.ext import commands
from bot.modules.tosurnament import module as tosurnament
from common.api import spreadsheet
class TosurnamentSchedulesSpreadsheetCog(tosurnament.TosurnamentBaseModule, name="schedules_spreadshe... |
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
POS_INDEX = 5
VEL_INDEX = 8
ATT_INDEX = 11
TIME_INDEX = 2
def plot_residual(time, pos, vel, att, is_save, save_path):
plt.figure(1)
plt.subplot(3, 1, 1)
plt.plot(time, pos[..., 0])
plt.ylabel("x(m)")
plt.subplot(3, 1, 2)
... |
from easy_table import EasyTable
import sys
import datetime
import re
from menu import *
try:
from extensions import *
extensions = True
except ImportError:
extensions = False
try:
from ai import *
ai = True
except ImportError:
ai = False
# Create the table and define th... |
import configparser
import copy
import inspect
import os
import urllib
from collections import defaultdict
from inspect import Parameter
import tqdm
from joblib import Parallel, delayed
import pipeline.stages
def _processSingleInput(pipeline, data_source, img, ts):
return data_source, pipeline([img, ts]), ts
... |
import os
import termios
import time
import glob
import logging
class Maestro:
def __init__(self, serial, servos=24, resetPin=255, deviceNumber=255, CRCEnabled=False):
self.serial = serial
self.resetPin = resetPin
self.deviceNumber = deviceNumber
self.servos = servos
self.ta... |
#!/usr/bin/env python3.7
"""A hashlife style solution for day 12.
TODO: document this!
"""
from __future__ import annotations
import sys
from collections import defaultdict, deque
from typing import Dict, List, Union, Tuple, Optional, Any
from dataclasses import dataclass
@dataclass(eq=False, frozen=True)
class No... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.