text stringlengths 3.07k 22.1k |
|---|
import random
from cocos.director import director
from cocos.scenes.transitions import SplitColsTransition, FadeTransition
import cocos.layer
import cocos.scene
import cocos.text
import cocos.actions as ac
import cocos.collision_model as cm
import pygame.mixer
import actors
import mainmenu
from scenario import get_s... |
# Modifications copyright 2022 AI Singapore
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
# PyTorch Playground
# Copyright (C) 2021 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progr... |
from __future__ import print_function, division
from functools import partial
import torch
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
try:
from itertools import ifilterfalse
except ImportError: # py3k
from itertools import filterfalse as ifilterfalse
def f1_loss(... |
# -*- coding: utf-8 -*-
"""
<NAME>
Continous Bag-of-Words
I will use a large dataset (WikiText2, PennTreebank or Sherlock Holmes)
Input vector is 2*N-of-2*N*V encoded vector (fed to the neural network as an
N_sample-by-2*N*V tensor)
@author: hp
"""
import torch
import torch.nn as nn
import torch.optim as optim
impo... |
#!/usr/bin/env python3
"""
logfile_check.py - check if a logfile is good.
A good logfile has simulations that each has
(a) non-duplicated, non-skipped, monotonically increasing timestamps; and
(b) the last timestamp value (in picoseconds) as a multiple of 1000.
"""
import argparse
def read_logfile(logfile):
"... |
# Copyright 2020 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2017 IBM Corp. 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 agre... |
import unittest
from matplotlib import pyplot as plt
from jax.scipy.linalg import expm
from optimism.JaxConfig import *
from optimism import EquationSolver as EqSolver
from optimism import FunctionSpace
from optimism.material import J2Plastic as J2
from optimism import Mechanics
from optimism import Mesh
from optimism... |
import os
import re
import mistune
import collections
import time
import yaml
from functools import wraps
from datetime import datetime, date, timedelta
from pygments import highlight
from pygments.formatters import html
from pygments.lexers import get_lexer_by_name
from flask import render_template, send_from_director... |
# training
import numpy as np
import os
import time
import struct
import sys
import RNG
import tensorflow as tf
tf.config.threading.set_inter_op_parallelism_threads(32)
tf.config.threading.set_intra_op_parallelism_threads(32)
try:
nchl=int(sys.argv[1])
except:
print("Error: Failed to get n_channel. Exiting.")
... |
# coding: utf-8
"""
This module contains all the code related to fetching and loading flats lists.
"""
from __future__ import absolute_import, print_function, unicode_literals
from builtins import str
import collections
import itertools
import json
import logging
from flatisfy import database
from flatisfy import too... |
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
# import xml.etree.ElementTree as ET
import csv
# plt.rcParams.update({'font.size': 22})
# cwd = os.getcwd()
import glob
import os
import pandas as pd
from scipy import interpolate
import json
import math
import sys
def generate_ppm_axis(size, l... |
#!/usr/bin/env python
# cardinal_pythonlib/httpconst.py
"""
===============================================================================
Original code copyright (C) 2009-2021 <NAME> (<EMAIL>).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the "License");
... |
import sys
import os
import random
import numpy as np
import pickle
import pdb
import torch
import torch.nn.functional as F
from models import JointEmbeder
from configs import get_config
GPU_ID = 0
random.seed(42)
np.random.seed(42)
torch.manual_seed(42)
torch.cuda.set_device(GPU_ID)
torch.cuda.manual_seed_all(42)
... |
import pprint
import warnings
import tiledb
from tiledb.main import PyFragmentInfo
"""
Retrieves information from all fragments for a given array.
"""
class FragmentInfoList:
"""
Class representing an ordered list of FragmentInfo objects.
:param uri: URIs of fragments
:param version: Fragment versi... |
import os
import re
import torch
from typing import Union
import cv2 as cv
import json
from typing import List, Tuple, Dict
from vqa_benchmarking_backend.datasets.dataset import DataSample, DiagnosticDataset
from vqa_benchmarking_backend.utils.vocab import Vocabulary
import numpy as np
from vqa_benchmarking_backend.tok... |
import asyncio
import errno
import os
import ssl
import sys
import threading
import time
from abc import ABCMeta, abstractmethod
from contextlib import ExitStack
from pathlib import Path
from socket import AF_INET6, SOCK_STREAM, create_connection, has_ipv6
from socket import socket as makesock
from socket import timeou... |
from assemblyline.odm import Keyword, Text, List, Compound, Date, Integer, \
Float, Boolean, Mapping, Classification, Enum, Any, UUID, Optional, IP, Domain, URI, URIPath, MAC, PhoneNumber, \
SSDeepHash, SHA1, SHA256, MD5, Platform, Processor, ClassificationString, FlattenedObject, Email
# Simple types can be r... |
from utils import process_tweet, lookup
import pdb
from nltk.corpus import stopwords, twitter_samples
import numpy as np
import pandas as pd
import nltk
import string
from nltk.tokenize import TweetTokenizer
from os import getcwd
# If you are running this notebook in your local computer, don't forget to download the t... |
from flask import Flask,send_file,request,render_template,redirect,url_for,session,flash,jsonify
#from pdf import create
from fpdf import FPDF,HTMLMixin
import os
from json import dump
import xml.etree.ElementTree as ET
from db_checker import check
from dbconnector import connection
visible="readonly"
class MyFPDF(FPDF... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# and the Talkowski Laboratory
# Distributed under terms of the MIT license.
"""
Preprocess Roadmap Epigenomics ChromHMM data and distill various summary matrices
"""
import pybedtools as pbt
import csv
from pathlib import Path
im... |
import os
import os.path as osp
import logging
import yaml
import numpy as np
from utils.util import OrderedYaml
Loader, Dumper = OrderedYaml()
def parse(opt_path, opt_list=None, is_train=True):
with open(opt_path, mode='r') as f:
opt = yaml.load(f, Loader=Loader)
# export CUDA_VISIBLE_DEVICES
gpu... |
from django.db import models
from django.urls import reverse
import random
from gogoedu.models import Word,Lesson,Kanji
def random_id(length):
"""return a random string of given length
the string is composed of numbers and lowercase letters
"""
CHARACTERS = 'abcdefghijklmnopqrstuvwxyz0123456789'
re... |
# This source code is part of the Gecos package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__author__ = "<NAME>, <NAME>"
__all__ = ["ColorOptimizer", "ScoreFunction", "DefaultScoreFunction"]
from collections import namedtuple
import abc
import copy
import ... |
import sys
import os
import re
from contextlib import redirect_stdout
import unittest
from arpeggio import ParserPython, NonTerminal, Terminal, flatten
from arpeggio import Sequence, OrderedChoice, ZeroOrMore, OneOrMore, EOF
from arpeggio import RegExMatch as _
#-----------------------------------------------------... |
"""Setup Apache Arrow as external dependency.
A repository rule is defined here. It depends on the following
environment variables:
ARROW_HEADER_DIR
ARROW_SHARED_LIBRARY_DIR
"""
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//third_party:pyarrow_version.bzl", "LIBARROW_DYLIB", "LIBARROW_PYTHON_DYLIB", "LIBARRO... |
import os
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from .util import constants
sys.path.append('..')
import qtutil
from .util.custom_qt_items import MyProgressDialog
from .util import file_io
import functools
import tifffile as tiff
import cv2
from .util.plugin import PluginDefault
from .util... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import re
import scipy
import numpy as np
import tensorflow as tf
from collections import OrderedDict
def mkdir(paths):
if not isinstance(paths, (list, tuple)):
paths = [paths]
for ... |
import warnings
import jax.numpy as jnp
import numpy as np
import pytest
import tensorflow as tf
import torch
import lab as B
# noinspection PyUnresolvedReferences
from .util import Tensor, approx, to_np, check_lazy_shapes
@pytest.mark.parametrize(
"dtype, f_plain",
[
(np.float32, np.random.randn),... |
# Copyright (c) 2020 <NAME>, Inc. All Rights Reserved.
#
# This document does not contain technology or Technical Data controlled under either
# the U.S. International Traffic in Arms Regulations or the U.S. Export Administration
#
# Distribution A: Approved for Public Release, Distribution Unlimited
import pathlib
im... |
import datetime
import logging
import pytest
from dbcat.catalog import ColumnLineage
from networkx import edges
from data_lineage import load_graph
from data_lineage.parser import analyze_dml_query, extract_lineage, parse
from data_lineage.parser.dml_visitor import SelectSourceVisitor
logging.basicConfig(level=getat... |
# Register your models here.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import *
class ContributorTypeAdmin(admin.ModelAdmin):
search_fields = ["short_name", "description"]
list_display = ["short_name", "description"]
admin.site.register(Con... |
import codecs
import os
import pytest
from util import get_through_spectre
from zipkin_util import load_zipkin_spans
SYSLOG_FILE = '/var/log/syslog/spectre.log'
@pytest.fixture
def clean_log_files():
# Clean the log file to avoid pollution
# We can't delete it because scribe doesn't recreate it
if os.p... |
import torch.nn as nn
import torch
import torch.nn.functional as F
import torchvision.models as models
import sys
import pcl
import pcl_util
import utils
import dataset_h36m
import dataset_3dhp
class Resnet_H36m(nn.Module):
def __init__(self, device, num_joints=32, use_pcl=False, use_resnet50=True, use_pretrain=... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
#!/usr/bin/env python3
# coding: utf-8
#
# $Id: rogue_test05.py 894 $
# SPDX-License-Identifier: BSD-2-Clause
#
"""
from http://www.roguebasin.com/index.php?title=Roguelike_Tutorial,_using_python3%2Btdl,_part_5
http://roguecentral.org/doryen/data/libtcod/doc/1.5.1/html2/color.html?c=false&cpp=false&cs=false&py... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Spork
-----
A "little language" designed to facilitate the extraction and processing of
data held in XML or HTML files.
:copyright: © 2015-2022 Oracle Corporation
:copyright: © 2022 Sioned Arrowsmith
:author: <NAME> <<EMAIL>>
:licence: MIT, see LICENSE for more details
""... |
import numpy as np
import torch
from . import box_iou_rotated_ext
from ..convex import convex_sort
def obb_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, device_id=None):
assert mode in ['iou', 'iof']
assert type(bboxes1) is type(bboxes2)
if is_aligned:
assert bboxes1.shape[0] == bboxes... |
#!/usr/bin/env python3
# ==- testreduce.py - Test case reducer ----------------------*- python -*--===//
#
# Copyright 2019 Contributors to the Gazer project
#
# 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... |
import os
from autoFIS.autoFIS.databases_map import dictionary_data
import autoFIS.autoFIS.utils_autofis as toolfis
from autoFIS.autoFIS.evaluation import Evaluation
from itertools import chain
import timeit
import datetime
from RandomFISonezip import random_fis_one_zip
from evalRF import normalizar
from parameters_ini... |
'''
File: multi_task.py
Author: <NAME>
Version: 0.1
Create: 2013-04-03 15:54:01
Description: processing with multiple instances
'''
import multiprocessing
import queue, signal
import logging
def _default_task_pos():
import os
_c = 'AWS_BATCH_JOB_ARRAY_INDEX'
if _c in os.environ:
return int(os.envi... |
# -*- coding: utf-8 -*-
"""
Requires panoptes-client and (on Python 2) futures.
pip install panoptes-client futures
"""
import argparse
import textwrap
import csv
import json
import os
import io
import operator
import sys
from datetime import datetime
import panoptes_client
from panoptes_client import Panoptes,... |
#BSD 3-Clause License
#
#Copyright (c) 2019, The Regents of the University of Minnesota
#
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
#* Redistributions of source code must retain the above cop... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import soniccmsscaletest
import os.path as osp
from time import sleep
import logging, datetime, os, glob, re, pprint, math
logger = logging.getLogger('soniccmsscaletest')
date_fmt_str_in_output = '%a %b %d %H:%M:%S %Y'
short_date_fmt_... |
import re
import datetime
import isodate
import math
import requests
from dateutil.parser import parse
from shapely.geometry import box
def is_range_common_era(start, end):
"""
does the range contains CE dates.
BCE and CE are not compatible at the moment.
:param start:
:param end:
:return: F... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# encoding = utf-8
import os
import sys
import time
import datetime
import json
import hashlib
# Import custom librairies
from pyzscaler import ZPA
import restfly
INPUT_UID = None
ZSCALER_INSTANCE = None
'''
IMPORTANT
Edit only the validate_input and collect_events functions.
Do not edit any other part... |
#!/usr/bin/env python3
# Copyright 2019 VMware, 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... |
class Input():
def __init__(self, name):
self.name = name
self.held = False
def reset(self):
pass
def update(self):
if (not self.held):
self.reset()
def hold(self):
self.held = True
def release(self):
self.held = Fal... |
#!/usr/bin/env python3
import os
import sys
import hashlib
import subprocess
import platform
import json
import datetime
import glob
import shutil
import posixpath
from dpx2ffv1parameters import args
def assign_limit():
if args.textlimit:
limit = args.textlimit
else:
limit = None
return li... |
# MQTT Client demo
# Continuously monitor two different MQTT topics for data,
# check if the received data matches two predefined 'commands'
import paho.mqtt.client as mqtt
from neopixel import *
import colorsys
import time
import threading
import random
# LED strip configuration:
LED_COUNT = 16 # Number of LED pixe... |
import tifffile as tif
import gc
import pandas as pd
import numpy as np
import cv2
from shapely import affinity
from shapely import wkt
from shapely.geometry import Polygon, MultiPolygon
from collections import defaultdict
import matplotlib.pyplot as plt
import global_vars
import os
def shw(im, y=6.0, x=6.0):
p... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import torch
import torch.utils.data as data
import matplotlib.pyplot as plt
import numpy as np
import sys
import os
import time
from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction
# Determine how often to print the batch loss while training/validating.
# We set this at `100` to avoid clogging the ... |
import numpy as np
from pathlib import Path
from scipy.signal import savgol_filter
from scipy.stats import pearsonr
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.decomposition import TruncatedSVD
from sklearn.linear_model import Ridge
from sklearn.metrics import r2_score
"""
General linear alge... |
# Reverse Correlation Model
#
# Copyright (C) 2010-2011 <NAME>
#
# See LICENSE.TXT that came with this file.
import numpy as np
from PlexSpikeData import PlexSpikeData
class RevCorrData(PlexSpikeData):
def __init__(self, *args,**kwargs):
super(RevCorrData, self).__init__(*args,**kwargs)
self.spik... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import re
import os
import subprocess
import numpy
import ctypes
from multiprocessing import Pool
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from Amalphy.Amalphy_Script_Tree import readTree, getLeavesNames, getLeavesNumNames,... |
from ftplib import FTP as FTPconn
from ftplib import FTP_TLS as TLSconn
from ftplib import all_errors, error_perm
from functools import wraps
import logging
import os
from typing import Tuple
from RPA.core.notebook import notebook_file
class AuthenticationException(Exception):
"""Raised when server authentication... |
from rasa_sdk import Action
from typing import Text
from rasa_sdk import Action
from rasa_sdk.events import SlotSet
from rasa_sdk.events import UserUtteranceReverted
from rasa_sdk.events import FollowupAction
import sqlite3
import urllib.request
from bs4 import BeautifulSoup, NavigableString, Tag
import requests
import... |
import networkx as nx
from tensorflow import keras
from tensorflow.python.keras.utils.vis_utils import model_to_dot
from nas4candle.nasapi.search.nas.model.space.cell import Cell
from nas4candle.nasapi.search.nas.model.space.block import Block
from nas4candle.nasapi.search.nas.model.space.node import Node, ConstantNod... |
import argparse
import logging
import os
import time
import numpy as np
import torch
import torch.nn as nn
from data_cleaning import ParkingDataLoader
from torch.utils.data import TensorDataset, DataLoader
parser = argparse.ArgumentParser()
parser.add_argument('--network', type=str, choices=['resnet', 'odenet'], defa... |
import json
import logging
import os
import signal
from pathlib import Path
from typing import List, Optional, Callable, NoReturn, Union
import fire
import requests
from flask import Flask, request, render_template
from flask_cors import CORS
from lexsubgen.analyzer.backend.model_server import WebRunner
from lexsubge... |
#!/usr/bin/python3.7
# Copyright 2020 Aragubas
#
# 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... |
# Altmetric json documentaion
# https://docs.google.com/spreadsheets/d/1ndVY8Q2LOaZO_P_HDmSQulagjeUrS250mAL2N5V8GvY/edit#gid=0
from Bio import Entrez
from dotenv import load_dotenv
import pandas as pd
import os
import time
import re, string
import requests
from pandas.io.json import json_normalize
from bs4 import Beau... |
from datasets.dataset import MakeTrainSet, Kodak24
from utlz import Quantization
from invertible_net import Inveritible_Decolorization
from datasets.utls import str2bool
import torch.utils.data as data
from criteria import ConsistencyLoss
from torch.optim import Adam
import os, sys, time, math
import torch, cv2
import ... |
import json
import os
from hashlib import md5
from typing import Optional
from icon_validator.rules import KomandPluginSpec
from icon_validator.rules.validator import KomandPluginValidator
from icon_validator.exceptions import ValidationException
MD5 = str
JSON = str
_CHECKSUM = ".CHECKSUM"
class SchemaHash(object)... |
"""
DEPRECATED
#;+
#; NAME:
#; io (used to be readwrite)
#; Version 1.0
#;
#; PURPOSE:
#; Module for read/write of Spectra
#; 07-Sep-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, division, unicode_l... |
import os
import logging
import time
import h5py
import gonzales.lib.brute_force as bf
import gonzales.lib.octree as oct
import gonzales.lib.physics as phy
from gonzales.simulator.utils import ProgressBar
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
# ---------------------... |
# Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
import datetime
import json
import sys
from typing import Optional, Union
from crum import get_current_request, set_current_request
from django.contrib import messages
from django.core.handlers.wsgi import WSGIRequest
from django.http import JsonResponse
from django.utils import timezone
class Wrapper:
"""this m... |
import logging
from ocs_ci.framework import config
from ocs_ci.helpers.helpers import create_resource, create_unique_resource_name
from ocs_ci.ocs import constants
from ocs_ci.ocs.exceptions import CommandFailed, TimeoutExpiredError
from ocs_ci.ocs.ocp import OCP
from ocs_ci.utility import templating
from ocs_ci.utili... |
import os
from .env import get_max_val, get_min_val
import math
import numpy as np
from matplotlib import pyplot as plt
config = {
"text_size": {"pie": 16, "title": 18, "barh": 16}
}
def pie_plot(values, labels, title, save_path, save, colors=None):
plt.clf()
if colors is None:
plt.pie(values, la... |
import tensorflow as tf
import numpy as np
import os
import json
# SAR band names to read related GeoTIFF files
band_names_s1 = ["VV", "VH"]
# Spectral band names to read related GeoTIFF files
band_names_s2 = ['B01', 'B02', 'B03', 'B04', 'B05',
'B06', 'B07', 'B08', 'B8A', 'B09', 'B11', 'B12']
def pr... |
import asyncio
import json
import os
import sys
import threading
import time
from datetime import datetime, timedelta
import discord
from discord.ext import commands, tasks
import function as f
from bot import Bot
from redditAPI import redditAPI
intents = discord.Intents.default()
intents.members = True
# List of D... |
"""
Static analysis reports endpoint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The python package structure should map to routes.
E.g. app.api.analysis.static maps to /api/1.0/analysis/static
"""
import json
from flask import request, current_app, g
from app.core import ApiResponse, ApiPagedResponse
from app.t... |
import pygame, sys, graphics, world
from pygame.locals import *
from constants import *
def leftTopCoordsOfBox (boxx, boxy):
left = boxx * BOXSIZE
top = boxy * BOXSIZE
return (left, top)
def getBoxAtPixel(mousex, mousey):
for boxx in range(BOARDWIDTH):
for boxy in range(BOARDHEIGHT):
... |
#!/usr/bin/env python
"""Miscellaneous generic support functions for fits files.
"""
import re
import os
import sys
import astropy
from astropy.io import fits
import despymisc.miscutils as miscutils
class makeMEF(object):
"""A Class to create a MEF fits files using astropy.io.fits.
We might want to migrat... |
import nengo
import numpy as np
import pytest
from nengo.exceptions import BuildError
from nengo_loihi.config import add_params
from nengo_loihi.splitter import Split
def test_place_nodes():
# all nodes go on the host
# ChipReceiveNodes and HostSendNodes are created later by the builder
with nengo.Netwo... |
import os
from collections import Counter
import numpy as np
import cv2
from scipy.interpolate import LinearNDInterpolator
def compute_errors(gt, pred):
thresh = np.maximum((gt / pred), (pred / gt))
a1 = (thresh < 1.25 ).mean()
a2 = (thresh < 1.25 ** 2).mean()
a3 = (thresh < 1.25 ** 3).mean()
... |
import json
import pytest
from flask import session
from quizzer.db import get_db
def test_index(client, auth):
response = client.get("/")
assert b'action="/auth/login"' in response.data, "'Log in' form is missing in default index without user"
assert b'action="/auth/register"' in response.data, "'Regist... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
"""
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, nenupy"
__credits__ = ["<NAME>"]
__maintainer__ = "Alan"
__email__ = "<EMAIL>"
__status__ = "Production"
__all__ = [
"Sky",
"HpxSky"
]
import numpy as np
import copy
import logging
log = logging.getL... |
import matplotlib.pyplot as plt
from statistics import mean
import csv
import numpy as np
with open('./trajectory_x.csv') as f:
reader = csv.reader(f)
centers_x = [int(row[0]) for row in reader]
with open('./trajectory_y.csv') as f:
reader = csv.reader(f)
centers_y = [int(row[0]) for row in reader]
d... |
# Copyright 2019 ducandu GmbH. 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... |
# Copyright (C) 2013-present The DataCentric 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 o... |
#!/usr/bin/env python3
#-*- coding: iso-8859-1 -*-
################################################################################
#
# This module manages all the machinery required for the interfaces to work,
# most notably it contains the main request processing thread pool.
#
# All activity on starting/stopping int... |
import re
from dataclasses import dataclass
from flask import current_app
from sqlalchemy import (
event,
orm,
and_,
or_,
)
from sqlalchemy.orm import validates
from sqlalchemy.orm.query import Query
from typing import Dict
from neo4japp.constants import LogEventType
from neo4japp.database import db
f... |
import gym
import gym_flock
import configparser
import json
from os import path
import functools
import glob
import sys
from pathlib import Path
from stable_baselines.common import BaseRLModel
from stable_baselines.common.vec_env import SubprocVecEnv, VecNormalize
from rl_comm.dataset import ExpertDataset
from rl_comm... |
"""
Tools for working out the extinction.
General-purpose:
given_EBmV_and_BpmRp_get_A_X
retrieve_stilism_reddening
append_corrected_gaia_phot_Gaia2018:
given STILISM reddening, append *_corr photometry columns.
append_corrected_gaia_phot_Gagne2020;
as above, but with the Gag... |
from os import chroot
import os
from numpy.lib.function_base import _calculate_shapes
from scipy.io import mmread
import numpy as np
from EGACD_MD.chromosome import Chromosome
from EGACD_MD.util import loadDataset, reducegraph, concateReduced, setModularity
import collections, copy
import time
import EGACD_MD.globals a... |
import sys, os
import optparse
from ..process import *
from .. import global_vars as g
from ..window import Window
from ..roi import makeROI
import numpy as np
import time
import pytest
import warnings
warnings.filterwarnings("ignore")
g.settings['multiprocessing'] = False
zproject.gui()
obj = [i for i in zproject.i... |
import argparse
import os
import sys
import time
import gym
import imageio
import pddlgym
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from datetime import datetime
from pddlgym.inference import check_goal
import mdp
import utils
matplotlib.use('TkAgg')
sys.setrecursionlimit(5000)
DEFAULT_PRO... |
import os
import sys
import conclave.lang as cc
from conclave import generate_code, dispatch_jobs
from conclave.config import CodeGenConfig, SharemindCodeGenConfig, OblivcConfig, NetworkConfig
from conclave.utils import defCol
def protocol_mpc(all_pids: list):
pid_col_meds = "0"
med_col_meds = "4"
date_c... |
import ctypes
from ctypes import *
from ctypes.wintypes import *
from win32defs import *
class SymOpts(object):
SYMOPT_EXACT_SYMBOLS = 0x00000400
SYMOPT_DEBUG = 0x80000000
SYMOPT_UNDNAME = 0x00000002
windll.kernel32.LoadLibraryA('dbghelp.dll')
dbghelp = windll.dbghelp
class Flag(int):
def __new__(cls... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
shotlast
Watches clipboard and automatically saves any new images.
"""
# pylint: disable=missing-docstring
# pylint: disable=empty-docstring
# pylint: disable=invalid-name
# pylint: disable=line-too-long
import argparse
import datetime
import os
import pathlib
impo... |
import numpy as np
import numpy.random
import matplotlib.pyplot as plt
import acivate_fun as act
from generate_data import get_normal_data, get_simple_data
from numpy import seterr
import init_utils # 第一部分,初始化
seterr(all='raise')
# 设置常量
# 激活函数的标识字符串
SIGMOID_NAME = 'sigmoid'
TANH_NAME = 'tanh'
RELU_NAME = 'ReLU'
# ... |
"""IO methods for Weather Prediction Center (WPC) bulletins."""
import re
import os.path
import warnings
import numpy
import pandas
from gewittergefahr.gg_utils import time_conversion
from gewittergefahr.gg_utils import longitude_conversion as lng_conversion
from gewittergefahr.gg_utils import error_checking
from gene... |
from typing import Iterable, Dict, List
import torch
from einops import rearrange, repeat
from torch import Tensor
from torch import nn
from torch.nn import Identity
from perceiver_pytorch.caching import cache_by_name_fn
from perceiver_pytorch.modalities import InputModality, modality_encoding
from perceiver_pytorch.... |
"""
nba_boxscore_sqlite.py
Author: <NAME>
Date Created: 1-29-2017
Description: Module that imports espn_boxscore_scraper.py and loops through
espn.com boxscore urls and stores the resulting dictionary
of key[gameID]-value[boxscore data] pairs in a sqlite
database
"""
fr... |
"""
The MIT License (MIT)
Copyright (c) 2021-Present AbstractUmbra
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, modif... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.