text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) 2017 <NAME> and MIT CSAIL Computer Vision
# Places project page: http://places2.csail.mit.edu/
import torch
from torch.autograd import Variable as V
from torchvision import transforms as trn
from torch.nn import functional as F
import os
import numpy as np
import cv2
from PIL import Image
SOURCES = {... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import collections
import datetime
import logging
import platform
import webbrowser
import dateutil
import dateutil.parser
import gntp.config
import rumps
from icalendar import Calendar
import hatarake
import hatarake.config
import hatarake.net as reques... |
import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
import numpy as np
from scipy.sparse.linalg import eigsh
from scipy.integrate import odeint
from sympy import expand, collect
from .sos import extract_monoms_and_coeffs
def vector(x, y, system, states):
''' returns a vector of derivaties (given ... |
import matplotlib.pyplot as plt
import numpy as np
import csv
COLNAMES = ['nb_nodes', 'inf_times', 'inf_nb_visits', 'supr_times', 'supr_nb_visits', 'med_times', 'med_nb_visits']
AGGREGATE = 1
MARKER_SIZE = 10
MARKER_EVERY = 10
MARKER_WIDTH = 1.5
def get_column(index, filename):
with open(filename) as csv_file:
... |
#!/usr/bin/env python3
# coding: utf-8
"""
.. module:: BuscoLogger
:synopsis: base logger customization for the analysis pipeline
.. versionadded:: 3.0.0
.. versionchanged:: 4.0.0
This is a logger for the pipeline that extends the default Python logger class
Copyright (c) 2016-2021, <NAME> (<EMAIL>)
Licensed under... |
from bitstring import BitArray
import os
import cppimport
curr_path = os.path.dirname(os.path.realpath(__file__))
aes = cppimport.imp("src.python.aes")
# The block size of encryption
BS_BITS = 128
# Extra bits to be added at the end of the y value. This gives us more
# data that we can use for the matching function.... |
import argparse
import logging
import multiprocessing as mp
import os.path
import sys
from argparse import Namespace
from collections import namedtuple
from typing import Optional, List, Callable
from urllib.parse import urlparse
import psutil
from arango.database import StandardDatabase
from resotolib.args import Arg... |
import argparse
import copy
import csv
import glob
import os
import subprocess
from urllib.request import urlretrieve
import zipfile
from typing import Union
import warnings
import shutil
import sys
import numpy as np
import pandas as pd
from deepethogram import projects
from deepethogram.file_io import VideoReader
f... |
import numpy as np
import unittest
import pystella as ps
__author__ = 'bakl'
def lc_create(bname, m=-19, tbeg=0., tend=200., n=10, is_err=False):
time = np.linspace(0. + tbeg, tend + tbeg, n)
mags = m * np.linspace(0.1, 1., n)
band = ps.Band(bname)
if is_err:
errs = m * np.linspace(0.01, 0.3... |
"""
Reference:
https://github.com/pranz24/pytorch-soft-actor-critic
"""
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from plato.config import Config
from plato.utils.reinforcement_learning.policies import base
from torch.distributions import Normal
LOG_SIG_MAX = 2... |
import os
from argparse import ArgumentParser
from collections import OrderedDict
from functools import partial
import numpy as np
import torch
import torch.nn as nn
import torchmetrics
from torch import optim
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from torchvision im... |
#! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 <NAME> and <NAME>.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this work or any portio... |
import ctypes
import ctypes.util
import sqlite3
import sys
from ctypes import (
CFUNCTYPE,
POINTER,
c_char_p,
c_double,
c_int,
c_int64,
c_size_t,
c_ssize_t,
c_ubyte,
c_void_p,
)
from typing import Any, Callable, Optional, Tuple
from llvmlite.ir.instructions import ExtractValue, ... |
def get_kpts_from_kpd(atoms, kpd, only_even = False, show_kpts = True, atol = 1e-1 ):
if only_even:
step = 2
else:
step = 1
# tries to keep equi-planar spacing in k-space to match a KPD
import numpy as np
#kpd = kpoint_density
lengths_angles = atoms.cell.cellpar()
... |
"""SALDO Model builders."""
import logging
import pathlib
import pickle
import re
import xml.etree.ElementTree as etree
import sparv.util as util
from sparv import Model, ModelOutput, modelbuilder
log = logging.getLogger(__name__)
# SALDO: Delimiters that hopefully are never found in an annotation or in a POS tag:
... |
# MIT License
#
# Copyright (c) 2021- <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 restriction, including without limitation the rights
# to use, copy, modify, merge, p... |
# -*- coding: utf-8 -*-
"""
Example of how to use shark to for probabilistic Monte-Carlo simulations with DELPHIN 5.8.
===============================================================================
2018-05-04
In this script, you first have to define the parameter distributions, as are all the
other variables needed ... |
"""Functions related to stellar mass function."""
from __future__ import print_function, division, unicode_literals, absolute_import
from astropy.table import Table
from scipy.stats import norm
import numpy as np
from . import utils
__all__ = ['get_smf_bootstrap', 'bootstrap_smf', 'bootstrap_resample',
... |
"""
default
=======
Synchronous and asynchronous NIS client using the default backend.
The core HTTP client shares a global session, to share a connection
pool to speed up requests.
License
-------
Copyright 2019 NEM
Licensed under the Apache License, Version 2.0 (the "License")... |
import math
import re
from viz.utils import *
# styling
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css',
'https://codepen.io/chriddyp/pen/brPBPO.css']
## threadid. Change to get this from url when avilable.
# hard code if needed thread_id = 'b2oR7iGkFEzVgimbNZFO'
... |
import requests
import os
from collections import Counter
from datetime import datetime, timedelta, date, time
import json
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
class Scheduler:... |
#!/usr/bin/env python
# Statistical Hypothesis Testing: Bootstrap Resampling
# Author: <NAME>
# Github: https://github.com/mirbostani
from collections import Counter
from tqdm import tqdm
import string
import re
import argparse
import json
import sys
import random
import math
import time
import statistics as stats
i... |
import pandas as pd
import matplotlib.pylab as plt
import numpy as np
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import TimeSeriesSplit
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LassoCV, RidgeCV, LinearRegression
from sklearn.svm import SVR
f... |
# Copyright (c) Two Sigma Open Source, LLC
#
# Licensed under the Apache license, Version 2.0 (the "License");
# you may not use this file ecept 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 ... |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
__all__ = [
'is_matrix', 'is_square', 'is_column', 'is_row', 'is_diag', 'is_symmetirc',
'col', 'row', 'deg2rad', 'rad2deg', 'cart2pol', 'pol2cart', 'cart2sph',
'sph2cart', 'rotate_matrix_rad', 'rotate_matrix_deg', 'el... |
#!/usr/bin/python3
# coding:utf-8
from PIL import Image, ImageDraw
from datetime import datetime
from io import BytesIO
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from seleni... |
# vim:ts=4:sts=4:sw=4:expandtab
import glob
import os
import tempfile
from satori.client.common import want_import
want_import(globals(), '*')
from satori.web.utils.decorators import contest_view
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import rende... |
from db import *
from shared import *
import re
''' NickOP Services '''
def process_nickop_help(self, prefix, command, params):
username = prefix[1:]
hpath = "./help/nickop/"
if len(params) == 2:
hfile = open(hpath + "help.txt", 'r')
lines = hfile.readlines()
for... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import cv2
import torch
import numpy as np
import os.path as osp
from maskrcnn_benchmark.config import cfg
from torchvision.transforms import functional as F
from maskrcnn_benchmark.data.build import build_dataset
from maskrcnn_benchmark.... |
#!/usr/bin/env python3
# todo.py
# Create and manage an ordered list of tasks.
# Tasks may be added either to the start or the end of the list.
# Tasks are stored in yaml format.
from pathlib import Path
from os import environ
from yaml import safe_load_all, safe_dump_all
try:
from yaml import CLoader as Loader,... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# 查看当前挂载的数据集目录, 该目录下的变更重启环境后会自动还原
# View dataset directory. This directory will be recovered automatically after resetting environment.
get_ipython().system('ls /home/aistudio/data')
# In[ ]:
# 查看工作区文件, 该目录下的变更将会持久保存. 请及时清理不必要的文件, 避免加载过慢.
# View personal work direc... |
import json
import os
from functools import partial
from http.server import HTTPServer, SimpleHTTPRequestHandler
from threading import Thread
from tkinter import HORIZONTAL, E, N, S, StringVar, Tk, W, ttk
from utils.ui import AutocompleteCombobox, SmashggTab
STATE_FILE_PATH = "./web/state.json"
COUNTRIES_FILE_PATH = ... |
# The MIT License (MIT)
#
# Copyright (c) 2017 <NAME> for Adafruit Industries
#
# 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
# ... |
import pathlib
import typing as t
from io import BytesIO
from queenbee.io.inputs.job import JobArgument, JobPathArgument
from queenbee.job import Job as QbJob
from queenbee.job import JobArguments, JobStatus, RunStatus
from queenbee.recipe import Recipe as QbRecipe
from queenbee.recipe import RecipeInterface
from .ap... |
# stdlib
from typing import Any
from typing import List as TypeList
# third party
import numpy as np
import pytest
import torch as th
from torchvision import datasets
from torchvision import transforms
# syft absolute
import syft as sy
from syft import SyModule
from syft import SySequential
from syft import logger
fr... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 15:27:39 2020
@author: xavier.mouy
"""
from .detector_builder import BaseClass
from ecosound.core.spectrogram import Spectrogram
from ecosound.core.annotation import Annotation
from scipy import signal, ndimage
from datetime import datetime
import numpy as np
import p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Computes predictions with a neural network trained for singing voice detection.
For usage information, call with --help.
Author: <NAME>
"""
from __future__ import print_function
import sys
import os
import io
from argparse import ArgumentParser
import numpy as np
... |
from ovos_utils.log import LOG
from autobahn.twisted.websocket import WebSocketClientFactory, \
WebSocketClientProtocol
from twisted.internet.protocol import ReconnectingClientFactory
from jarbas_hive_mind.exceptions import UnauthorizedKeyError, \
SecureConnectionFailed, ConnectionError, HiveMindEntryPointNotFo... |
"""
Tests involving traits. This will notify us if any future versions of Traits we
switch to have changed the tested behavior, and it also helps refresh my memory
about how these things work.
"""
import unittest
import copy
from enthought.traits.api import HasTraits, TraitType, implements, \
... |
from PIL import Image, ImageDraw, ImageFont
from sys import argv
import os
import json
COMPONENTS_DIR = os.path.dirname(argv[0]) + '\\components\\' # Use Only 'components\\' while in DevMode;
BOX_WIDTH = 59
PAN_CENTER_PLACE = 'AMBARI BAZAR'
class FormData():
title = ''
first_name = ''
middle_name = ''
... |
#!/usr/bin/env python
from picamera.array import PiRGBArray
from picamera import PiCamera
import numpy as np
import cv2
import time
x_pos = 0
y_pos = 0
def read_rgb_image(image_name, show):
rgb_image = cv2.imread(image_name)
if show:
cv2.imshow("RGB Image",rgb_image)
return rgb_image
def filter... |
# pyenchant
#
# Copyright (C) 2004-2008, <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libr... |
from flask import Flask, request
import requests, json, time, re
import Blockchain, Block
# init flask
app = Flask(__name__)
# init blockchain
blockchain = Blockchain.Blockchain()
blockchain.create_genesis_block()
# The last thing requested
tx_search = None
# List of accepted accounts
accounts = ["1001"]
# Number... |
# Last Modified Date: 20 Feb 2021
from helper import iterate, DataFile
import os
import sys
import pickle
import warnings
import requests
from bs4 import BeautifulSoup
import pandas as pd
from tqdm.auto import tqdm
from datetime import datetime
sys.path.insert(1, os.getcwd())
def check_adjusted_price(old_price, pric... |
import random
# Heroes
class Hero:
def __init__(self, name, health=100):
self.armors = list()
self.start_health = health
self.health = health
self.deaths = 0
self.kills = 0
self.abilities = list()
self.name = name
def add_ability(self, ability):
... |
#
# Common configuration functions.
#
import datetime
import os
import shutil
import socket
import time
import traceback
import yaml
from flask import Flask, jsonify, abort, request, flash
from stat import S_ISREG, ST_CTIME, ST_MTIME, ST_MODE, ST_SIZE
from subprocess import Popen, TimeoutExpired, PIPE
from os import ... |
import argparse
import os
import time
import numpy as np
import tensorflow as tf
from six.moves import cPickle
from mnist_data import *
from model import CPPNResnet
"""
cppn vae:
compositional pattern-producing generative adversarial network
LOADS of help was taken from:
https://github.com/carpedm20/DCGAN-tensorf... |
# Created By: <NAME>
# Created On: 2004/12/22
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_li... |
import datetime
from forgehub.events import *
from forgehub.git import *
from forgehub.render import *
from argparse import ArgumentParser, FileType, Namespace
import os
import sys
from typing import Optional, Union
from github import AuthenticatedUser, Github, GithubException, NamedUser
import pygit2
GithubUser = ... |
import numpy as np
import matplotlib.pyplot as plt
from pendulum import Pendulum
from scipy import io
'''
This is a script that computes the region of attraction for proving the asymptotic stability
of the Variable-Length Pendulum (VLP) problem.
The name 'adaptive' originated from the fact that the dense of grid po... |
# 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 applicable law or agree... |
import StringIO, sys, sets
from twisted.trial import unittest, runner
from twisted.scripts import trial
from twisted.python import util
from twisted.trial.test.test_loader import testNames
def sibpath(filename):
"""For finding files in twisted/trial/test"""
return util.sibpath(__file__, filename)
class Te... |
import datetime
import csv
import json
from random import randint
import re
import plotext as plt
from plotext._utility import color, data, plot
from rich.console import Console
from rich.panel import Panel
from rich.prompt import Confirm, FloatPrompt, IntPrompt, Prompt
from . import cli_theme
# Starting point of th... |
import os
import requests
import typing
from collections import defaultdict
from bmt import Toolkit
from jsonasobj import as_dict
# set the default version for the UI and web service calls
default_version = os.environ.get('DEFAULT_VERSION', "2.2.3")
# do not load these versions
skip_versions = ['v1.0.0', 'v1.1.0', 'v... |
# +
from glob import glob
import os, re
import imghdr
from datetime import datetime
#import doctest
import numpy as np
import matplotlib.pylab as plt
from skimage import io
from skimage.color import rgb2gray
from collections import defaultdict
import pickle
# -
def extract_digits(string):
'''Extract all digits... |
"""
Admin utils
"""
import logging
from admin_auto_filters.filters import AutocompleteFilterFactory
from django.contrib.admin import FieldListFilter, RelatedFieldListFilter
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_admin_listfilter_dropdown.filters import Relat... |
#!/usr/bin/env python3
from uuid import uuid4
import praw
from flask import Flask, request, url_for, abort
from praw.util.token_manager import BaseTokenManager
app = Flask(__name__)
CLIENT_ID = '' # Add your Client ID here
CLIENT_SECRET = '' # Add your Client Secret here
USER_AGENT = 'minimal praw OAuth Webserver by... |
import collections
from .entity import *
from .instance import *
class Model:
def __init__(self):
pass
# Cross-Related Methods - START
def cross_individual(self, left, right, connection, choices):
if isinstance(left, NoneEntity) or isinstance(right, NoneEntity):
return NoneEn... |
"""
Get Turkish words definitions, example sentences, pronunciations, etc.
from the TDK (Türk Dil Kurumu) dictionary.
"""
import dataclasses
import json
import os
import urllib
import urllib.error
import urllib.parse
import urllib.request
from typing import Dict, List, Optional
__all__ = [
"TDK",
"TDKError",... |
# Copyright (c) 2015 <NAME> <<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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
import argparse
import datetime
import logging
import os
import re
import json
import tempfile
import boto3
import requests
from dataactcore.config import CONFIG_BROKER
from dataactcore.interfaces.db import GlobalDB
from dataactcore.logging import configure_logging
from dataactcore.models.domainModels import DUNS
from... |
import torch
import torch.utils.data
import torchvision
from glob import glob
import json
import os
from pathlib import Path
import random
from PIL import Image
from zipfile import ZipFile
import torchvision.transforms as transforms
from enum import IntFlag, IntEnum, Enum
import logging
import numpy as np
SET_NAMES =... |
#!/usr/bin/env python
'''Select the instances of ubxlib test HW to run.'''
import u_data # Accesses the instance database
# The functions here process a set of file paths that have
# been modified in a pull request and, given a database of
# ubxlib HW instances and knowledge of the ubxlib directory
# structure, deci... |
# Copyright 2022 SAP SE
#
# 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, sof... |
#myemail.py
#!/Users/anna/anaconda3/envs/cron/bin/python3
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.multipart import MIMEMultipart
from email.mime.multipart import MIMEBase
from email.mime.text import MIMEText... |
from collections import OrderedDict
import copy
from PIL import Image
from torch import nn
from torch import optim
from torch.autograd import Variable
from torchvision import datasets, transforms, models
import argparse
import json
import matplotlib.pyplot as plt
import numpy as np
import os, random, sys
import time
im... |
import torch
import torchvision.transforms as transforms
import torch.nn.functional as F
from .verification import evaluate
from datetime import datetime
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
from PIL import Image
import bcolz
import io
import os
##########################
# 3DDF... |
"""
OpenMDAO design-of-experiments Driver implementing the Latin Hypercube and Optimized Latin Hypercube methods.
"""
from collections import OrderedDict
import os
from random import shuffle, randint, seed
from six import iteritems, itervalues
from six.moves import range, zip
import numpy as np
from openmdao.driver... |
import torch
from torch import nn
import cf.gumbel_utils as gt
from cf import models
def fix_coupling_sinkhorn(log_coupling, log_p1, log_p2, iterations=10):
"""Adjust a coupling to approximately match marginals using Sinkhorn iteration.
Args:
log_coupling: Log of a coupling, possibly unnormalized, of shape... |
import numpy as np
import cv2
import math
import serial
import time
# configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
port='/dev/ttyACM0',
baudrate=9600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVEN... |
# coding:utf-8
# added May 17th 1:33 am, this block solves the problem:
# UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)
from flask import render_template, abort, flash, redirect, url_for, \
request, current_app, make_response, g
from flask.ext.login import lo... |
"""
Functions to talk to RCv3 service
"""
import json
import re
from pyrsistent import pset
from toolz.functoolz import curry, identity
from otter.cloud_client import (
ExceptionWithMessage, ServiceType, log_success_response, service_request)
from otter.util.http import append_segments
from otter.util.pure_http... |
from __future__ import print_function
import sys
import argparse
import traceback
import getpass
from aclpwn import utils, pathfinding, database, exploitation
from aclpwn.restore import RestoreOperation
def print_m(string):
sys.stderr.write('\033[94m[-]\033[0m %s\n' % (string))
def print_o(string):
sys.stder... |
"""Run control manager."""
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful. This program
# and the accompanying materials are made available under the terms of ... |
# ---
# name: capsule-opportunities
# deployed: true
# config: index
# title: Capsule Opportunities
# description: Returns a list of opportunties from Capsule
# params:
# - name: properties
# type: array
# description: The properties to return (defaults to all properties). See "Returns" for a listing of the ... |
import numpy as np
from math import factorial
import os
import ot
import copy
import matplotlib
import trainer
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.switch_backend('agg')
def create_directory(dir_name):
"""create directory
Parameters
----------
dir_name : str(file path)
cre... |
""" Kedro-Viz plugin and webserver """
import hashlib
import json
import multiprocessing
import socket
from collections import defaultdict
from contextlib import closing
from pathlib import Path
from typing import Dict, List, Set
import kedro
import requests
from semver import VersionInfo
from toposort import toposor... |
"""
-preSplits all *.tif files in the DataDEM folder to smaller 1024x1024 files.
-Removes files that have only 0 values (sea).
-Downloads RGB Images for every split 1024x1024 tile.
-Splits DEMs and Images again to get 256x256 tiles.
-DEMs are normalized to 0-255
Example 'python3 Dataset.py'... |
#!/usr/bin/env python
'''
This script is a wrapper for module two, part 1: typing and resistance gene idenfification from assemblies.
It uses mlst, resfinder, plasmidfinder, rgi, mobsuite for sequence typing, AMR profile prediction and plasmid predictions.
The output is a TSV summary of the results.
Example usage... |
"""Helper methods for class-activation maps."""
import numpy
from keras import backend as K
import tensorflow
from scipy.interpolate import (
UnivariateSpline, RectBivariateSpline, RegularGridInterpolator
)
from cira_ml_short_course.utils import utils
from cira_ml_short_course.utils.saliency import _get_grid_point... |
import argparse
import zipfile
import wget
import logging
import subprocess
from pathlib import Path
from robopose.config import PROJECT_DIR, LOCAL_DATA_DIR
from robopose.utils.logging import get_logger
from robopose.paper_models_cfg import *
logger = get_logger(__name__)
RCLONE_CFG_PATH = (PROJECT_DIR / 'rclone.conf... |
#
# Ported from https://github.com/karpathy/cryptos
#
"""
Test the generation of secret/public keypairs and bitcoin addreses
"""
from crypto.key import PublicKey, PrivateKey
from crypto.b58check import b58decode
from crypto.sha256 import sha256
def test_public_key_gen():
# Example taken from Chapter 4 of Master... |
from railroad_diagrams import *
def language(document, tag):
return 'https://rspeele.gitbooks.io/rezoom-sql/doc/Language/' + document + '.html#' + tag
def expr():
return NonTerminal('expr', language('Expr', 'expr'))
def select_core():
return NonTerminal('select-core', language('SelectStmt', 'select-core'... |
#!/usr/bin/python
#
# Copyright 2016 <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 applicable law ... |
"""ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Deep Residual Learning for Image Recognition. arXiv:1512.03385
Pre-trained ImageNet models: 'deci-model-repository/resnet?/ckpt_best.pth' => ? = the type of resnet (e.g. 18, 34...)
Pre-trained CIF... |
# -*- coding: utf-8 -*-
import re
import ConfigParser
import decimal
import datetime
from sqlalchemy import create_engine, Integer
from sqlalchemy.sql import func
from sqlalchemy.sql.expression import cast
from sqlalchemy.exc import NoSuchColumnError
from sqlalchemy.ext.declarative import declarative_base
from geoalch... |
from base64 import b64encode
from datetime import datetime
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.files import File
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.db import connection
from django.test import TestCase, Transacti... |
#!/usr/bin/env python
#version: 1.0 release
import threading
import argparse
import random
import atexit
import socket
import socks
import time
import ssl
import sys
active_connections = 0
connection_limit = 0
active_threads = 0
max_threads = 100
delay = 1
hrs = 0
total_hrs = 0
total_connected = 0
user_agents = [
... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import infra.e2e_args
import infra.network
import infra.proc
import infra.logging_app as app
from ccf.tx_id import TxID
import suite.test_requirements as reqs
import time
import tempfile
from shutil import copy
import o... |
# Copyright 2016-2021 The <NAME> at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");
# you ... |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013--, biocore development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... |
import argparse
import numpy as np
from itertools import count
from collections import namedtuple
import cv2
import sys
import IPython
import matplotlib.pyplot as plt
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distribution... |
#!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torc... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import time
import numpy as np
import torch
from onpolicy.runner.shared.base_runner import Runner
import wandb
import imageio
import os
from torch.utils.data import DataLoader
from onpolicy.algorithms.r_mappo.r_mappo import R_MAPPO as TrainAlgo
from onpolicy.algorithms.r_mappo.algorithm.rMAPPOPolicy import R_MAPPOPoli... |
"""GDB pretty-printers for CSD.
"""
import enum
import gdb
import gdb.xmethod
import re
_csd_printer_name = 'csd_pretty_printer'
_csd_xmethod_name = 'csd_xmethods'
def _remove_generics(typename):
if type(typename) is gdb.Type:
typename = typename.name or typename.tag or str(typename)
match = re.match('^([^<]... |
#!/usr/bin/env python3
# Copyright 2017 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... |
# Elementary Math functions
from vsip import *
def __isSizeCompatible(a,b):
if 'mview' in a.type and 'mview' in b.type:
if (a.rowlength == b.rowlength) and (a.collength == b.collength):
return True
elif 'vview' in a.type and 'vview' in b.type:
if a.length == b.length:
re... |
# coding:utf-8
import sys
import numpy as np
import torch
import os
import argparse
import json
import codecs
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from hparams import create_hparams
from models import Cascaded_Tacotron2
from layers import TacotronSTFT, ST... |
import sys, os
import numpy as np
from itertools import cycle
import json
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torch.distributions as dist
from torch.autograd import Variable
from tensorboardX import SummaryWriter
from torch.utils.data import DataLoader
from divergence_me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.