text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 1 08:59:22 2019
@author: TempestGuerra
"""
import numpy as np
import math as mt
from HerfunChebNodesWeights import hefuncm, hefunclb
from HerfunChebNodesWeights import chebpolym, cheblb
def computeAdjustedOperatorNBC(D2A, DOG, DD, tdex):
#... |
"""
The main entrypoint for client.
"""
import datetime as dt
import os
import readline
from dataclasses import dataclass
from enum import Enum
import matplotlib.dates as md
import matplotlib.pyplot as plt
import yaml
from client.api.api import start_api_server, stop_api_server
from client.communication.messages impo... |
from sogs.web import app
from sogs import crypto
from sogs.hashing import blake2b
from sogs import utils
from nacl.bindings import (
crypto_scalarmult,
crypto_aead_xchacha20poly1305_ietf_encrypt,
crypto_aead_xchacha20poly1305_ietf_decrypt,
)
from Cryptodome.Cipher import AES
import nacl.utils
import struct
... |
"""
Common classes used by different python functions
"""
import json
import re
CHROMOSOME_LIST = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15',
'16', '17', '18', '19', '20', '21', '22', 'X', 'Y']
CHROMOSOME_PROB = [0.07426087261566,
0.079304873... |
'''demux.py
a simple c-o band demultiplexer
'''
import meep as mp
import meep.adjoint as mpa
import numpy as np
from autograd import numpy as npa
from autograd import tensor_jacobian_product, grad
from matplotlib import pyplot as plt
import nlopt
import argparse
mp.quiet()
# ---------------------------------------- #... |
import unittest
from pymmrouting.inferenceengine import RoutingPlan, RoutingPlanInferer
from pymmrouting.datamodel import VERTEX_VALIDATION_CHECKER
from pymmrouting.orm_graphmodel import SwitchType, Mode, Session
from os import path
class RoutingPlanTestCase(unittest.TestCase):
def setUp(self):
foot_sour... |
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler as SS
def resample_ohlc(df, resamp='T', vol_col='total'):
"""
Currently it's resampling the btc amount (or first trading pair)
as the volume.
To use the second trading pair as the volume, change 'total' to
'am... |
# Imports
import numpy as np
import os
# PyTorch Imports
import torch
from torch.utils.data import DataLoader
import torchvision
# Captum Imports
from captum.attr import Saliency
# Project Imports
from model_utilities import DenseNet121, ResNet50, VGG16, MultiLevelDAM
from chexpert_data_utilities import imgs_and_lab... |
#!/usr/bin/env python
import os
import time
import andor
import datautils.structures.mp
from .... import log
from .. import utils
logger = log.get_logger(__name__)
#logger.addHandler(logging.StreamHandler())
#logger.setLevel(logging.DEBUG)
# allow stop/start of acquisition on AT_ERR_NODATA
allow_reacquire = True
... |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
def deleteItems(layout):
if layout is not None:
while layout.count():
item = layout.takeAt(0)
widget = item.widget()
if widget is not None:
widget.deleteLater()
else:
deleteItems(item.layout())
... |
from contextlib import contextmanager
import psycopg2
import psycopg2.extensions
import psycopg2.extras
import psycopg2.sql
import psycopg2.pool
import gws
import gws.gis.shape
import gws.types as t
# noinspection PyArgumentList
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
# noinspection PyArgument... |
# --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by <NAME>, <NAME>
# --------------------------------------------------------
from __future__ import print_function, division
import _init_paths # noqa... |
import sys
import os
import io
import base64
import dash
from jupyter_dash import JupyterDash
import dash_core_components as dcc
import dash_html_components as html
from dash.exceptions import PreventUpdate
import gdown
import traceback
from scipy.io import wavfile
import numpy as np
import torch
sys.path.append("Diff... |
# Copyright (C), 2020 <NAME>. All Rights Reserved.
import os
import sys
import inspect
tool_name = os.path.splitext(os.path.basename(__file__))[0]
class Fresh():
def __init__(self):
self.cnt = 0
def fresh(self):
ret = self.cnt
self.cnt += 1
return ret
class Event():
def __init__(this, evtyp... |
import os
import time
import urllib.parse
import sys
import objgraph
from flask import request
from Database.Database import Database
from MediaPlayer.MediaManager import MediaManager
from MediaPlayer.Player.VLCPlayer import VLCPlayer
from Shared.Events import EventManager, EventType
from Shared.Logger import Logger... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: set sw=4 ts=4 expandtab :
"""
block collector
"""
# standard imports
import argparse
import json
import base64
import asyncio
import signal # for main
import traceback # for main
import sys # for main
import time
# third-party imports
import websockets
import r... |
import pyxel
from random import randint
from math import sqrt
from random import uniform
pyxel.init(256, 256,caption= "o jogo", fps = 30)
game_start = False
limpo = False
x=128
y=250
i=0
fase = 1
a = 2
z = randint(a,2+fase)
radius = 10
teleporte = 1
tp_espada = 0
tp_teleporte = 0
ini_mov_speed = 1... |
# Copyright (c) 2010-2022 openpyxl
# Python stdlib imports
from datetime import (
datetime,
date,
timedelta,
time,
)
import pytest
@pytest.mark.parametrize("value, expected",
[
(datetime(2013, 7, 15, 6, 52, 33), "2013-07-15T06:52:33"),
... |
import boto3
import os
import json
import logging
import cfnresponse
import uuid
import time
# Alfresco Enterprise ACS Deployment AWS
# Copyright (C) 2005 - 2018 Alfresco Software Limited
# License rights for this program may be obtained from Alfresco Software, Ltd.
# pursuant to a written agreement and any use of thi... |
import logging
import webapp2
import json
from template import template
from registration import Hacker
from registration import hacker_keys
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.api import channel
from google.appengine.api import users
from config import o... |
import unittest
import mock
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
def sigmoid(x):
return numpy.tanh(x * 0.5) * 0.5 + 0.5
def _split(inputs, pos):
return inputs[:pos]... |
import os
import warnings
import tempfile
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
import tensorflow.keras as keras
from keras import backend as K
from keras.models import Model,model_from_json
from keras.layers import Dense,Dropout,Input
from keras.callbacks import EarlyStopping
import... |
"""
Author: <NAME>.
"""
import numpy as np
from math import log2
class NodeDT:
"""
Class Node represents in Decision Tree
"""
def __init__(self, X, y, feature_name):
self.feature_name = feature_name
self.X = X
self.y = y
self.is_leaf = False
self.label = None
... |
# 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... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.contrib.auth.models import U... |
# -*- coding: utf-8 -*-
import math
import rospy
import copy
def clamp(x, minimum, maximum):
return max(minimum, min(x, maximum))
# This class stores the occupancy grid. This is a "chessboard-like"
# representation of the environment. The environment is represented by
# a set of square cells. Each cell encodes ... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <<EMAIL>>
#
# 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 ... |
# ----------------------------------------------------------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------------------------------------------------------
import os
import datetime as dt
import logging
import n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... |
import logging
import threading
import requests
import six
from requests import Session
from requests.adapters import HTTPAdapter
from pubnub import utils
from pubnub.enums import PNStatusCategory
from pubnub.errors import PNERR_CLIENT_ERROR, PNERR_UNKNOWN_ERROR, PNERR_TOO_MANY_REDIRECTS_ERROR,\
PNERR_CLIENT_TIME... |
import logging
from django.contrib import messages
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from mayan.apps.acl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs NUMBA Performance Testbench
====================================
"""
# Imports
import unittest
from pycompss.api.api import compss_barrier
from pycompss.api.api import compss_wait_on
from pycompss.api.task import task
from pycompss.api.constraint import constra... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
# Convert Bert ONNX model converted from TensorFlow or exported from PyTo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: cs_vpn_connection
shor... |
#!/usr/bin/env python
from pathlib import Path
import json
import os
import sys
from urllib.parse import urlparse
DIR = Path(__file__).parent
def main():
for i in [
["semantics", "manifest.ttl"],
["turtle", "syntax", "manifest.ttl"],
["turtle", "eval", "manifest.ttl"],
["nt", "synt... |
import base64
import hashlib
import json
import time
import functools
import logging
import datetime
from typing import List
import websocket
import requests
import requests.auth
from .common import AbstractRobot, RobotStates, BatteryStatus, PowerMode, ZoneType, capabilities2model, CleaningSession, DustbinStates
fro... |
import pytest
from simulation import tem_simulation as simulation
@pytest.fixture(scope="module")
def base_test_config():
return (
"=== simulation ===\n"
+ "log_file = old_log_file.txt\n"
+ "=== detector ===\n"
+ "image_file_out = old_test_tiltseries.mrc\n"
+ "=== detector ... |
import os, sys, gc
import numpy as np
from skimage.util import pad
from tqdm import tqdm
from ..config import RESIZE_VOL_TO, BATCH_SIZE
from ..utils.dataUtils import getNewShapeForResize, resizeVol
from ..utils.gpuSelector import mask_CUDA_VISIBLE_DEVICES, resolveDesiredGpus
from ..utils.ioUtils import saveVol, loadVo... |
import sqlite3 as sql
import cumodoro.config as config
from cumodoro.error import DatabaseError
from collections import deque
import datetime
import sys
import logging
log = logging.getLogger('cumodoro')
class Task():
pass
class Database():
def __init__(self):
self.db = None
self.cursor = Non... |
import sys; import time; import traceback
import datetime
import sqlite3 as lite
import sys
import os
import xlwt
import serial
import serial.tools.list_ports
import winsound
def check_creat_dir(string):
flag = os.path.exists(string)
if flag == False:
print("没有当前目录文,将自动创建")
os.mkdir(string)
... |
# Copyright 2020 D-Wave Systems 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... |
# coding: utf-8
"""TV-L1 optical flow algorithm implementation.
"""
from functools import partial
from itertools import combinations_with_replacement
import numpy as np
from scipy import ndimage as ndi
from .._shared.filters import gaussian as gaussian_filter
from .._shared.utils import _supported_float_type
from .... |
import json
import logging
import re
import time
import requests
import sys
import os
from bs4 import BeautifulSoup, Comment
from docopt import docopt
l = logging.getLogger(__name__)
HELP = """
Usage: chia-anime-downloader.py (search | -s) <keyword> [options]
chia-anime-downloader.py (download | -d) <link> [o... |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
from conf.settings import FilesConf, ModelConf, DatabaseConf
from conf.settings import CONNECTION_STRING
from sqlalchemy import create_engine
from statsmodels.tsa.stattools import pacf
from statsmodels.graphics.tsa... |
from __future__ import print_function
import os
import sys
import random
from time import strftime, gmtime, time
import pickle
from keras.layers import Embedding, LSTM, Dense, GRU, Bidirectional, Dropout, Input, Lambda, concatenate
from keras.models import Sequential, Model
from keras.metrics import mae
from keras.opt... |
# Import packages we know are here and won't mess anything up
import argparse
import sys
try:
from tkinter import Tk
except ModuleNotFoundError:
try:
from Tkinter import Tk
except:
# If no versions of tkinter exist (most likely linux) provide a message
if sys.version_info.major < 3:
... |
#!/usr/bin/env python
# Copyright 2017 Informatics Matters 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 applicab... |
"""Provides Asana Tasks sensor data."""
import collections
import datetime
import logging
import re
from homeassistant import const
from homeassistant.helpers import config_validation
from homeassistant.helpers import entity
import requests
import voluptuous
_DEFAULT_NAME = 'asana'
_ASANA_API_URL = 'https://app.as... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
""" Contains classes that implement a redundant array removal transformation.
"""
import copy
import functools
import typing
from dace import data, registry, subsets
from dace.sdfg import nodes
from dace.sdfg import utils as sdutil
from dace.... |
import cv2
import numpy as np
IMG_V = 128
IMG_H = 128
channel = 3
K_ = 8
def DCTConstant(u, v):
if u == 0 and v == 0:
return 1 / 2
elif u == 0 or v == 0:
return 1 / np.sqrt(2)
else:
return 1
def DCT(img, block=8):
if len(img.shape) == 3:
Ver, Hor, Col = img.shape
... |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... |
# MIT License
# Copyright (c) 2017 liukuang
# 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, modify, merge, publi... |
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
import argparse
import configparser
import os
import glob
import sys
import numpy as np
from tqdm import tqdm
import re
import matplotlib.pyplot as plt
from torchmetrics import IoU, F1
from torchgeometry.losses import TverskyLoss
from sklearn.metrics i... |
# BenchExec is a framework for reliable benchmarking.
# This file is part of BenchExec.
#
# Copyright (C) 2007-2015 <NAME>
# 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... |
from os.path import dirname, join, expanduser
from zrp.validate import ValidateGeo
from .preprocessing import *
from .base import BaseZRP
from .utils import *
import pandas as pd
import numpy as np
import statistics
import json
import sys
import os
import re
import warnings
warnings.filterwarnings(action='ignore')
d... |
# -*- coding: utf-8 -*-
"""
LA-ICP-MSI data analysis script for publication
###
2019-2021
@author: <NAME> / MR Cancer / MH / ISB / NTNU Trondheim Norway
<EMAIL>
"""
import logging
import pandas as pd
import numpy as np
from laicpms_data_handler import LAICPMSData
import matplotlib.pyplot as plt
from ma... |
import sys
import makeGraph
import makeGraphNoBias
import numpy as np
path = 'MNIST/snapshots/'
savePathUnweighted = 'unweightedAdjacencyMatrices'
savePathWeighted = 'weightedAdjacencyMatrices'
number_of_models = 10
def main(argv):
assert len(argv) >= 4, 'ERROR: Please enter required paramters. See readme.txt ..... |
import discord
import re
from discord.ext import commands
from commands.utils.pages import Pages
from commands.utils.bibleutils import BibleUtils
from commands.utils.userlevels import UserLevel
API = "https://www.abibliadigital.com.br/api"
COLOR = 0x00B115
class Bible(commands.Cog, BibleUtils):
'''Bíblia'''
... |
class AdoptionCenter:
"""
The AdoptionCenter class stores the important information that a
client would need to know about, such as the different numbers of
species stored, the location, and the name. It also has a method to adopt a pet.
"""
def __init__(self, name, species_types, location):
... |
# Copyright 2013-2019 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)
import os
import pytest
import spack.util.environment as environment
from spack.paths import spack_root
from spack.util.e... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import os
project_name = "reco-tut-ysr"; branch = "main"; account = "sparsh-ai"
project_path = os.path.join('/content', project_name)
if not os.path.exists(project_path):
get_ipython().system(u'cp /content/drive/MyDrive/mykeys.py /content')
import mykeys
g... |
import argparse
import time
import numpy as np
import tensorflow as tf
import socket
import importlib
import os
import sys
baseDir = os.path.dirname(os.path.abspath(__file__))
rootDir = os.path.dirname(baseDir)
sys.path.append(baseDir)
sys.path.append(os.path.join(rootDir, 'models'))
sys.path.append(os.path.join(rootD... |
import unittest
import numpy as np
import xarray as xr
from xcube.genl2c.rbins.inputprocessor import RbinsSeviriHighrocDailyInputProcessor, \
RbinsSeviriHighrocSceneInputProcessor
class RbinsSeviriHighrocSceneInputProcessorTest(unittest.TestCase):
def setUp(self):
self.processor = RbinsSeviriHighro... |
import numpy as np
### MEASURES
# pureDP pure epsilon-DP
# approxDP approximate (epsilon, delta)-DP
# zCDP zero concentrated (xi, rho)-zCDP renyi divergence for all alpha
# smoothedzCDP approximate zero conc (xi, rho, delta)-zCDP the delta is eq... |
from collections import namedtuple
from .util import UNSET_DOUBLE, UNSET_INTEGER
from eventkit import Event
__all__ = (
'Object ContractDetails ContractDescription '
'ComboLeg DeltaNeutralContract OrderComboLeg OrderState '
'SoftDollarTier PriceIncrement Execution CommissionReport '
'BarList BarDataL... |
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import datetime
import io
import logging
import os.path
import re
import subprocess
import sys
import tarfile
import time
import urll... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of SyncBoom and is MIT-licensed.
from datetime import datetime
from flask import render_template, flash, redirect, url_for, request, g, \
jsonify, current_app
from flask_login import current_user, login_required
from flask_babel import _, get_lo... |
import sys
import time
import fileinput
# ====== polyg parsing ========
def extract_edge(edge):
tokens = edge.split(",")
assert len(tokens) == 2, "ill-format edge: a,b"
return [int(tokens[0]), int(tokens[1])]
def load_polyg(poly_f):
with open(poly_f) as f:
lines = f.readlines()
n = 0
... |
# -*- coding: utf-8 -*-
'''preggy core: the `Expect` class, and the `@assertion` and `@create_assertions` decorators.
'''
# preggy assertions
# https://github.com/heynemann/preggy
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 <NAME> <EMAIL>
from __future__ imp... |
"""
Identify and remove noisy examples.
"""
import os
import sys
import time
import joblib
import argparse
import resource
from datetime import datetime
import numpy as np
from sklearn.base import clone
from sklearn.model_selection import train_test_split
here = os.path.abspath(os.path.dirname(__file__))
sys.path.ins... |
# Copyright 2008 <NAME>. 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 conditions and the foll... |
from typing import Dict, List
from django.conf import settings
from django.db import transaction
from django.db.models import Count
from django.utils.translation import gettext as _
from zerver.lib.actions import (
create_users,
do_add_reaction,
do_send_messages,
internal_prep_stream_message_by_name,
... |
#!/usr/bin/env python3
"""
This module handles access to the configuration files. The configuration
files--including the environment files--are accessed by the other python scripts
through this file.
This is setup such that other files need only call the `get()` functions, and
all the loading and caching will happen ... |
core_git_remote = '<EMAIL>:realm/realm-core.git'
sync_git_remote = '<EMAIL>:realm/realm-sync.git'
import sys
import os
import subprocess
import tempfile
import shutil
import time
import threading
root_dir = os.path.dirname(sys.argv[0])
cmake = os.environ.get('CMAKE', 'cmake')
cmake_generator = os.environ.get('CMAKE_... |
# Constants, variables, and methods that are commonly used
import os
from datetime import datetime
import numpy as np
import pandas as pd
from collections import Counter
ITEM_LIST_DATANORM = ['X_range','X_min','X_scaled','X_scaled_mean']
ITEM_LIST_RUNPCA = ['X_PCA','EigenValue_PCA','EigenVector_PCA','NumComp_PCA','E... |
import node
import numpy as np
import math
import heuristics as h
def create_board():
board = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
... |
import glob
import os
import typing
import logging
import scipy
import numpy as np
import numpy as np
import keras
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
from keras.optimizers import SGD
import ... |
# 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 a... |
# SETUP: VIRTUAL ENVIRONMENT
## for environment variables
from dotenv import load_dotenv
import os
## for chatbot functionalities
import telebot
from string import Template
import emoji
from gtts import gTTS
## for data analysis
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2020 Snowflake Computing Inc. All right reserved.
#
import time
import pytest
from snowflake.connector import ProgrammingError
# Mark all tests in this file to time out after 2 minutes to prevent hanging forever
pytestmark = [pytest.mark.timeout(12... |
# For python 3 compatibility
from __future__ import division, absolute_import, print_function
try: input = raw_input
except: pass
import settings as st
# External Dependencies
import time, random
from mingus.midi import fluidsynth # requires FluidSynth is installed
from mingus.core import progressions, intervals, c... |
import os
import numpy as np
from enrico import environ
from enrico.constants import EbinPath
from enrico.submit import call
from enrico.config import get_config
from enrico import utils, Loggin
def ChangeModel(comp, E1, E2, name, Pref, Gamma):
"""Change the spectral model of a source called name
to allow a fi... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Power by <NAME> 2020-03-24 12:27:06
import cv2
import random
import torch
from math import sqrt
import torch.nn.functional as F
import numpy as np
import h5py as h5
from skimage import img_as_float32
from .imresize import imresize
from . import BaseDataSetImg, BaseDataSet... |
import pandas as pd
import numpy as np
import os, argparse, fnmatch, re, json
TRACK_PREFIX = "week"
GAME_PREFIX = "games"
PLAYER_PREFIX = "players"
PLAY_PREFIX = "plays"
GAME_COL = "gameId"
PLAY_COL = "playId"
PLAYER_COL = "nflId"
PREFIX_DELIM = "_"
NAN_VALUE = "NAN"
NUMERIC_COL = "number"
NORMALIZE_PREFIX = "nor... |
#!/usr/bin/env python3
"""
Tool to create overview.json files and update the config.ts.
"""
from pathlib import Path
import tempfile
import datetime
import argparse
import time
import json
import glob
import sys
import os
import re
from distutils.version import StrictVersion
SUPPORTED_METADATA_VERSION = 1
BUILD_DATE_... |
import logging
import subprocess
import typing
import six
from dbnd._core.constants import SystemTaskName
from dbnd._core.current import is_verbose
from dbnd._core.errors import get_help_msg, show_exc_info
from dbnd._core.errors.errors_utils import log_exception, nested_exceptions_str
from dbnd._core.task.task import... |
import random
from pygame import Rect
def get_random_start(dim, avoid=[], total=-1):
#first, cut the map into 9 areas, see where all the sees land, and then picka random area to go to :D
quadsize = int(dim[0] / 3), int(dim[1] / 3)
quads = [[0,0], [0,1], [0,2],
[1,0], [1,1], [1,2],
... |
"""
- Type Section, Data Section and Code Section will be represented as an array of Type, Data
and Function respectively.
- First function of the code section will be executed on startup.
- First method of a type will be type constructor.
"""
########################################## AST ###################... |
import numpy as np
from copy import deepcopy
class sepCEM:
"""
Cross-entropy methods.
"""
def __init__(self, num_params,
batch_size,
mu_init=None,
sigma_init=1e-3,
sigma_init_aa=1e-3,
pop_size=256,
damp=1e-3,
damp_limit=1e-5,
damp_aa=0.2,
damp_limit_aa=0.1,
parents=None,
... |
from dbsync.config import Config
from dbsync.config import unformat
from dbsync.exceptions import DatabaseStructureException
import copy
from mysql.connector import DatabaseError
def prepare_map_keys(columns, fmt, key):
prepared_columns = copy.deepcopy(columns)
for col in prepared_columns:
col['Field'... |
import json
import os
from flask import Blueprint, jsonify
import funcs
from dtran.ifunc import IFuncType
KEY_DESC = 'description'
KEY_MODL = '__module__'
KEY_IDENTIFIER = 'id'
KEY_INPUTS = 'inputs'
KEY_OUTPUTS = 'outputs'
KEY_FRIENDLY_NAME = "friendly_name"
KEY_FUNC_TYPE = "func_type"
KEY_EXAMPLE = "example"
FAKE... |
# -*- coding: utf-8 -*-
r""" The Drift-Detection algorithm for non-stationary bandits.
- Reference: [["EXP3 with Drift Detection for the Switching Bandit Problem", <NAME> & <NAME>]](https://www.researchgate.net/profile/Allesiardo_Robin/publication/281028960_EXP3_with_Drift_Detection_for_the_Switching_Bandit_Problem/li... |
# internal to the class is
# - the matrix used for calulation
# - the dict mapping Cn to concept name
# - a list of concepts
# - a list of relations
# only add, no delete
#
import numpy as np
import itertools
import json
import networkx as nx
import math
class Concept:
def __init__(self, node, name, wordclo... |
import argparse
import os
import pandas as pd
import torch
from pytorch_toolbelt.utils import fs
from retinopathy.dataset import get_datasets
from retinopathy.inference import run_model_inference_via_dataset, run_model_inference
import boto3
import botocore
from botocore.exceptions import ClientError
bucket = "data... |
#!/usr/bin/python3
# Functions to handle Input
#############################################################################################
def read_csv():
# simple function to read data from a file
data = pd.read_csv('out.csv', sep=';')
return data
def read_sacct():
# function to read the data directly fro... |
import streamlit as st
import os
import sys
import argparse
import yaml
import json
import re
import h5py as h5
import numpy as np
import copy
import matplotlib.pyplot as plt
from pytorch3d.io import save_ply, save_obj, load_objs_as_meshes, load_obj, load_ply
from pytorch3d.structures import Meshes
from pytorch3d.re... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- mode: Python -*-
#
# (C) <NAME>, 2021
#
# Much code copied from test_segments.py
#
import os
import sys
import re
import unittest
from hypothesis import given, assume, settings, HealthCheck
import hypothesis.strategies as st
from dpath import options
import dp... |
"""Module to process peptide sequences."""
import re
from collections import Counter
import numpy as np
from pyteomics import parser
from sklearn.preprocessing import LabelEncoder
from tensorflow.keras.preprocessing import sequence as ts
import pandas as pd
def prepare_seqs(psms_df, seq_cols=["Peptide1", "Peptide2"])... |
#coding=utf-8
"""
@author: evilXu
@file: taskMgr.py
@time: 2018/1/2 14:33
@description:
"""
from .admin import Admin
from rqalpha.mod.rqalpha_mod_alphaStar_factors.factor import Factor
from rqalpha.mod.rqalpha_mod_alphaStar_factors.factor_context import FactorContext
from rqalpha.mod.rqalpha_mod_alphaStar_factors.fac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.