text stringlengths 3.07k 22.1k |
|---|
import pytest
import datetime
from pymapd._loaders import _build_input_rows
from pymapd import _pandas_loaders
from omnisci.mapd.MapD import TStringRow, TStringValue, TColumn, TColumnData
import pandas as pd
import numpy as np
from omnisci.mapd.ttypes import TColumnType
from omnisci.common.ttypes import TTypeInfo
def... |
# -*- coding: utf-8 -*-
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
from __future__ import print_function
import lldb
import logging
import debugger
import traceback
import ctypes
from ctypes import CFUNCTYPE, POINTER, pointer, sizeof, byref, memmove, c_bool, c_char, c_char_p, c_int, c_int64, c_double, c_size_t, c_void_p
from value import Value
logging.basicConfig(level=logging.DEBUG,... |
import time
import numpy as np
def force_feedback(dev_obj, env):
""" give user some degree of force feedback in control device if it is available --
currently only designed to work with Thing Ros envs and vr"""
norm = np.linalg.norm
high_force = 10
high_torque = 1
ft = env.latest_ft_raw
f_... |
from math import ceil
import numpy as np
from decibel.data_fusion import data_fusion
from decibel.music_objects.chord_alphabet import ChordAlphabet
from decibel.music_objects.chord_vocabulary import ChordVocabulary
from decibel.music_objects.song import Song
from decibel.import_export import filehandler
from decibel.e... |
import discord
from discord.ext import commands
from cogs.requestsystem import request
import checks
from Weeabot import Weeabot
def get_field(ctx, f: str):
return [
c[f] for n, c in ctx.bot.server_configs.get(ctx.message.server.id, {}).get('spoilers', {}).items()
]
def is_spoiler_channel():
re... |
import os
import sys
from sklearn.svm import LinearSVC, SVC
from sklearn.preprocessing import StandardScaler
from FeatureExtractor import FeatureExtractor
import matplotlib.image as mpimg
import numpy as np
import cv2
from sklearn.cross_validation import train_test_split
from sklearn.externals import joblib
import matp... |
############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTW... |
import os
import numpy as np
import random
import lmdb
import pickle
import platform
np.random.seed(np.random.randint(1 << 30))
num_frames = 20
seq_length = 20
image_size = 64
batch_size = 1
num_digits = 2
step_length = 0.05
digit_size = 28
frame_size = image_size ** 2
def create_reverse_dictionary(dictionary):
... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from collections import defaultdict
import logging
from go.chromium.org.luci.buildbucket.proto import common_pb2
from findit_v2.model.compile_failure impor... |
import datetime
from .base import BandoriObject
###############################################################################
# Bandori Database models
class DCard(BandoriObject):
'''
Represents a bang dream card
'''
def __init__(self, data: dict, id_name='cardId', region='en/'):
super().__... |
#!/usr/bin/env python3
import tkinter as tk
import enum
import os
import atexit
import struct
from bluepy.btle import Peripheral, DefaultDelegate
addr = "c0:98:e5:49:12:34"
DISPLAY_SERVICE_UUID = "62295813-af1c-3eb5-4a07-c92f9053c5c5"
DISPLAY_CHAR_UUID = "6229108a-af1c-3eb5-4a07-c92f9053c5c5"
class BLEAction(enu... |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import os.path
import shutil
import zipfile
import time
import subprocess
import sys
import json
import io
#------------------------------------------------------------------
# 读取配置信息
import configparser
config = configparser.ConfigParser()
config['air640w'] = {
"FTC_PAT... |
# api模块 model
from django.db import models
from django.utils import timezone
from ApiManager.managers import ProjectInfoManager, ModuleInfoManager, TestCaseInfoManager, ConfigInfoManager, \
TaskInfoManager, EnvInfoManager, DebugTalkManager
from Joy_QA_Platform.configs import AUTH_DELETE, AUTH_UPDATE, AUTH_VIEW
#... |
#!/usr/bin/env python
"""Module providing Multirate signal processing functionality.
Largely based on MATLAB's Multirate signal processing toolbox with consultation
of Octave m-file source code.
"""
import sys
import fractions
import numpy
from scipy import signal
def downsample(s, n, phase=0):
"""Decrease samp... |
import ctypes
from ctypes import wintypes
import time
user32 = ctypes.WinDLL('user32', use_last_error=True)
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENTF_UNICODE = 0x0004
KEYEVENTF_SCANCODE = 0x0008
MAPVK_VK_TO_... |
# File name: chemical.py
# Author: <NAME>
# Date created: 27-07-2018
"""Module for handling one's chemical library of chemicals and their molar masses."""
import os
import tabulate
from buf import user_input, error_messages, libraries
from typing import Sequence
instructions = """buf chemical:
This subcommand allo... |
"""Microsoft Azure virtual machine plugin to read Azure virtual machine data.
This module defines the :class:`AzVM` class that retrieves virtula machine data
from Microsoft Azure.
"""
import logging
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClie... |
#!/usr/bin/python
'''
--- Day 6: Chronal Coordinates ---
The device on your wrist beeps several times, and once again you feel like you're falling.
"Situation critical," the device announces. "Destination indeterminate. Chronal interference detected. Please specify new target coordinates."
The device then produces a... |
#!/usr/bin/env python3
#
# MIT License
#
# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
#
# 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 w... |
import json
import os
import re
import shutil
import requests
import sys
import time
from elasticsearch import Elasticsearch
from datetime import datetime, timedelta
sys.path.append(os.path.join(os.path.dirname(__file__), '..',
'..', '_beats', 'libbeat', 'tests', 'system'))
from beat.beat ... |
import tensorflow as tf
import os
import time
import datetime
from gtrain.data import Data
from gtrain.model import Model
def gtrain(
model,
data,
optimizer=tf.train.AdamOptimizer(),
max_fails=5,
num_steps=100,
evaluate_every=10,
checkpoint_every=10,
num_checkpoints=5,
out_dir=None... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import random
import torch
import matplotlib.pyplot as plt
from torch.nn.utils import clip_grad_norm_
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from transformers import BertTokenizer, BertForSequenceClassification, A... |
import argparse
import sys
import time
from multiprocessing import Pool
import numpy as np
import pandas as pd
from terminaltables import *
from dataset import VideoDataSet
from ops.utils import temporal_nms
sys.path.append('./anet_toolkit/Evaluation')
import os
import pdb
import pickle
from anet_toolkit.Evaluation... |
"""Script that calculates the parameters for a log normal distribution given the input
To use: python calculate_parameters file1.csv file2.csv ... fileN.csv [optional output_dir=output]
The details of the calculations in this script are in the appendix of the docs.
"""
import sys, csv
from scipy.optimize import minim... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import mock
import pytest
from pyramid import security
from pyramid.authorization import ACLAuthorizationPolicy
from zope.interface import implementer
from h.formatters.interfaces import IAnnotationFormatter
from h.presenters.annotatio... |
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Virtual gallery training data import.
"""
from collections import OrderedDict
import logging
import quaternion
from typing import Iterable, List
# kapture
import kapture
from kapture.algo.compare import equal_poses
# local
from .virtual_gallery_cons... |
import asyncio
import datetime
import json
import logging
import os
import queue
import re
import sys
import threading
import time
import typing
from dataclasses import dataclass
import aiofiles
import requests
logger = logging.getLogger(__name__)
VmGuid = str
@dataclass
class VMInfo:
id: VmGuid
name: str
... |
import os
import cv2
import numpy as np
import random
import torch
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import torch.tensor as Tensor
import dl_modules.transforms as trf
import dl_modules.realsr as realsr
import cm_modules.utils as utils
from torch.utils.data import Dataset as Bas... |
#!/usr/bin/env python
##############################################################################
##
# This file is part of Sardana
##
# http://www.sardana-controls.org/
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Sardana is free software: you can redistribute it and/or modify
# it under th... |
# This implementation is based on the DenseNet-BC implementation in torchvision
# Use Nvidia APEX DDP Mode and DeepSeparableConv2d to speed up train and reduce GPU memory consumption
import torch
import math
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import torch.nn as nn
from ... |
import sklearn
import scipy
import numpy as np
from sklearn.linear_model import LogisticRegression
def vectorize_docs(vector_source, docs):
"""
vector_source should be a key contained in the doc, with a Numpy ndarray value.
"""
X = np.vstack([td[vector_source] for td in docs])
return X
def downs... |
# This is a library for the viral infection modeling project using CompuCell3D
# by the Biocomplexity Institute at Indiana University
from cc3d.cpp import CompuCell
# Key to mcs value when a cell was created
new_cell_mcs_key = 'new_cell_mcs'
# Key to cell dictionary boolean for whether an instance of the viral repli... |
""" Majority of this code was copied directly from <NAME>'s gist:
https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e4ea32c5 """
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import pickle
import gym
from gym import wrappers
# hyperparameters to tune
H... |
import numpy as np
from mmcv.parallel import DataContainer as DC
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import to_tensor
@PIPELINES.register_module()
class ConcatVideoReferences(object):
"""Concat video references.
If the input list contains at least two dicts, concat the ... |
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
import argparse
import datetime
import json
import contextlib
from func_timeout import func_timeout, FunctionTimedOut
import multiprocessing
import numpy as np
import os
import sys
from job_id_pair import Job... |
import torch
from build_stuff import _C
import copy
import pdb
class BoxList:
def __init__(self, box, img_size, mode, **kwargs):
assert isinstance(box, torch.Tensor), f'box should be a tensor, got {type(box)}'
assert box.size(1) == 4, f'The last dimension of box should be 4, got {box.size(1)}'
... |
from PyQt5 import QtCore
from datetime import datetime
from nsls2ptycho.core.ptycho_param import Param
import sys, os
import pickle # dump param into disk
import subprocess # call mpirun from shell
from fcntl import fcntl, F_GETFL, F_SETFL
from os import O_NONBLOCK
import numpy as np
import traceback
from nsls2pty... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import jinja2
import boto3
import os
import sys
import yaml
from dateutil import parser
from dateutil.tz import gettz
from easyprocess import EasyProcess
from email.mime.text import MIMEText
from tidylib import tidy_document
reload(sys)
sys.setdefaultenco... |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import Parameter
# type: GN, BN, IN, LN
# Specifically, GN with GN GN_2 GN_4 ...
def getNormModuleND(dimension = 3, norm_type = 'GN'):
norm_ND = None
params = []
if '... |
import json
import os
import shutil
import tempfile
import io
from pathlib import Path
import pytest
from ansible_runner.utils import (
isplaybook,
isinventory,
dump_artifacts,
args2cmdline,
sanitize_container_name
)
from ansible_runner.utils.streaming import stream_dir, unstream_dir
def test_i... |
import numpy as np
import cv2
segmentation_colors = np.array([[0, 0, 0],
[255, 191, 0],
[192, 67, 251]], dtype=np.uint8)
detection_color = (191, 255, 0)
label = "car"
ORIGINAL_HORIZON_POINTS = np.float32([[571, 337], [652, 337]])
num_horizon_points = 0
new_horizon_points = []
def util_d... |
def main_fig3(mc_tide,mcs,mode):
import pandas as pd
import scipy.stats
from tqdm import trange
from random import random
import math
from numpy import linspace, zeros, histogram, round, shape, array
import pickle
from tools_main import read_eq_data, create_tsunami_mgsep_tide
from ... |
"""Contains the Monte Carlo simulation tests."""
import numpy as np
import copy
from trempy.estimate.estimate_auxiliary import estimate_cleanup
from trempy.shared.shared_auxiliary import print_init_dict
from trempy.config_trempy import PREFERENCE_PARAMETERS
from trempy.tests.test_auxiliary import random_dict
from tre... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from models.model import create_model, load_model
from utils.image import get_affine_transform
from utils.debugger import Deb... |
# ----------------------------------------------------------------------------
# Copyright (c) 2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------... |
# Copyright (c) 2016 Intel
# 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 app... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# PNA Aggregators ------------------------------------------------------------------------------
EPS = 1e-5
def aggregate_mean(h):
return torch.mean(h, dim=1)
def aggregate_max(h):
return torch.max(h, dim=1)[0]
def agg... |
# Copyright 2021 Paychex, Inc.
# Licensed pursuant to the terms of the Apache License, Version 2.0 (the "License");
# your use of the Work is subject to the terms and conditions of the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Disclaimer of Warranty. Un... |
import itertools
import matplotlib.pyplot as plt
import numpy as np
import scipy
import scipy.linalg
import tqdm
import warnings
from mpl_toolkits.mplot3d import Axes3D
import graph
import optimization
import trait_matrix
# Computes V * exp_wt * U.
# By construction the exponential of our matrices are always real-v... |
"""
Provide a general object detector interface for SMOT
"""
# pylint: disable=unused-wildcard-import,wildcard-import
import logging
import numpy as np
import mxnet as mx
from gluoncv.data import COCODetection
from .utils import mxnet_frame_preprocessing, timeit_context
from .utils import remap_bboxes as _remap_bboxe... |
#!/usr/bin/env python
"""Pre-schedule DDF sequences
"""
# pylint: disable=no-member
# imports
import sys
import logging
from argparse import ArgumentParser
import yaml
import numpy as np
import pandas as pd
import astropy.coordinates
import astropy.units as u
import lsst.sims.utils
# constants
# exception classes
... |
# Copyright 2014 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
try:
from rgbmatrix import graphics
except ImportError:
from RGBMatrixEmulator import graphics
from data.config.color import Color
from data.config.layout import Layout
from data.standings import Division, League
from utils import center_text_position
def render_standings(canvas, layout: Layout, c... |
'''
Crypto primitives of Cardano HD wallet and addresses.
All secret keys in memory are encrypted by passphase.
sk: secret key 32bit
pk: public key 32bit
chaincode: 32bit
xpub: pk + chaincode 64bit
xpriv: 64bit + xpub
hdpassphase: passphase derive from root xpub used to encrypt address payload
'''
import binascii
imp... |
import demistomock as demisto
from CommonServerPython import *
from IAMApiModule import *
import traceback
import jwt
import urllib3
# Disable insecure warnings
urllib3.disable_warnings()
DEFAULT_OUTGOING_MAPPER = "User Profile - SCIM (Outgoing)"
DEFAULT_INCOMING_MAPPER = "User Profile - SCIM (Incoming)"
ERROR_CODES... |
# Copyright (c) MONAI Consortium
# 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, so... |
from relogic.logickit.scorer.scorer import Scorer
from relogic.logickit.utils.utils import softmax, sigmoid
import torch.nn.functional as F
import torch
from tqdm import tqdm
import os
import subprocess
import json
class RecallScorer(Scorer):
def __init__(self, label_mapping, topk, correct_label='1', dump_to_file=No... |
#
# @file TestCompartment.py
# @brief Compartment unit tests
#
# @author <NAME> (Python conversion)
# @author <NAME>
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting the file located at
# src/sbm... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
from scipy import misc
import tensorflow as tf
import numpy as np
import sys
import os
import argparse
import align.detect_face
import glob
from pdb import set_trace as bp
from six.moves import x... |
import re
import pytest
from django.core.exceptions import ImproperlyConfigured
from precise_bbcode.bbcode import BBCodeParserLoader
from precise_bbcode.bbcode import get_parser
from precise_bbcode.bbcode.defaults.placeholder import _color_re
from precise_bbcode.bbcode.defaults.placeholder import _email_re
from preci... |
import requests
import json
import time
import os
import sys
from contextlib import contextmanager
from subprocess import Popen, check_output, CalledProcessError
import shlex
class Droplet:
def __init__(self, session, id, i_know_what_im_doing=False):
if not i_know_what_im_doing:
raise Except... |
#!usr/bin/env python
# _*_ coding:UTF-8 _*_
# 信息:
# 开发团队 : C.zf
# 开发人员 : C.Z.F
# 开发时间 : 2020/7/10 19:59
# 文件名称 : Office.py
# 开发工具 : PyCharm
import os
import re
import codecs
import types
from PyPDF2 import PdfFileReader
from PyPDF2 import PdfFileMerger
# For special variables of read/write (DOC_DEFAULT), the method:
#... |
from functools import lru_cache
from typing import List
from django.db.models import Q
from django.http import HttpRequest
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.translation import override
from django.urls import reverse
from django.conf import settings
from crossdomainm... |
"""
This file
1. Reads in raw wikipedia sentences from /lfs/raiders7/0/lorr1/sentences
2. Reads in map of WPID-Title-QID from /lfs/raiders7/0/lorr1/title_to_all_ids.jsonl
3. Computes frequencies for alias-QID over Wikipedia. Keeps only alias-QID mentions which occur > args.min_frequency
4. Merges alias-QID map with ali... |
import json
from collections import OrderedDict
from decimal import Decimal
import dateutil
from django import forms
from django.core.serializers.json import DjangoJSONEncoder
from django.dispatch import receiver
from django.utils.translation import ugettext, ugettext_lazy
from pretix.base.i18n import language
from p... |
import cv2
import numpy
import collections
from FacialLandmarkDetection import *
from Database_loader import *
EYES_EDGES = [[36, 39], [42, 45], [36, 42], [36, 45], [39, 42], [39, 45]]
EYES_IRIS = [[37, 41], [37, 40], [38, 40], [38, 41], [43, 47], [43, 46], [44, 46], [44, 47]]
EYEBROWS = [[17, 18], [18, 19], [19, 20]... |
import functools
import logging
import random
import unittest
from datetime import datetime
from unittest import TestCase, suite
from unittest.mock import patch, MagicMock
from coverage.files import os
from freezegun import freeze_time
from sqlalchemy import create_engine
from telegram import Chat, CallbackQuery
from ... |
"""Tests for LED classes."""
# pylint: disable=protected-access,no-self-use
# standard library imports
import errno
import os
from unittest import TestCase
# third-party imports
import inputs
from tests.constants import PYTHON, PurePath, mock
if PYTHON == 2:
# third-party imports
from inputs import Permission... |
from numba import njit, jit, prange
from numba.typed import Dict
from numpy import argwhere, arange, square, sum, array, concatenate, \
append, ones, int64, int32, intp, subtract, fill_diagonal, zeros, sqrt, copy, argsort, empty
import numpy as np
from scipy.spatial import cKDTree
def confine_partic... |
"""
Shader005:
Shader example using bk7084 framework, shadow mapping.
OpenGL allows us to disable writing to the depth buffer by setting its depth mask to GL_FALSE.
"""
import imgui
import numpy as np
from bk7084 import Window, app, Camera, gl, ShaderProgram, VertexShader, PixelShader
from bk7084.app import ui
from... |
#!/usr/bin/env python3
# Purpose: Sync few mailing list profiles to SQL/LDAP db, including:
#
# - moderators (SQL table: vmail.moderators)
# - owners (SQL table: vmail.maillist_owners)
import sys
import os
import requests
import web
web.config.debug = False
sys.path.insert(0, os.path.dirname(os.path.abspath(__fil... |
import time
import os
import random
import pygame
from pygame.locals import *
import util, rules
def sort_actors(x, y):
if x.pos[1] < y.pos[1]:
return -1
if x.pos[1] > y.pos[1]:
return 1
if x.pos[0] < y.pos[0]:
return -1
if x.pos[0] > y.pos[0]:
return ... |
#!/usr/bin/env python
"""
Creates waterfall plots for visibility datasets.
"""
from __future__ import print_function, division, absolute_import
import numpy as np, sys, optparse
import uvtools
import pyuvdata
import hera_cal
from matplotlib import pylab as plt
o = optparse.OptionParser()
o.set_usage('plot_uv.py [op... |
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
from lib.normalize import Normalize
import torch
from models.cbam import CBAM
import torch.nn.functional as F
from lib.utils import showfeature, showimage
import numpy as np
import random
import torch.backends.cudnn as cudnn
import os
my_whole_... |
from math import sin,cos,pi
import Angpow
class FuncType0(Angpow.ClassFunc1D_get_value):
def get_value(self,a_x):
return a_x * (a_x-1.)*(a_x-1.)
import math
class FuncType1(Angpow.ClassFunc1D_get_value):
m_ell = 0
m_R = 0
def __init__(self,a_ell,a_R):
Angpow.ClassFunc1D_get_value.__init__(self... |
"""
Skew the dataset so that it turns into generating a uniform distribution.
"""
import json
import time
import numpy as np
from PIL import Image
from skvideo.io import vwrite
from torch import nn as nn
from torch.optim import Adam
import railrl.pythonplusplus as ppp
import railrl.torch.vae.skew.skewed_vae as sv
fro... |
# Copyright (c) 2013, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import get_url_to_form,cstr
from frappe.utils import date_diff, add_months, today, getdate, add_days, flt, get_last_day
from frappe.cor... |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
import time
class IndexJsonKeyConfig(object) :
""" The index config of a special json type key
:type index_all: bool
:param index_all: True if all string value in the json key should be indexed
:... |
import hashlib
from functools import singledispatch
import logging
from parsl.serialize import serialize
import types
logger = logging.getLogger(__name__)
@singledispatch
def id_for_memo(obj, output_ref=False):
"""This should return a byte sequence which identifies the supplied
value for memoization purposes... |
#!/usr/bin/env python3
# coding: utf-8
# Copyright (c) 2019-2020 Latona. All rights reserved.
import asyncio
import json
import os
import traceback
from datetime import datetime
from importlib import import_module
from aion.kanban import kanban
from aion.logger import lprint
from .tcp_packet import SendPacket, RcvPac... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.linalg import solve
import matplotlib.pyplot as plt
def plot_box_graph(distances, labels=None):
box = Box4(distances, labels=labels)
box.plot()
return box
def distance_vector_from_matrix(matrix):
dim = matrix.shape[0]
length =... |
import importlib
import logging
import numpy as np
import os
import os.path as osp
import time
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import _LRScheduler
from torch.utils.data import ConcatDataset
from bisect import bisect_right
from functools import partial
from six.moves import map, ... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
import hydra
import numpy as np
import submitit
import torch
from hydra.core.config_store import ConfigStore
from omegaconf import MISSING, Ome... |
import torch
from kymatio.scattering1d.backend import pad_1d, modulus_complex, subsample_fourier
from kymatio.scattering1d.utils import compute_border_indices, compute_padding
import numpy as np
import pytest
import kymatio.scattering1d.backend as backend
import warnings
if backend.NAME == 'skcuda':
force_gpu = Tr... |
import os
import sys
import ast
import argparse
import nas_utils
from tqdm import tqdm
import torch.nn as nn
from .nas_utils import *
from scipy.stats import kendalltau
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn
from .nas_model_search import SuperNetwork
def get_args():
parser = argp... |
from __future__ import division
import sys
import os
import argparse
import numpy as np
import cv2
import torch
from torch.utils import data
sys.path.insert(0, './pnpransac')
from pnpransac import pnpransac
from models import get_model
from datasets import get_dataset
def get_pose_err(pose_gt, pose_est):
transl_... |
#
# 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
# "License"); you may not... |
from waflib import Utils, Task, Options, Logs, Errors
from waflib.TaskGen import before_method, after_method, feature
from waflib.Tools import ccroot
import os.path
ccroot.USELIB_VARS['msbuild'] = set(['CSFLAGS'])
def configure(conf):
conf.find_program('msbuild')
msbuild_fmt = '''<?xml version="1.0" encod... |
# pylint: disable=no-member
from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf # pylint: disable=import-error
import pandas as pd # pylint: disable=import-error
from sklearn.model_selection import StratifiedKFold # pylint: disable=import-error
import numpy as ... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 21 13:36:53 2018
@author: aditya
"""
import nltk
from nltk.corpus import stopwords
import numpy as np
import datetime
import re
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
i... |
""" This program converts ./gazou1.bmp to ./gazou2.bmp """
# -*- coding: UTF-8 -*-
# Tested on Python 3.6.3 (32bit)
import sys
class BmpFile:
"""
BMP file Header
2byte bm 識別文字(BM)
4byte filesize ファイルサイズ
2byte res_a 予約領域(0)
2byte res_b 予約領域(0)
4byte headersize ヘッダサイズ
4byte infosize 情報サイ... |
import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Implementation of Twin Delayed Deep Deterministic Policy Gradients (TD3)
# Paper: https://arxiv.org/abs/1802.09477
class D2RLActor(nn.Module):
... |
import os
import re
import glob
import logging
import argparse
import semigration as smg
class MultiBreak(Exception): pass
# You'll want to normalize common things that may have varying spellings etc.
EFFECT_MAP = {
"hp": "Max HP",
"maxhp": "Max HP",
"max life": "Max HP",
"mp": "Max MP",
"maxmp": "Max MP",
"m... |
from q_table_agent import greedy_policy, discretize
from reinforce_agent import logistic_regression
from saes_agent import NeuralNetworkPolicy
from envs.deep_cure_env import DeepCure, ForeignCountry, random_base_infect_rate, random_lifetime, random_delay
from plotting import plot
from stable_baselines3 import DQN
from ... |
"""
filelock.py: Provides NFS-safe locking around a DB File.
"""
from __future__ import print_function
##
# Copyright 2007-2010 University Of Southern California
#
# 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... |
import os
import argparse
import warnings
import datasets
import torch
import flwr as fl
import pandas as pd
import numpy as np
from datasets import load_dataset, load_metric
from transformers import AutoTokenizer, DataCollatorWithPadding
from transformers import AutoModelForSequenceClassification
from transformers ... |
import os
from typing import List
import botocore
import pymongo
from fastapi import APIRouter, status, Depends, HTTPException
from gridfs import GridFS
from pymongo import ReturnDocument
from pymongo.errors import DuplicateKeyError
from starlette.responses import RedirectResponse
from toolz import merge
from nmdc_ru... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
import logging
import os
from enum import Enum
from itertools import takewhile
from rspub.util.observe import Observable, ObserverInterruptException
LOG = logging.getLogger(__name__)
class SelectorEvent(Enum):
file_does_not_exist = 0
not_a_regular_... |
import math
import numpy
from fudge.core.math.pdf import UnivariatePDF, WignerDistribution, PoissonDistribution, \
BrodyDistribution, GOEDistribution
from xData import XYs
"""
Collection of fake level sequence generators, including the One True Generator: getGOEFakeLevelSequence
"""
fakeLevelStyles = ['wigner', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.