text stringlengths 6.04k 39.5k |
|---|
# -*- coding: utf-8 -*-
"""
werkzeug.wrappers
~~~~~~~~~~~~~~~~~
This module provides simple wrappers around `environ`,
`start_response` and `wsgi.input`.
:copyright: 2007 by <NAME>, <NAME>.
:license: BSD, see LICENSE for more details.
"""
import cgi
import tempfile
import urlparse
try:
fro... |
import forecaster as fc
import optimizer as opt
import trader as td
import datetime as dt
import utilities as util
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def calc_start_date(end_date=dt.datetime(2017,1,1), data_size=12):
return end_date-dt.timedelta(weeks=int(data_size * 52/12))
de... |
#!/usr/bin/env python
from __future__ import (print_function, division)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from scipy.interpolate import griddata
from scipy.stats import norm
from scipy.optimize import curve_fit
from astropy.io import fits
import os
import mat... |
"""Module that contains tests to check that xml file has been written"""
import os
from pathlib import Path
from conftest import get_jarvis4se, remove_xml_file
from xml_adapter import XmlParser3SE
jarvis4se = get_jarvis4se()
xml_parser = XmlParser3SE()
def test_generate_xml_file_template():
"""Notebook equivale... |
import os
import re
import sys
import json
import jsonpickle
import pickle
import csv
import tempfile, shutil
import OWImageBuilder
import workflowTools
import socket
import copy
from xml.dom import minidom
from glob import glob
from pathlib import Path
from shutil import copyfile
from createWidget import mergeWidget, ... |
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Adjacency list representation of directed graph.
Note that parallel edges and self-loops are not allowed.
"""
__author__ = '<NAME>'
from collections import deque
from typing import List
from graph_basics import AbstractGraph, AbstractVertex
class IllegalArgumentE... |
"""
hooks for loading iharm v3.5 data
load_iharm(harm_dump_name, gcov, gcon): returns (rho, UU, U, B, ucon, ucov, bcon, bcov)
If gcov/gcon are None, then the four-vector quantities are not
computed from the primitives (ucon,ucov,bcon,bcov are None).
get_RHP(harm_dump_name): returns (R,H,P)
... |
import math
import torch
import warnings
import numbers
from torch.nn.modules import Module
from torch.nn.parameter import Parameter
from torch.nn.utils.rnn import PackedSequence
from torch.nn import init
from torch import _VF
def rnn_tanh(input, hx, _flat_weights, bias, num_layers, dropout, training, bidirectional, ... |
# %% [markdown]
# ##
import os
import warnings
import matplotlib as mpl
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.stats import poisson
from sklearn.exceptions import ConvergenceWarning
from sklearn.manifold import MDS,... |
"""
$ pip install streamlit streamlit-option-menu streamlit-aggrid
- Bootstrap icons:
https://icons.getbootstrap.com/
- This app builds on the following streamlit contributions, Thank you!
- streamlit-option-menu
- streamlit-aggrid
## TODO - streamlit-crud
- parse table schema to get column name/type a... |
import numpy as np
import ROOT
import miind.palette as palette
import miind.ode2dsystem as ode2dsystem
import miind.mesh3 as mesh
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import xml.etree.ElementTree as ET
from itertools import count
ROOT.gROOT.SetBatch(False)
AXISCOLOR=... |
"""
Main module of the tool, this holds the master function that calls
lower level functions to fit and benchmark a set of problems
for a certain fitting software.
"""
from __future__ import absolute_import, division, print_function
import os
import timeit
import warnings
import numpy as np
from fitbenchmarking.cont... |
# SOURCE: https://github.com/tiangolo/fastapi/issues/1800
# #2: https://github.com/encode/starlette/issues/658
from collections import defaultdict, deque
from datetime import datetime as dt
from asyncpg import create_pool
from json import dumps, loads
from copy import deepcopy
from os import environ
from re import find... |
# %%
from functools import wraps
import numpy as np
import tensorflow as tf
from functools import reduce
from PIL import Image
from PIL import Image, ImageFont, ImageDraw
def letterbox_image(image, size):
iw, ih = image.size
w, h = size
scale = min(w / iw, h / ih)
nw = int(iw * scale)
nh = int(ih... |
"""Tests for Gremlin database."""
import requests
import pprint
from behave import then, when
from semantic_version import Version
import time
from src.attribute_checks import check_and_get_attribute, check_attribute_presence, check_cve_value
from src.json_utils import check_request_id_value_in_json_response
from src.... |
import numpy as np
from numpy import newaxis as na
import matplotlib
from py_wake.utils.functions import mean_deg
class StraightDistance():
def _cos_sin(self, wd):
theta = np.deg2rad(90 - wd)
cos = np.cos(theta)
sin = np.sin(theta)
return cos, sin
def plot(self, wd_il, src_id... |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for sync stages."""
import cPickle
import itertools
import os
import sys
import time
import tempfile
sys.path.insert(... |
"""Python implementation of the stochastic series expansion (SSE) for the Heisenberg model.
This code was implemented based on <NAME>'s tutorial at
http://physics.bu.edu/~sandvik/programs/index.html
and chapter 5.2 of his lecture notes, arXiv:1101.3281, adjusted for python.
Note the different numbering of certain thin... |
#!/usr/bin/env python
import os
import sys
import argparse
import subprocess # nosec
import re
import fnmatch
import json
import urllib
from urllib.parse import urlencode
from urllib.request import Request, urlopen
env = os.environ
class BColors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
... |
"""
Slurk client for the game master
"""
import socketIO_client
from avatar_sgg.game import MapWorldGame
from avatar_sgg.config.util import get_config
import random
def check_error_callback(success, error=None):
if error:
print("Error: ", error)
class GameMaster(socketIO_client.BaseNamespace):
"... |
"""
Interface for handling the context of emulation: registers, memory, variables, actions, etc.
"""
from __future__ import annotations
from copy import deepcopy
import collections
import logging
from typing import List, Tuple, Optional, TYPE_CHECKING
import dragodis
from .instruction import Instruction
from .memory ... |
import unittest
from covermi.gr import Gr, Entry, Chrom, Iterate, bisect_left
class TestEntry(unittest.TestCase):
def test_constructor(self):
self.assertEqual(Entry("1", 10, 20), Entry("chr1", 10, 20))
self.assertEqual(Entry("23", 10, 20), Entry("23", 10, 20))
self.assertEqual(Entry("23"... |
#! /usr/bin/env python
#coding: utf-8
"""
COPYRIGHT (c) 2009-2014
LICENSE
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... |
# coding=utf-8
# Copyright 2020 The Adp Authors.
#
# 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... |
# Copyright 2021 <NAME>
#
# 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... |
import sys
from os.path import dirname, abspath
path = dirname(dirname(dirname(abspath(__file__))))
sys.path.append(path)
from Text2JSON.train import utils
from Text2JSON.predict.prediction import Predict
import datetime
def f_one(label_file, predict_file):
stop_word_list = ['【', '】', '[', ']', '"', "'", '‘', '’... |
# -*- mode: python; coding: utf-8 -*
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 3-clause BSD License
"""Definition of Telescope objects, for metadata common to all antennas in an array."""
import numpy as np
import warnings
from pyuvdata import UVBeam, parameter
from .analyticbeam import... |
#!/usr/bin/env python3.4
# Copyright 2018 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""
Write grammar_data_test.go
"""
import sys
import ast
import datetime
import subprocess
inp = [
# basics
("", "exec"... |
import math
import types
import json
def frame_name(o): return f"<class: {getattr(o, '__framename__', o.__name__)}>"
def frame_str(x): return json.dumps(x, default=frame_name, indent=4)
def frame_print(x): return print('\nResult : ' + frame_str(getattr(x, 'to_dict', (lambda: None))()))
def split_nth_char(x, n=2): r... |
import os
import numpy as np
from sklearn.svm import SVR, SVC
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.cross_decomposition import CCA
from scipy.linalg import null_space
from scipy import stats
from tqdm import tqdm
from sklearn.metrics.pairwise import cosine_similarity
from ... |
from __future__ import annotations
from .exceptions import InvalidRequest, InvalidAttributeCombination
from .utils import get_total_xp, get_xp_to_next_lvl
from .ranks import Rank
from .gamemode import Gamemodes
from .operators import Operators
from .trends import Trends, TrendBlockDuration
from .weapons import Weapons... |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... |
from Tkinter import *
import pymol
from pymol import cmd
import os
import colorsys
from hist import VolumeHist
from pymol.colorramping import ColorRamp
import ModalWindow
##############################################################################
# HSV Color Chooser Modal Dialog
#
# this has module scope
selected... |
#!/usr/bin/env python3
import configargparse
import json
import logging
import requests
from boltons.strutils import bytes2human
from pathlib import Path
from pprint import pprint
from katsdpnetboxutilities.connect import query_netbox
def format_bytes(size):
# 2**10 = 1024
size = int(size)
power = 2**10... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import grad
import math
from itertools import chain
from ._deeplab import ASPP
# -------------------------------------------
# Multi-Knowledge Aggregation
# -------------------------------------------
class Reshape(nn.Mod... |
"""
Generate CoAs | Cannlytics
Author: <NAME> <<EMAIL>>
Created: 7/22/2021
Updated: 7/23/2021
License: MIT License <https://opensource.org/licenses/MIT>
"""
# Standard packages
import argparse
from ast import literal_eval
import os
from pathlib import Path
from re import sub, findall
from shutil import copyfile
# Ext... |
#!/usr/bin/env python
#
# Created by: <NAME>, April 2002
#
from __future__ import division, print_function, absolute_import
__usage__ = """
Build linalg:
python setup.py build
Run tests if scipy is installed:
python -c 'import scipy;scipy.linalg.test()'
"""
import math
import numpy as np
from numpy.testing impo... |
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
import awrams.utils.datetools as dt
from awrams.utils.metatypes import ObjectDict,New
from .stats import build_stats_df,standard_percentiles
from .utils import valid_only,infer_freq,resample_to_months_df,resample_to_years_df
from .model import Sele... |
from collections import Counter, defaultdict, namedtuple
import gzip
import numpy as np
import os
import random
from sklearn.feature_extraction import DictVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import precision_recall_fscore_support
from sklearn.model_selection import train_... |
import io
import json
import os.path
import sys
import tempfile
import affine
import numpy as np
import pytest
import shapely.geometry
import tqdm
from osgeo import gdal
from threadpoolctl import threadpool_limits
from gdal_boots.gdal import GeoInfo, RasterDataset
from gdal_boots.geometry import GeometryBuilder, to_g... |
#!python3
"""
Implementation of an Approximation Algorithm for computing continuous
division of a cake among n agents in order to maximize the welfare.
Reference:
<NAME>, <NAME>, <NAME> (2012). "Computing socially-efficient cake divisions".
Proceedings of AAMAS 2013, 343--350. Algorithms 1 and 2.
Programmer:... |
"""
Python support for `BrainProducts <https://www.brainproducts.com>`_ hardware.
Here we have implemented support for the Remote Control Server application,
which allows you to control recordings, send annotations etc. all from Python.
"""
from __future__ import division, unicode_literals
import socket
import time
... |
# -*- coding: utf-8 -*-
r"""
Created on 25 Mar 2021 19:34:40
@author: jiahuei
"""
import os
import math
import seaborn as sns
import pandas as pd
from matplotlib import pyplot as plt
from tqdm import tqdm
# https://chrisalbon.com/python/data_visualization/seaborn_color_palettes/
gray3 = sns.color_palette("gray_r", n_... |
from __future__ import print_function
import json
import os
import pkgutil
import sys
import shutil
import subprocess
import glob
from collections import namedtuple
from os.path import join, realpath, dirname, normpath, normcase
from operator import methodcaller
import distutils.spawn
import re
try:
subprocess.run
... |
import torch
import math
from torch.autograd import Variable
import torch.nn.functional as F
import torch.nn as nn
import table
import table.IO
import table.ModelConstructor
import table.Models
import table.modules
from table.Utils import add_pad, argmax, topk
from table.Trainer import collapse_copy_scores
from table.P... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright © 2015- The Spyder Development Team
# Copyright © 2014-2015 <NAME> (@goanpeca)
#
# Licensed under the terms of the MIT License
# ---------------------------------------------------------------------------... |
#!/usr/bin/env python3
import sys, os
import time
import random
import hostio
import json
import io
import zipfile
try:
import gdbremote
except ImportError:
gdbremote = None
from argparse import ArgumentParser, FileType
import api.base
import api.hio
from reset import reset
from string import ascii_lowercase
... |
# This file is covered by the BSD license. See LICENSE in the root directory.
import logging
import os
import shutil
from django.contrib.auth import get_user_model
from django.core.mail import send_mail
from django.db import models
from django.utils import timezone
from django.utils.html import escape
from mainprojec... |
# 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.
"""Tools to find extra plausible actions given an equilibrium.
See https://docs.google.com/document/d/1TG4cqK92q9KOnhXUKH-LdPQUUb9nvzOTYy5D1g... |
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. 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 re... |
"""
kkpy.io
========================
Functions to read and write files
.. currentmodule:: io
.. autosummary::
kkpy.io.read_aws
kkpy.io.read_2dvd_rho
kkpy.io.read_mxpol_rhi_with_hc
kkpy.io.read_dem
"""
import numpy as np
import pandas as pd
import datetime
import glob
import os
import sys
def read_a... |
# coding: utf-8
###
# @file trainer.py
# @author <NAME> <<EMAIL>>
#
# @section LICENSE
#
# Copyright (c) 2019 <NAME>.
#
# 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 re... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import datetime
import dateparser
import feedparser
import requests
import... |
import numpy as np
from qiskit import(
QuantumCircuit,
execute,
Aer)
class QuantumTicTacToe():
def __init__(self) -> None: #Initialize all values in the class
self.simulator = Aer.get_backend('statevector_simulator') #Initialize the simulator
self.circuit = QuantumCircuit(9, 9) #Initialize th... |
#!/usr/bin/env python3
"""
Facet build script wrapping conda-build, and exposing matrix
dependency definition of pyproject.toml as environment variables
"""
import importlib
import importlib.util
import itertools
import os
import re
import shutil
import subprocess
import sys
import warnings
from abc import ABCMeta, abs... |
from formulas import (
iFormula,hFormula,sFormula,iCounts,fCounts,ranLBin,binOp,opTree,
fFormula,expandNeg,genListPartition
)
from cnf import tseitin,to_cnf,fixVars, from_cnf
from remy import ranBin0
from provers import (
iprove,jprove, sel,ljb,fprove,tprove,cprove,ljf,
isTuple,ishow,fshow,to_triplet,fromLis... |
##############################################################################
# Medical Image Registration ToolKit (MIRTK)
#
# Copyright 2016 Imperial College London
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... |
#!/usr/bin/env python
import os
import numpy as np
def gofr_snapshot(axes,pos,rmax,rmin=0,nbin=40,gofr_norm=None):
""" calculate the pair correlation function of a snapshot of a crystal structure given the 'axes' of the simulation cell and the positions ('pos') of atoms inside the cell.
'rmax' is the maximum p... |
import os
import torch
import time
import sys
from configs.config import MyConfiguration
import torch.nn as nn
import glob
from tqdm import tqdm
from scipy import misc
import numpy as np
import re
import functools
from collections import OrderedDict
import pandas as pd
# from torch.autograd import Variabl... |
import random
#import matlab.engine
import os
import pandas as pd
import config
import time
import math
import json
import ast
from flask import request, render_template, Blueprint, json, redirect, url_for, flash
from app import db, login_manager
from models import User
from werkzeug.security import generate_password_h... |
#!/usr/bin/python
from clang.cindex import *
# Default header files {{{
std_files = [
"assert.h",
"complex.h",
"ctype.h",
"errno.h",
"fenv.h",
"float.h",
"inttypes.h",
"iso646.h",
"limits.h",
"locale.h",
"math.h",
"setjmp.h",
"signal.h",
"stdalign.h",
"stdar... |
import copy
from functools import wraps
from django.contrib.auth.models import User
import django.db
from django.db import models
from django.db.models.base import ModelBase
from django.db.models.fields.related import add_lazy_relation
from django.db.models.loading import app_cache_ready, AppCache
from django.db.model... |
import math
import numpy
import logging
import scipy.stats
from atnr import constants
from atnr.util import Profile
from skimage import filter
from skimage import measure
from skimage import transform
from skimage import morphology
# abstractions
class BaseOperation(object):
__abstract__ = True
__inputs__ ... |
import numpy as np
import pyrealsense2 as rs
import cv2
from enum import Enum
from typing import List, Tuple
# ----------------------------- Helper functions ----------------------------- #
class Device:
def __init__(self, pipeline, pipeline_profile, align, product_line):
self.pipeline = pipeline
... |
#!/usr/local/bin/python3.4
#
# fetch.py
#
# <NAME> and <NAME>, Climate Code Foundation.
# Copyright (C) 2008-2010 Ravenbrook Limited.
# Copyright (C) 2011 Climate Code Foundation.
# <NAME>, Revision 2017-07-28
"""
fetch.py [--help] [--list] [--force] [--store <dir>] [--config <file>] [pattern] ...
Script to fetch (do... |
# TODO: Add description to the integration in <root>/Packs/Coralogix/Integrations/Coralogix/Coralogix_description.md
from datetime import timezone
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import requests
import urllib3
import dateu... |
"""Wrapper to call Phabricator's Differential Conduit API."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlcon_differential
#
# Public Classes:
# ReviewStates
# Action
# MessageFields... |
from django.contrib import admin
from django import forms
from django.forms import ValidationError
from django.forms.utils import ErrorList
from django.db.models import Count
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.contrib.postgres.forms.ranges import RangeWidget
from ... |
#!/usr/bin/env python3
"""
MeowNotes functions to interact with the database,
create/delete users and notes, retrieve search results
"""
import sqlite3
import datetime
import operator
import os
import sys
import dateutil.parser
import click
from flask import current_app, g
from flask.cli import with_appcontext
ROOT = o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 12:12:41 2021
@author: sjguo
"""
import pennylane as qml
import autograd.numpy as np
from time import time
import matplotlib.pyplot as plt
dev = qml.device('default.qubit', wires=2) # Define REAL noisy two-qubit device
sim = qml.device('default... |
import requests
from collections import Counter
import random as randomlib
import logging
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
import networkx as nx
import itertools
import pickle
import operator
'''
Lesson Plan Object
'''
class LP:
# def __init__(self, filepath):
# self.content, s... |
from flask import Flask, render_template, request, jsonify, Response, redirect, url_for
import tensorflow as tf
from werkzeug.utils import secure_filename
import os
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
# Restrict TensorFlow to only allocate 1GB of memory on the first GPU
try:... |
# -*- coding: utf-8 -*-
# Importing Required Libraries
import sys
sys.platform = "win32"
import codecs, json, os, re, io, threading, datetime, clr, math
clr.AddReference("IronPython.Modules.dll")
clr.AddReferenceToFileAndPath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "References",
... |
import os
import gc
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
from matplotlib.image import imread
import seaborn as sns
import torch
from torch import nn
from torch.utils.data.dataset import Dataset
from l5kit.geometry import transform_points
from losses import l2... |
import math
import sys
import os
import io
import re
import struct
import collections
import argparse
import textwrap
import crcmod
import usb1
from . import VID_CYPRESS, PID_FX2, FX2Config, FX2Device, FX2DeviceError
from .format import input_data, output_data, diff_data
class VID_PID(collections.namedtuple("VID_PID... |
"""
Test bench to assess field of fire around vehicle.
"""
from math import pi, ceil, sin, atan2, sqrt
import logging, itertools, sys, os, _winreg
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage.morphology import grey_erosion
def query_analysis_tools():
"""
Find the location ... |
#!/usr/bin/env python2
import collections
import datetime
import json
import logging
import numpy
import Queue
import requests
import time
import threading
# ADC support
import Adafruit_ADS1x15
# EPSolar Tracer support
from pyepsolartracer.client import EPsolarTracerClient
from pymodbus.client.sync import ModbusSeri... |
import uuid
import random
import typing
import faker
from author import utils as u
from author.models import Author
from topic.tests.generators import create_topic
from author.tests.generators import create_author
from topic.serializers import TopicListSerializer
from author.serializers import AuthorListSerializer
fr... |
import numpy as np
import torch
from torch.optim import Adam
from pathlib import Path
import scipy
import scipy.signal
import time
import os
from rl_rvo_nav.policy_test.post_train import post_train
import threading
from mpi4py import MPI
def combined_shape(length, shape=None):
if shape is None:
return (len... |
import os
import json
from copy import deepcopy
import numpy as np
from HSTB.kluster import kluster_variables
class VesselFile:
"""
Class to manage the vessel configuration file (.kfc) for Kluster. Holds the tpu parameters and lever arm information
for each system in the project. Stored in a nested dic... |
"""
Implements a general purpose object used to decompose and predict
traces using principle-component analysis.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import warnings
from IPython import embed
import numpy as np
from astropy.io import fits
from... |
import itertools
import operator
import numbers
import scipy.sparse as sparse
from findiff.coefs import coefficients, coefficients_non_uni
from .stencils import Stencil
from .utils import *
from .grids import Grid
DEFAULT_ACC = 2
class Operator(object):
""" Base class for all operator classes """
pass
clas... |
# -*- coding: utf-8 -*-
"""
Usage :
> python bsgs_dll_secp256k1.py -p <KEY> -b 2B_bPfile.bin -bl 2B_bloom.bin -n 500000000000000 -keyspace 800000000000000000000000000000:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -rand
> python bsgs_dll_secp256k1.py -p <KEY> -b 2B_bPfile.bin -bl 2B_bloom.bin -n 500000000000000 -rand1
@aut... |
# -*- coding: utf-8 -*-
# @Author: smallevil
# @Date: 2020-11-24 10:48:40
# @Last Modified by: smallevil
# @Last Modified time: 2020-12-24 13:39:53
from flask import Blueprint, render_template, redirect, session, request, current_app, url_for
import functools
from ..models.AdminModel import AdminModel
import math,... |
"""
Author: Benny
Date: Nov 2019
"""
from torch.utils.tensorboard import SummaryWriter
import argparse
import os
from BigredDataSet import BigredDataSet
import torch
import datetime
import logging
from pathlib import Path
import sys
import importlib
import shutil
from tqdm import tqdm
import provider
import numpy as n... |
"""
Re-implementation of DANN from https://github.com/thuml/Transfer-Learning-Library
"""
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import LambdaLR
from torch.optim.sgd import SGD
from torchvision import transforms
from tqdm import tqdm
from dataset import PixelSetData
from evaluation import val... |
"""(S)HeteroFL"""
import os, argparse, time
import numpy as np
import wandb
from tqdm import tqdm
import torch
from torch import nn, optim
from torch.nn.modules.batchnorm import _NormBase
# federated
from federated.learning import train_slimmable, test, refresh_bn
# utils
from utils.utils import set_seed, AverageMeter,... |
import os, asyncio, random, discord, json, requests, re, datetime
from dotenv import load_dotenv
from discord.ext import commands
import utils
from CFListScraper import ScrapeList
import RanklistCreator as rl
import RatingPlotter as rp
load_dotenv()
from constants import *
TOKEN = os.getenv('DISCORD_TOKEN')
bot = comm... |
import datetime
from flask import json, render_template, redirect, render_template_string, request, flash
from flask_login import current_user, logout_user, login_user
from flask_mail import Message
from sqlalchemy import and_
from werkzeug.exceptions import HTTPException, NotFound, BadRequest, Forbidden
from uBlog i... |
import numpy as np
import datetime
import time
from collections import defaultdict
import copy
from tqdm import tqdm
from .crowdhuman_eval.common import *
from .crowdhuman_eval.demo import _is_ignore
def eval(records, gt, bm_thr):
results = []
total, eps = len(records), 1e-6
for i in tqdm(range(total)):
... |
# #-- -- -- -- Linear Classifiers in Python
# # Used for Data Scientist Training Path
# #FYI it's a compilation of how to work
# #with different commands.
# ### --------------------------------------------------------
# # # # ------>>>> KNN classification
from sklearn.neighbors import KNeighborsClassifier... |
# Bulletproof+ range proof
#
# {(H,G,n),C ; (v,r) | 0 <= v < 2^n, C = vH + rG}
import dumb25519
from dumb25519 import Point, Scalar, ScalarVector, PointVector, hash_to_scalar, random_scalar, hash_to_point, multiexp
import transcript
class RangeParameters:
def __init__(self,H,G,N):
if not isinstance(H,Point):
ra... |
"""Script that visualizes dependencies of Nix packages"""
import argparse
import configparser
import itertools
import os
import random
import shlex
import subprocess
import sys
import tempfile
import logging
import networkx as nx
import pygraphviz as pgv
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot... |
from math import sqrt, log2, log
import pickle
import subprocess
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Inter-node performance.
inter_perf = {
'alpha': 1.2e-6, # Latency, s
'beta': 3.893e-11, # Inverse bandwidth, B/s
'gamma': 1.... |
"""Provides the core domain concept and logic for individual versions."""
import io
from base64 import urlsafe_b64decode, urlsafe_b64encode
from datetime import datetime, date
from enum import Enum
from typing import Any, Dict, Iterable, List, Mapping, MutableSequence, \
NamedTuple, Optional, Tuple, Union
from uui... |
from abc import ABC,abstractmethod
from mir.common import SONIC_VISUALIZER_PATH,WORKING_PATH
import subprocess
import os
import gc
import mir.io
from joblib import Parallel,delayed
import random
from pydub.utils import mediainfo
import time
import datetime
import mir.cache
class ProxyBase(ABC):
d... |
import sys
import traceback
import logging
import pickle
sys.path.append("..") # Adds higher directory to python modules path.
from utils import config_reference as cfg
from data import load_dataset
from models import model_loader
from models import knowledge_distillation_models
from utils import teacher_utils, helper... |
#!/usr/bin/env python
""" Utility module. All auxiliary functions go here.
This module provides internal functionalities for everything else, aside from
handling the internal details of running the simulation itself. There is a
plethora of varied functions, so it's best left alone unless strictly necessary.
Do not mo... |
import math
import random
from calendar import monthrange
from dataclasses import dataclass
from datetime import date, timedelta
from math import ceil
from typing import Callable, Dict, Iterable, List, Optional, Union
from rivoli.models import CountHistory, Hashtag, Month, Tweet
from rivoli.utils import date_to_dmy, m... |
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import numpy as np
from .layers.contrastive import ContrastiveLoss
from .layers.utils import l1norm, l2norm
from .layers.img_enc import EncoderImage
from .layers.txt_enc import EncoderText
class VisualSA(nn.Layer):
"""
Build global image r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.