text stringlengths 3.07k 12.6k |
|---|
# Copyright 2019 Zuru Tech HK Limited. 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 la... |
"""Generates a LoL summoner rating
Ratings are based on recent solo queue performance
"""
import math
import sys
from riotwatcher import LolWatcher, ApiError
config = {
"riot_api_key": "",
"summoner_region": "",
"summoner_name": "",
"queue_id": 420,
"fast_game_minutes": 25,
"match_history_limi... |
import argparse
import os
import os.path
from shutil import rmtree, move, copy
import random
import shutil
import math
from random import choice
import cv2
random.seed(0)
# For parsing commandline arguments
parser = argparse.ArgumentParser()
parser.add_argument("--ffmpeg_dir", type=str, required=True, help='path to ff... |
# -*- coding: utf-8 -*-
# (C) 2015 <NAME>
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
from __future__ import print_function
from opentamiltests import *
class WordsSimilarityLevenshtein(unittest.TestCase):
def test_Levenshtein_distance(self):
values = [
[u"setting"... |
# Copyright (c) 2015. Mount Sinai School of Medicine
#
# 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
import numpy as np
import time
import glob, os
from scripts.laserscan import SemLaserScan, LaserScan
import argparse
from depth_cluster.build import Depth_Cluster
import cv2
import open3d as o3d
parser = argparse.ArgumentParser()
parser.add_argument('--sequence',dest= "sequence_in", default='00... |
import numpy as np
from typeguard import typechecked
from baconian.common.sampler.sample_data import TransitionData, TrajectoryData, SampleData
from baconian.common.error import *
class RingBuffer(object):
@typechecked
def __init__(self, maxlen: int, shape: (list, tuple), dtype='float32'):
self.maxlen... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: test_transforms.py
Author: naughton101
Email: <EMAIL>
Github: https://github.com/naught101/empirical_lsm
Description: Tests for empirical_lsm
"""
import unittest
import numpy.testing as npt
import pandas as pd
import numpy as np
import numpy.testing as nt
from s... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 26 14:10:46 2020
@author: jisuk
"""
# %% import modules
import tensorflow as tf
import numpy as np
from tensorflow.keras import optimizers
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, MaxPooling2D, Flatten, Conv2D, B... |
import json
import logging
import numpy as np
import os
import pandas as pd
import tqdm
from typing import List
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", level=logging.INFO
)
logger = logging.getLogger(__name__)
def log_training_dynamics(output_dir: os.path,
... |
import datetime
import io
import math
import struct
from osgar.node import Node
SLIP_END = 0xC0
SLIP_ESCAPE = 0xDB
SLIP_ESCAPED_END = 0xDC
SLIP_ESCAPED_ESCAPE = 0xDD
def slip_stream():
SLIP_STATE_NORMAL, SLIP_STATE_ESCAPED = list(range(2))
state = SLIP_STATE_NORMAL
buf = []
packets = []
while Tr... |
import RPi.GPIO as GPIO
import time
import cv2
import numpy as np
import time
from enum import Enum
import copy
from picamera.array import PiRGBArray
from picamera import PiCamera
from move import CarMove
from ultrasound import CarUltrasound
from infrared import CarInfrared
from camera import CarCamera
from track imp... |
import random
import os
import torch
import torch.optim as optim
import torch.nn.functional as F
from ntm.ntm import NTM
from ntm.utils import plot_copy_results
import argparse
import numpy as np
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
parser = argparse.ArgumentParser(descriptio... |
import base64
import json
import logging
import pickle
from socket import AF_INET, SOCK_STREAM, socket
def dic_pickle_dumps_and_b64(data):
"""
Pickles and base64 all data in a dictionary
Used before sending an json over a socket
:param data: to encode
:return: encoded data
"""
for i in dat... |
"""TCP Server to stream mock EEG data."""
import logging
from queue import Queue, Empty
import select
import socket
import time
from bcipy.acquisition.datastream.producer import Producer
from bcipy.acquisition.datastream.generator import random_data_generator
from bcipy.acquisition.util import StoppableThread
log = ... |
import numpy as np
import numpy.testing as npt
from dipy.core.geometry import cart2sphere
from dipy.core.gradients import gradient_table
from dipy.core.sphere import HemiSphere, unit_icosahedron
from dipy.direction.bootstrap_direction_getter import BootDirectionGetter
from dipy.direction.pmf import BootPmfGen, Simple... |
#
# Copyright (c) 2019 MagicStack Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import argparse
import asyncio
import edgedb
import json
import progress.bar
import uvloop
class Pool:
_STOP = object()
def __init__(self, data, *, concurrency: int):
self._concurrency = concurrency
... |
import argparse
import tensorflow as tf
import numpy as np
import os
import pickle
import time
from nmt import Encoder,Decoder,loss_function,BahdanauAttention
from sklearn.model_selection import train_test_split
from prepare_dataset import load_dataset,merging_datafile
@tf.function
def train_step(inp, targ, enc_hid... |
#
# 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.
#
import torch
import torch.nn as nn
import rlstructures.logging as logging
from rlstructures import DictTensor
from rlstructures import Ag... |
import logging
import os
import socket
import bcolz
import pandas as pd
import pytest
import redis
import threading
from bcolz import ctable
from pandas.util.testing import assert_frame_equal
from time import sleep
import bqueryd
from bqueryd.util import get_my_ip
TEST_REDIS = 'redis://redis:6379/0'
NR_SHARDS = 5
... |
import tweepy
import os
import urllib.parse
import re
# Twitter keys
API_KEY = 'YOUR_API_KEY'
API_SECRET_KEY = 'YOUR_API_SECRET_KEY'
ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN'
ACCESS_SECRET_TOKEN = 'YOUR_ACCESS_SECRET_TOKEN'
# Initialize tweepy
auth = tweepy.OAuthHandler(API_KEY, API_SECRET_KEY)
auth.set_access_token(ACCESS_... |
#
# 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, software
# ... |
import sys
import subprocess
import json
from lib.expected import Expected
class TestVPC(object):
def __init__(self, expected):
result = subprocess.run([
'aws', 'ec2', 'describe-vpcs', '--filters', 'Name=is-default,Values=false'
], stdout=subprocess.PIPE)
got_vpc_list = json.... |
# 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, software
# d... |
from typing import List
import numpy as np
from numpy import ndarray
from scipy.spatial.distance import pdist
from .distance_matrix import condensed_to_square
from .distance_matrix import get_condensed_indices
DEFAULT_LABEL = -2
NOISE_LABEL = -1
class DBSCAN:
"""Density-Based Spatial Clustering of Applications... |
#!/usr/bin/env python3
# Copyright 2018 Open Source Foundries Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Zephyr RTOS meta-tool (west) main module
'''
import argparse
import colorama
from functools import partial
import os
import sys
from subprocess import CalledProcessError, check_output, DEVNULL
from wes... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... |
from django.http import HttpResponse,JsonResponse
from django.urls import reverse
from django.core.exceptions import ValidationError
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import View, TemplateView
from django.db.models import Q
# from mooringlicensing.components.prop... |
from numpy import *
import time
from .precomputations import (reduce_masks, compute_correction_terms_and_replace_data,
compute_float_num_unmasked, reduce_masks_from_arrays,
compute_float_num_unmasked_from_arrays)
from .logger import log_message
from six.moves... |
# encoding=utf8
import copy
import logging
import numpy as np
from niapy.algorithms.algorithm import Algorithm, Individual, default_individual_init
logging.basicConfig()
logger = logging.getLogger('niapy.algorithms.basic')
logger.setLevel('INFO')
__all__ = ['ArtificialBeeColonyAlgorithm']
class SolutionABC(Indivi... |
import re
import inspect
import linecache
from collections import MutableMapping
class TestResult:
def __init__(self, test_status=None, test_name=None, filename=None, desired_caps=None, appium_log=None, screenshot=None, page_source=None, error=None, code_context=None, elapsed_time_ms=None):
self.status = ... |
import torch
import torch.nn as nn
from torch.nn import functional as F
def reparameterize(mu, logvar):
std = torch.exp(0.5 * logvar)
eps = torch.randn_like(std)
return mu + eps * std
class conv_block(nn.Module):
def __init__(self, in_channel, outchannel, kernel_size=3, padding=1, stride=2):
... |
'''
This group of tasks deals with the life cycle of any terraform deployment.
'''
import invoke
import glob
import os
import os.path
import sys
def iac_path(context):
'''
Returns the path of the deployment code inside this repository.
:param context: PyInvoke context
:return: path of the deployment code
'... |
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from modules.utils.dlUtils import get_block_1
class CasualConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size,
stride=1, dilation=1, groups=1, bias=True):
super(Casu... |
"""Automatically create command line menus with arg hiearchies."""
import argparse
import copy
import inspect
import pkgutil
from types import ModuleType
FUNC_NAME_ARG = "_cmdmenu_func_name"
def cmdmenu_function(param, description=None):
"""Decorator for marking a function to appear in cmdmenu.
If it is used... |
# -*- coding: utf-8 -*-
import os
import sys
import functools
DATABASE_FILE = "version"
def MakeDirs(dirname):
dirname = os.path.abspath(dirname)
dirname = dirname.replace("\\","/")
dirnames = dirname.split("/")
destdir = ""
destdir = os.path.join(dirnames[0] + "/",dirnames[1])
... |
# from os import environ
import configparser
import json
import os.path
from logging import getLogger
from codev.core.source import Source
from codev.core.providers.machines import VirtualenvBaseMachine
from codev.core.installer import Installer
from codev.core.settings import BaseSettings, ProviderSettings
from codev... |
#!/usr/bin/env python3
"""
Hdmi Matrix simulation
"""
import time
from datetime import datetime
from llama import mqtt
import hdmi
DEADTIME = 1.0
# Update lock timer
LAST_UPDATE_A_FINISHED = 0
LAST_UPDATE_B_FINISHED = 0
# Actions
GET_CHANNEL_INPUTS_REQUEST = "@hdmi/GET_CHANNEL_INPUTS_REQUEST"
GET_CHANNEL_INPUTS... |
# 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 u... |
from input_algorithms.many_item_spec import many_item_formatted_spec
from bespin.option_spec.bespin_specs import BespinSpec
from input_algorithms import spec_base as sb, validators
from docutils.statemachine import ViewList
from sphinx.util.compat import Directive
from textwrap import dedent
from docutils import nodes... |
r"""
List of coset representatives for `\Gamma_H(N)` in `{\rm SL}_2(\ZZ)`
"""
###########################################################################
# Sage: System for Algebra and Geometry Experimentation
#
# Copyright (C) 2005 <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import random
import unittest
from unittest import TestCase, main
import torch
import torch.nn as nn
import torchvision.models as models
import numpy as np
from nni.algorithms.compression.pytorch.pruning import L1FilterPruner, L2FilterPruner, F... |
import torch
import torch.nn as nn
from horch.models.modules import Conv2d, DWConv2d, HardSigmoid
class SELayer(nn.Module):
def __init__(self, in_channels, reduction=4):
super().__init__()
channels = in_channels // reduction
self.attn = nn.Sequential(
nn.AdaptiveAvgPool2d(1),
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import os
import sys
__author__ = '<NAME>'
__version__ = '0.1'
__release__ = '9.2r'
from datetime import datetime
ndt = datetime.now()
__startdt__ = ndt.strftime("%a, %d %b, %Y at %X")
__pyVer__ = sys.version.split(' ')[0].split('.')[:-1]
class foo:
def ... |
# A Python program for Dijkstra's shortest
# path algorithm for adjacency
# list representation of graph
from collections import defaultdict
import sys
class Heap:
def __init__(self):
self.array = []
self.size = 0
self.pos = []
@staticmethod
def newMinHeapNode(v, dist):
m... |
import curses, operator, os
# https://docs.python.org/3/howto/curses.html
# https://docs.python.org/3/library/curses.html
# https://www.ibm.com/developerworks/library/l-python6/
VERSION = 0.4
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
players = {}
# chr: bool (AVAILABLE)
alphabet = {}
word = ""
progress = 0
penalties =... |
# src/kallisto/units.py
from math import pi, sqrt
from scipy.constants import c, e, G, h, k, m_e, m_p, m_u, mu_0, N_A
version = "2018"
class Units(dict):
"""Dictionary for units."""
def __init__(self, *args, **kwargs):
super(Units, self).__init__(*args, **kwargs)
self.__dict__ = self
cod... |
from __future__ import division
import numpy as np
from numpy import newaxis as na
from core.core_abstractions import Model, ModelMeanField, ModelMeanFieldSVI
import os, sys
scriptpath = os.path.abspath(os.path.join(os.path.dirname(__file__), 'internals'))
sys.path.append(scriptpath)
#from internals import hmm_states,... |
import logging
from typing import List, Dict
import numpy as np
import pandas as pd
from rlutilities.linear_algebra import vec3
from rlutilities.simulation import Ball, Game as RLUGame
from api.events.events_pb2 import Events
from api.game.game_pb2 import Game
from carball.output_generation.data_frame_generation.pref... |
"""
sentry.plugins.bases.notify
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from sent... |
"""
@FileName: calModel.py
@Description: calculate the total of parameters and the total of flops for a given model in pytorch
@Author : Lj
@CreateDate: 2019/11/6 10:22
@LastEditTime: 2019/12/23 15:34
@LastEditors: Lj
@Version: v0.1
"""
from collections import OrderedDict
import pandas as pd
from utils im... |
import warnings
import torch
import torch.nn
import scipy
import scipy.special
from numpy import euler_gamma
from ..base import BaseARD
from ...utils.sparsity import SparsityStats
from .base import CplxLinearGaussian, CplxBilinearGaussian
from .base import CplxConv1dGaussian, CplxConv2dGaussian, CplxConv3dGaussian
... |
from collections import deque, namedtuple
from functools import wraps
import logging
import os
import os.path as op
import shutil
import time
import appdirs
import joblib
lgr = logging.getLogger(__name__)
class PersistentCache(object):
"""Persistent cache providing @memoize and @memoize_path decorators
"""
... |
# Neural network
import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn import neural_network
from sklearn.metrics import explained_variance_score
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import cross_validate
from sklearn.model_selection import train_test_s... |
#!/usr/bin/env python
# coding: utf-8
# %%
import argparse
import json
import os
from collections import defaultdict
from datetime import timedelta
from functools import lru_cache
import pymysql
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
import pywikibot.flow
from confi... |
# -*- coding: UTF-8 -*-
"""
This module contains functions for plotting the results of evaluation experiments.
"""
import os
import matplotlib.pyplot as plt
def plot_config(base_dir, sub_dirs=[], prefix="", img_type="pdf"):
"""
Configure where plots should be stored and which file type should be used.
@... |
from __future__ import division, print_function
import argparse
import logging
import numpy as np
import mxnet as mx
from mxnet.io import DataBatch, DataIter
# # For non-interactive plotting
# import matplotlib as mpl
# mpl.use('Agg')
# import matplotlib.pyplot as plt
import p1b3
import p1_common
import p1_common_... |
#
# Copyright 2018 Analytics Zoo 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... |
import dask.dataframe as dd
import pandas as pd
import pytest
import featuretools as ft
from featuretools.entityset import EntitySet, Relationship
from featuretools.utils.gen_utils import Library
def test_create_entity_from_dask_df(pd_es):
dask_es = EntitySet(id="dask_es")
log_dask = dd.from_pandas(pd_es["lo... |
# coding=utf-8
# Copyright 2019 The ML Fairness Gym 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 applicab... |
from base64 import (
urlsafe_b64decode,
)
import logging
from re import (
compile,
)
from typing import (
Any,
Dict,
)
from urllib.parse import (
urlencode,
urlparse,
)
from cryptography.hazmat.backends import (
default_backend,
)
from cryptography.hazmat.primitives.asymmetric import (
... |
# We make a small version of celebA dataset
# We use the Kaggle version of the data:
# Download from https://www.kaggle.com/jessicali9530/celeba-dataset
# We extract the first N images and store as a numpy array.
# We crop and resize images from 218x173 to 64x64.
# We save directory of images as a zip file.
# We also ... |
# Copyright (c) 2011 Rackspace
# 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... |
#!/usr/bin/env python
'''
Usage:
make_circuit_data.py [options] [OUTDIR]
Options:
--seeds INT Random seeds to generate data for. [default: 0]
--num-wires NUMLIST Number of (input) wires. [default: 4,5,6,8,10,12,15,20]
--num-gates NUMLIST Number of gates. [defaul... |
"""
Custom component to integrate with OctoPrint.
For more details about this component, please refer to
https://github.com/fredrikbaberg/octoprint_hass
"""
import os
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant import config_entries
import homeassistant.helpers.... |
#!/usr/bin/python3
''' preprocess_articles.py - Preprocesses all articles, extracts and saves the records.
## Steps:
- Load articles data from `../data/longevity_research.sql`
and saves it to `../data/articles.pickle`;
- Check for duplicates;
- Preprocess articles and save the records to '../data/recor... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 14:24:21 2015
This is the python version of spinorf with multicore processing
@author: zag
"""
import time as timemod
import numpy as np
import math
from itertools import product
try:
import numba
from .chebyshev_functions_numba import setup_scaled_H, moments, f... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - <NAME> - MIT License
from __future__ import absolute_import
import os
import logging
import time
import threading
import socket
try:
from urllib2 import urlopen
except ImportError:
from urllib.request ... |
#!/usr/bin/python
import clodius.tiles as ct
import h5py
import math
import numpy as np
import os
import os.path as op
import sys
import time
import argparse
def reduce_data(data_array):
s = set(data_array)
lookup_table = dict([(x, i) for i, x in enumerate(s)])
print("len lookup_table:", len(lookup_tabl... |
import dask.array as da
import numpy as np
import pandas as pd
import xarray as xr
__all__ = [
"lstsq_slope_dropna",
"compute_power_spectrum",
"xarray_plls",
"squash_zstack",
]
def lstsq_slope_dropna(log_power_spec, logR):
"""
Compute the slope of a linear fit between a log power specrum and ... |
import json
import os
from transformers import BertTokenizer
import fasttext
import re
import numpy as np
import pickle
#
####
step1 = True
step2 = True
step3 = True
#####
path = "\\".join(os.getcwd().split("\\")[:-3]) + "\\data\\data" #Just make the path to the data folder :)
filesExist = True
try:
files = o... |
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
from astropy.io import fits
from skimage import filter
from skimage.transform import hough_circle
from skimage.feature import peak_local_max
from skimage.draw import circle_perimeter
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from dateti... |
# -*- coding: utf-8 -*-
# AUTHOR: RaNaN, mkaay
import time
from threading import RLock
from ..managers.event_manager import UpdateEvent
from ..utils import format
from ..utils.old import lock
status_map = {
"finished": 0,
"offline": 1,
"online": 2,
"queued": 3,
"skipped": 4,
"waiting": 5,
... |
from physical_constants import *
from simulation_parameters import *
from numpy import array
from dolfin import Constant,Max,sqrt
########################################################
################# SUPPORT FUNCTIONS #################
########################################################
class Vertical... |
from pytype import compat
from pytype.pyc import opcodes
import unittest
class _TestBase(unittest.TestCase):
"""Base class for all opcodes.dis testing."""
def dis(self, code):
"""Return the opcodes from disassbling a code sequence."""
return opcodes.dis(compat.int_array_to_bytes(code), self.python_versio... |
from copy import deepcopy
from itertools import dropwhile, takewhile
from lxml import etree
from regparser.citations import internal_citations, Label
from regparser.notice.util import body_to_string, spaces_then_remove
from regparser.notice.util import swap_emphasis_tags
def remove_extract(xml_tree):
"""Occasio... |
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
fX = theano.config.floatX
def no_mean_softmax(x, axis=1):
"""
similar to stable softmax, but using mean instead of max
"""
# TODO test performance on axis
# if this way is slow, could reshape, do... |
import sys
import base64
import os
import re
import requests
import json
import time
import cv2
import numpy as np
from pathlib import Path
pattern1 = re.compile("^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4,5}[A-Z0-9挂学警港澳]{1}$")
pattern2 = re.compile("^[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$")
def call... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Helpers for handling BIDS-like neuroimaging structures
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"""
from pathlib import Path
import warnings
import re
import simp... |
import os
import pprint
from stackprinter.extraction import UnresolvedAttribute
from stackprinter.utils import inspect_callable
try:
import numpy as np
except ImportError:
np = False
else:
from distutils.version import LooseVersion
is_modern_numpy = LooseVersion(np.__version__) >= LooseVersion('1.14')... |
# Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import sys
sys.path.append('/media/Diske/projects/Pint')
import unittest
import torch
import torch.nn.functional as F
import cv2
import numpy as np
from easydict import EasyDict
from iPERCore.tools.human_digitalizer.renders im... |
import random
import logging
from torch.utils.data import DataLoader, RandomSampler
from torch.utils.data.distributed import DistributedSampler
from .runners import (
GlueTaskRunner, InputExample, InputFeatures, HybridLoader,
convert_to_dataset, tokenize_example, _truncate_seq_pair,
)
logger = logging.getLog... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2019 BrainPad Inc. All Rights Reserved.
#
# 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 l... |
import argparse
from functools import partial
from pathlib import Path
import librosa
import librosa.display
import matplotlib
import matplotlib.pyplot as plt
import toml
import torch
import torch.cuda.amp as amp
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data.sampler as samplers
fr... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC 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
#... |
"""Unitary tests for the DoublyLinkedList collection class"""
# using pycov, checks coverage with
# pytest --cov=linked_list --cov-report term-missing
from collections.abc import Iterable, Iterator
import pytest
from linked_list import DoublyLinkedList
def test_creation_empty():
"""An empty list should have its... |
from argparse import ArgumentParser
from datetime import datetime
import json
import os
import sys
import yaml
from ._version import __version__
from .builtin import log_versions
from .execute import TempWorkDir, execute_task
from .utils.console import JsonStreams, detail
from .utils.data import Meta, Settings, DEFAUL... |
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import RandomForestClassifier
from sklearn import metrics
import const_val
import input
import pickle
from bert_encode import *
from input import *
"""
随机森林在树木数量600出现了预测下降,最优值应该在400 ~ 500左右
"""
def predict():
with open('RandomForestR... |
import time
import typing
import datetime
import logging
if typing.TYPE_CHECKING: # avoid circular imports
from core import Environment
import numpy as np
import networkx as nx
import graph
# mpl.use('agg') #TODO: for use in the command-line-only (no GUI) server
from matplotlib import rcParams
# rcParams['font.fam... |
import numpy as np
import cv2
import random
import threading
import os
import time
import logging
import tensorflow as tf
import matplotlib.pyplot as plt
from PIL import Image
def fold(image):
rows,cols,channel = image.shape
new_row = int (rows/2)
dst = image[0:new_row, 0:cols]
... |
# (c) 2019, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest
from ansible_collections.netapp.on... |
# coding=utf-8
# --------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import M... |
"""
Mask R-CNN
Configurations and data loading code for the synthetic Shapes dataset.
This is a duplicate of the code in the noteobook train_shapes.ipynb for easy
import into other notebooks, such as inspect_model.ipynb.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Writt... |
from __future__ import unicode_literals
import argparse
import json
import utils
from keras.callbacks import ModelCheckpoint
from keras.layers import Activation, Dense, Dropout, Flatten, Lambda, Conv2D, BatchNormalization
from keras.layers.convolutional import MaxPooling2D
from keras.models import Sequential
from kera... |
"""
This file contains puller implementations for XRay
"""
import logging
import time
from datetime import datetime
from itertools import zip_longest
from typing import Optional, Any, Dict, Union, List
from botocore.exceptions import ClientError
from samcli.lib.observability.observability_info_puller import Observabi... |
import torch
import torch.nn as nn
from transformers import BertModel, BertTokenizer
from transformers import RobertaModel, RobertaTokenizer
#from BERT_model_main import MODELS
MODELS = [
# 12-layer, 768-hidden, 12-heads, 110M parameters
(BertModel, BertTokenizer, 'bert-base-uncased'),
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021-present davfsa
#
# 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 t... |
"""
Classes for representing a Watch Your Back! game board and the Black and White
pieces that move around it.
Created for the tasks of finding legal moves and applying them to the board.
Also allows moves to be 'undone'.
Does not contain any logic to check for errors: all the functions and methods
assume that they w... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# SourceRcon - Python class for executing commands on Source Dedicated Servers
# Copyright (c) 2010 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.