text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
"""
回测
"""
from futu import *
from talib.abstract import *
import numpy as np
import pandas as pd
import datetime
import time
import os
import json
import copy
import math
import sqlite3
from re import sub
import itertools
class Tools(object):
def cuo_die_0(self, inputs, item, hands):
... |
import logging
from decimal import Decimal as D
import binascii
from math import ceil
import time
import calendar
import dateutil.parser
from counterpartylib.lib import script, config, blocks, exceptions, api, transaction
from counterpartylib.lib.util import make_id, BET_TYPE_NAME, BET_TYPE_ID, dhash, generate_asset_n... |
# -*- coding: utf-8 -*-
import re
import sys
import inspect
import piston3.handler as handler
from types import ModuleType
from resource import CsrfExemptResource
from handlers import ObjectHandlerMetaClass
from django.core.urlresolvers import get_resolver, get_callable, get_script_prefix
from django.utils.translati... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import itertools
import re
from collections import Counter
from typing import Dict, List, NamedTuple
from pytext.common.constants import DatasetFieldName, SpecialTokens, Stage
from pytext.data import CommonMetadata
from pytex... |
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someon... |
import datetime
import logging
from typing import Any, Dict, Optional
from django.conf import settings
from django.db import transaction
from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from zerver.actions.message_send import internal_send_stream_message
from zer... |
"""An attempt to implement a fishers exact test in numba.
Gave up after a day because some ofthe distributions required
are written in fortran in scipy.special.
Seems like soon numba-scipy may make this effort much easier.
For now will require use of cython"""
from numba import njit
import numpy as np
from scipy.speci... |
from io import FileIO
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Union, List, Iterable
from .common import open_file, coerce_matrix
def read_mdf(file: Union[str, FileIO, Path], raw: bool = False, tall: bool = False
) -> Union[np.ndarray, pd.DataFrame, pd.Series]:
... |
#!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2015,2017
# [+] International Business Machines Corp.
#
#
# 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 th... |
# This file contains code to clean Wiktionary annotations from a string and to
# produce plain text from it, typically for glossary entries but this is also
# called for various other data to produce clean strings.
#
# This file also contains code for cleaning qualifiers for the "tags" field.
#
# Copyright (c) 2018-202... |
# Copyright 2020 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
from ovos_utils.enclosure.mark1 import Mark1EnclosureAPI
from ovos_utils import create_loop
from ovos_utils.log import LOG
from ovos_utils.messagebus import get_mycroft_bus
import random
from time import sleep
import collections
import copy
class FaceplateGrid(collections.MutableSequence):
encoded = None
str_... |
from __future__ import absolute_import
# Visualization of particles with gravity
# Source: http://enja.org/2010/08/27/adventures-in-opencl-part-2-particles-with-opengl/
import pyopencl as cl # OpenCL - GPU computing interface
mf = cl.mem_flags
from pyopencl.tools import get_gl_sharing_context_properties
from OpenGL.GL... |
#! /bin/python
import resource
import signal
import multiprocessing
import os
import sys
import time
import tempfile
import psutil
class CpuTimeoutException(Exception):
"""Pynisher exception object returned on a CPU time limit."""
pass
class TimeoutException(Exception):
"""Pynisher exception object ret... |
# Copyright 2019 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# Modified by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolu... |
import json
import traceback
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Union
from urllib import request as urlreq, parse as urlparse
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import iterm2
class... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,time,datetime,sys
import numpy as np
import dgcnn
import tensorflow as tf
def round_decimals(val,digits):
factor = float(np.power(10,digits))
return int(val * factor+0.5) / factor
def iteration_f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import math
import itertools
from scipy.linalg import svd, norm
# general messages for LM/etc optimization
TERMINATION_MESSAGES = {
None: "Status returned `None`. Error.",
-1: "Improper input parameters status returned from `leastsq`",
0: ... |
# Copyright (c) 2022 PaddlePaddle Authors. 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 ap... |
"""
Copyright (c) 2021, CRAI
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import List, Union, Tuple
import torch
import torch.nn as nn
from ..swish import MemoryEfficientSwish, Swish
from ..utils im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python version: 3.6
import models.func as fc
# from models.func import node_deleting
import models.test as ts
# from models.test import test_part
import copy
import torch
import operator
import test
from torch import nn
from numpy import linalg as LA
import logging
import... |
import collections
import itertools
import logging
import operator
from typing import Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, Union
import networkx as nx
import numpy as np
from cytoolz import itertoolz
from spacy.tokens import Span, Token
from . import utils as ke_utils
LOGGER = logging.g... |
import os
import time
import IPython
import numpy as np
import scipy.stats as st
from sklearn.metrics import confusion_matrix
import gym
import torch
import torch.nn.functional as F
from torch.autograd import Variable
def get_action(actions, env):
if type(env.action_space) is gym.spaces.Discrete:
# Get ... |
# Copyright 2016 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 agreed to in writing, ... |
from unittest.mock import Mock, call
from pytest import fixture, raises, mark
from pyviews.core.observable import ObservableEntity, InheritedDict
class TestObservable(ObservableEntity):
def __init__(self, private, name, value):
super().__init__()
self._private = private
self.name = name
... |
import torch
from torch import optim
from torchvision import datasets, transforms
from vision import LeNet, CNN, weights_init
from PIL import Image
from utils import label_to_onehot, cross_entropy_for_onehot
import torch.nn.functional as F
import numpy as np
from skimage.metrics import structural_similarity as ssim
imp... |
import tensorflow as tf
import numpy as np
from model_fn.model_fn_nlp.util_nlp.attention import MultiHeadAttention
def get_angles(pos, i, d_model):
angle_rates = 1 / np.power(10000, (2 * (i // 2)) / np.float32(d_model))
return pos * angle_rates
def positional_encoding(position, d_model):
angle_rads = ge... |
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownBattleGlobals
from toontown.suit import SuitDNA
BattleExperienceAINotify = DirectNotifyGlobal.directNotify.newCategory('BattleExprienceAI')
def getSkillGained(toonSkillPtsGained, toonId, track):
exp = 0
expList = toonSkill... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions ... |
def _build(**kwargs):
kwargs.setdefault("mac_src", '00.00.00.00.00.01')
kwargs.setdefault("mac_dst", '00.00.00.00.00.02')
kwargs.setdefault("mac_src_step", '00.00.00.00.00.01')
kwargs.setdefault("mac_dst_step", '00.00.00.00.00.01')
kwargs.setdefault("arp_src_hw_addr", '01.00.00.00.00.01')
kwarg... |
import json
import os
import fasteners
from collections import OrderedDict, namedtuple
from conans.errors import ConanException, NoRemoteAvailable
from conans.model.ref import ConanFileReference, PackageReference
from conans.util.files import load, save
from conans.util.config_parser import get_bool_from_text_value
f... |
import sys
import os
import importlib
import logging
from neovim.api import Nvim
from neovim import attach, setup_logging
def getLogger(name):
def get_loglevel():
# logging setup
level = logging.INFO
if 'NVIM_PYTHON_LOG_LEVEL' in os.environ:
ll = getattr(logging,
... |
# Copyright: Copyright (c) 2020., <NAME>
# Author: <NAME> <adam at jakab dot pro>
# License: See LICENSE.txt
import math
from abc import ABC
from abc import abstractmethod
from random import randint
from beets.library import Item
from confuse import Subview
from beetsplug.goingrunning import common
pickers = {
... |
from hamcrest import *
from utils import *
@pytest.mark.serial
@pytest.mark.manual_batch_review
def test_approve_pending_batch_change_success(shared_zone_test_context):
"""
Test approving a batch change succeeds for a support user
"""
client = shared_zone_test_context.ok_vinyldns_client
approver =... |
#!/usr/bin/env python
# projectS and projectC were written by <NAME>.
import time
start = time.time()
import argparse
import cv2
import os
import dlib
import numpy as np
np.set_printoptions(precision=2)
import openface
from matplotlib import cm
fileDir = os.path.dirname(os.path.realpath(__file__))
modelDir = os.p... |
import functools
import glob
import gzip
import os
import sys
import warnings
import zipfile
from itertools import product
from django.apps import apps
from django.conf import settings
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.core.management.b... |
# This module contains the code to create maps
import numpy as np
from itertools import combinations
import matplotlib.pyplot as plt
import itertools
# For plotting
import seaborn as sns
import logging
import statistics
import time
def manhattan(coords_ind1, coords_ind2):
return abs(coords_ind1[0] - coords_ind... |
# -*- coding: utf-8 -*-
#
# This file is part of urlwatch (https://thp.io/2008/urlwatch/).
# Copyright (c) 2008-2018 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redis... |
"""
Module realize VLImage - structure for storing image in special format.
"""
from enum import Enum
from pathlib import Path
from typing import Optional, Union
import requests
from FaceEngine import FormatType, Image as CoreImage # pylint: disable=E0611,E0401
import numpy as np
from PIL.Image import Image as PilImag... |
from bisect import bisect_right
from utils.misc import source_import
import torch
class WarmupMultiStepLR(torch.optim.lr_scheduler._LRScheduler):
def __init__(
self,
optimizer,
milestones,
gamma=0.1,
warmup_factor=1.0 / 3,
warmup_epochs=5,
warmup_method="line... |
# -*- coding: utf-8 -*-
# Copyright 2016-2021 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#!/usr/bin/env python3
"""
RRT Algo
Reference: rrt.py written by <NAME> in May 2011
Authors:
<NAME> (<EMAIL>)
Graduate Student pursuing Masters in Robotics,
University of Maryland, College Park
"""
import random, math
import utils
import numpy as np
XDIM = 10
YDIM = 10
EPSILON = 0.2
NUMNODES = 5000
RADIUS = 0.5
plu... |
#! /usr/bin/env python3
"""
ONTAP REST API Python Sample Scripts
This script was developed by NetApp to help demonstrate NetApp technologies. This
script is not officially supported as a standard NetApp product.
Purpose: THE FOLLOWING SCRIPT SHOWS WORKFLOW OF QTREE, QUOTA CREATION, Show METRICS of QTREE
u... |
import sys
import numpy as np
from cv2 import BRISK_create
from cv2.xfeatures2d import FREAK_create
from numpy import histogramdd
from skimage.color import rgb2lab, rgb2hsv
from skimage.feature import local_binary_pattern, greycoprops, greycomatrix
from sklearn.base import TransformerMixin
from sklearn.cluster import ... |
"""Build novel module."""
# Official Libraries
from enum import auto, Enum
from dataclasses import dataclass, field
from typing import Any
import re
# My Modules
from sms.commons.format import get_br, get_indent
from sms.commons.format import join_descs
from sms.commons.format import markdown_comment_style_of
from sm... |
# -*- coding: utf-8 -*-
#from __future__ import print_function
#import pixy
#from ctypes import *
#from pixy import *
import math as ma
import numpy as np
test_data = 120,100 #test input
#hight = 495-114 #mm
#ball parameter
r_ball = 114.8 #mm
'PIXY Parameter'
#pixy-cam image size in pixy-coordination
delta_X_pixy =... |
import typing
import cv2
import numpy as np
from numpy.lib.polynomial import poly
import streamlit as st
import plotly.express as px
import plotly.graph_objects as go
from utils.configs import IMAGES, DetectionConfig, RunningModes
from utils.configs import default_config
from utils.configs import birds_config
from ut... |
import os
import cv2
import copy
import numpy as np
import torch
import matplotlib.pyplot as plt
from tqdm import tqdm
from config import system_configs
import math
import external.nms as nms
def _rescale_points(dets, ratios, borders, sizes):
xs, ys = dets[:, :, 0], dets[:, :, 1]
xs += borders[0, 2]
ys ... |
import numpy as np
from scipy.signal import iirnotch, firwin, filtfilt, lfilter, freqz
from matplotlib import pyplot as plt
import nibabel as nb
import subprocess
import math
def add_afni_prefix(tpattern):
if tpattern:
if ".txt" in tpattern:
tpattern = "@{0}".format(tpattern)
return tpatte... |
import os
import copy
import json
import logging
import torch
from torch.utils.data import TensorDataset
logger = logging.getLogger(__name__)
class InputExample(object):
"""
A single training/test example for simple sequence classification.
Args:
guid: Unique id for the example.
text_a... |
from tensorflow.python.ops import init_ops
from tensorflow.python.util import nest
import tensorflow as tf
def stack_bidirectional_dynamic_rnn(cells_fw, cells_bw, inputs, initial_states_fw=None, initial_states_bw=None,
dtype=None, sequence_length=None, parallel_iterations=None, sco... |
import json
import metrics
class Example(object):
def __init__(self, file_idx, gcs, pcs, top_m_units=None, top_antecedents_index=None, top_antecedents_score=None):
self.file_idx = file_idx
self.gcs = [tuple(tuple([m[0], m[1]]) for m in gc) for gc in gcs]
self.pcs = [tuple(tuple([m[0], m[1... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 26 18:17:56 2021
@author: rringuet
Convert data in CTIPe output files to wrapped versions
"""
#import numpy as np
from numpy import transpose, zeros, array, append
from time import perf_counter
from netCDF4 import Dataset
from astropy.constants import R_earth
... |
"""
The following is adapted from Dask release 2021.03.1:
https://github.com/dask/dask/blob/2021.03.1/dask/local.py
"""
import os
from queue import Queue, Empty
from dask import config
from dask.callbacks import local_callbacks, unpack_callbacks
from dask.core import (_execute_task, flatten, get_dependencies, has... |
from random import randint, random, choice
from algorithm.parameters import params
from algorithm.mapper import map_tree_from_genome
from representation import individual
from representation.derivation import generate_tree
from representation.latent_tree import latent_tree_mutate, latent_tree_repair
from utilit... |
import fnmatch
import os
import datetime
import sys
from subprocess import Popen, PIPE
import zipfile
import skimage.io
import scipy.io.wavfile
import jsonlines
import torch
from setka.pipes.Pipe import Pipe
def get_process_output(command):
if not isinstance(command, (list, tuple)):
command = command.sp... |
# Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
#!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Configure and inspect an instance of CARLA Simulator.
For further detail... |
from big_ol_pile_of_manim_imports import *
from random import *
def text_range(start,stop,step): # a range as a list of strings
numbers = np.arange(start,stop,step)
labels = []
for x in numbers:
labels.append(str(x))
return labels
class Histogram(VMobject):
CONFIG = {
"start_colo... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import logging
import numpy as np
from matrixprofile impo... |
import re
from .marshal import default_marshal, Marshallers, ParseError, represented_scalar, unicode_escaped
RE_COMMENT = re.compile(r"\s+#.*$")
def yaml_lines(lines, text=None, indent=None, folded=None, keep=False, continuations=False):
"""
Args:
lines (list): Lines to concatenate together
... |
import logging
import os
import re
import sys
from enum import Enum
import click
from Bio import SeqIO
from Bio.Seq import Seq
from tqdm import tqdm
tqdm.pandas()
import pandas as pd
import numpy as np
logger = logging.getLogger(__name__)
sys.path.append("..")
from utils.clustering_utils import ClusteringUtils
cl... |
"""Platform for retrieving meteorological data from Environment Canada."""
import datetime
import re
from env_canada import ECData
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATT... |
# -*- coding: utf-8 -*-
"""
Semantic models for interpreting graphs.
"""
from typing import (
cast, Optional, Tuple, List, Dict, Set, Iterable, Mapping, Any)
import re
from collections import defaultdict
import random
from penman.exceptions import ModelError
from penman.types import (
Variable,
Role,
... |
import datetime
from django.shortcuts import render
from django.shortcuts import redirect
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.utils import timezone
from django.conf import settings
from rest_framework import generics
from . import forms
from . import models
f... |
"""
Dynamically generate the NRT module
"""
from __future__ import print_function, absolute_import, division
from numba.config import MACHINE_BITS
from numba import cgutils, types
from llvmlite import ir
# Flag to enable debug print in NRT_incref and NRT_decref
_debug_print = False
_word_type = ir.IntType(MACHINE_B... |
import numpy as np
import pandas as pd
from autots.tools.impute import FillNA
from autots.tools.shaping import infer_frequency
from autots.tools.seasonal import date_part
from autots.tools.holiday import holiday_flag
def create_regressor(
df,
forecast_length,
frequency: str = "infer",
holiday_countrie... |
# -*- coding: utf-8 -*-
import os
import logging
from boto.exception import EC2ResponseError
def security_group_exists(self, sg_id=None, name=None):
"""
Checks if a security group already exists on this connection, by name or by ID.
:param boto.ec2.EC2Connection self: Current connection.
:param str... |
import os
import typing
from datetime import datetime
from importlib import import_module
from typing import Dict, Callable, Optional, List, Tuple
from twitchbot.database import CustomCommand
from twitchbot.message import Message
from .config import cfg
from .enums import CommandContext
from .util import get_py_files,... |
# Copyright 2016 The TensorFlow Authors. 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 applica... |
import datetime
import itertools
import logging
import uuid
from math import log10
from typing import Any, Dict, Iterable, List, Optional
import click
from pydantic import root_validator, validator
from datahub.configuration import config_loader
from datahub.configuration.common import (
ConfigModel,
DynamicT... |
#Module Import
from config import *
try:
conn = psycopg2.connect(
host="postgres",
database="production",
user="postgres1",
password="<PASSWORD>")
cur = conn.cursor()
except Exception as e:
print('Not Connected... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler, PolynomialF... |
# vim: ts=4 et filetype=python
# This file is part of MiniREST
#
#Copyright (c) 2012 Wireless Generation, Inc.
#
#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... |
# Copyright 2019 The KRules Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing,... |
from requests import get as rget
from time import sleep
from threading import Thread
from html import escape
from urllib.parse import quote
from telegram import InlineKeyboardMarkup
from telegram.ext import CommandHandler, CallbackQueryHandler
from bot import dispatcher, LOGGER, SEARCH_API_LINK, SEARCH_PLUGINS, get_cl... |
import datetime
import lxml.html
import re
import requests
from sqlalchemy import or_
import time
from .db import db, Book, User, UserBook, UserKeyword, Setting
def bookInfoFromHtml(tree):
title, titleUrl = titleFromHtml(tree)
image = imageFromHtml(tree)
asin = asinFromUrl(titleUrl)
date ... |
# coding=utf-8
from __future__ import absolute_import, print_function
import os
import json
import torch
from time import time
import numpy as np
import pandas as pd
from sklearn import metrics
from glob import glob
from DataSet.dataset import get_iwildcam_loader, data_prefetcher
from Utils.train_utils import cross_en... |
"""Support for media metadata handling."""
from __future__ import annotations
import datetime
import logging
from typing import Any
from soco.core import (
MUSIC_SRC_AIRPLAY,
MUSIC_SRC_LINE_IN,
MUSIC_SRC_RADIO,
MUSIC_SRC_SPOTIFY_CONNECT,
MUSIC_SRC_TV,
SoCo,
)
from soco.data_structures import D... |
#!/usr/bin/env python3
import numpy as np
import cv2
# import tensorflow as tf
import sys
sys.path.append("/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/")
# from infer_detector_nano import Infer
# from bag_detection.msg import FlipPos, PathPos
def get_rectangles(mask, threshold_area):
"""
... |
import os
from collections import Counter, OrderedDict
import torch
class RenormalizeVocab(object):
def __init__(self, vocab_map_fn=None, vocab_fn=None, add_eos=True,
add_double_eos=False, delimiter=None, lower_case=True, special=[]):
self.lock = False
self.delimiter = delimiter
... |
from __future__ import unicode_literals
import json
import datetime
import django
from django.db import models
from django.db.models.fields.related import ForeignObjectRel
from django.db.models.fields import FieldDoesNotExist
from django.utils.encoding import is_protected_type
from django.core.serializers.json import... |
#!/usr/bin/env python2.6
#nknguyen at soe ucsc edu
#May 30 2012
#Draw scatter plot of each clones and their size for each pair of samples
#xaxis: Sample 1, yaxis: sample 2
#each dot represents a clonotype with same amino acid, and V and J genes
#
import os, re, sys, copy
from optparse import OptionParser
from immuno... |
import torch
from torch import nn, Tensor
from torch.nn import functional as F
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, c1, c2, s=1, downsample= None, no_relu=False) -> None:
super().__init__()
self.conv1 = nn.Conv2d(c1, c2, 3, s, 1, bias=False)
self.bn1 = nn.Batch... |
""" Parses the `models.dat` input file for MechDriver that specifies all
of the parameters used to construct the partition functions and
master equations for the calculation of rate constants and thermochemistry.
"""
import automol
import ioformat
from mechanalyzer.inf import thy as tinfo
from mechlib.amech_i... |
"""
.. module: lemur.plugins.lemur_acme.plugin
:platform: Unix
:synopsis: This module is responsible for communicating with an ACME CA.
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
Snippets from https://raw.githubusercontent.com/alex/let... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This combines configurable build-time constants (documented on REPO_CFG
# below), and non-configurable constants that are currently not name... |
import pygame
import random
import button
from pygame import mixer
pygame.init()
clock = pygame.time.Clock()
fps = 60
#game window
screen_width = 800
screen_height = 400
#game variables
current_fighter = 1
total_fighter = 2
action_cooldown = 0
action_wait_time = 90
attack = False
potion = False
potion_effect = 30
c... |
import argparse
import json
import os
import time
from pathlib import Path
import torch
import torch.optim as optim
from data.data import all_loaders_in_one
# import network
from nnet.conv_tasnet_student import model_info
from nnet.conv_tasnet_student import TasNet as nnet
from nnet.original_conv_tasnet import model_i... |
"""
@Time : 2021/12/17 1:40 PM
@Auth : <NAME>
@File :log_template_mappping.py
@Desc :mapping template id to block id
"""
import pickle
import re
import pandas as pd
import numpy as np
from sklearn.utils import shuffle
import os
import random
block_groups_indir = '../data_preprocessing/'
normal_logs_file = 'hdfs_normal... |
#System Dependencies
import base64
#Dash dependencies
import dash
import dash_table
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go
import pandas as pd
import numpy as np
im... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import o... |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 <NAME> (<EMAIL>), University of Szeged
#
# 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 th... |
from scipy.sparse import *
import numpy as np
import pickle
import random
from sklearn.decomposition import PCA
from matplotlib import pyplot as plt
from tqdm import tqdm
from sklearn import svm
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_curve, auc
from operator import itemgette... |
"""
Copyright (c) 2019 Intel 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 wri... |
#!/usr/bin/env python3
# SonicScrewdriver.py
# Version January 1, 2015
def addtodict(word, count, lexicon):
'''Adds an integer (count) to dictionary (lexicon) under
the key (word), or increments lexicon[word] if key present. '''
if word in lexicon:
lexicon[word] += count
else:
lexicon[word] = count
def appe... |
from typing import Sequence, Dict
from anoncreds.protocol.globals import LARGE_VPRIME, LARGE_MVECT, LARGE_E_START, \
LARGE_ETILDE, \
LARGE_VTILDE, LARGE_UTILDE, LARGE_RTILDE, LARGE_ALPHATILDE, ITERATIONS, \
DELTA
from anoncreds.protocol.primary.primary_proof_common import calcTge, calcTeq
from anoncreds.pr... |
""" +=========================================================================================+
|| Line Detector ||
|| Name: <NAME> Date: 3/19/15 ||
+==================================... |
from esper.prelude import par_for, unzip, pcache, flatten, collect
from query.models import Video, Face, Frame, HairColor, HairColorName, Labeler
from esper.scannerutil import ScannerWrapper, ScannerSQLTable
from scannertools import clothing_detection , hairstyle_detection
from django.db.models import Count, OuterRef, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.