text stringlengths 3.07k 22.1k |
|---|
from typing import List
import numpy as np
import pandas as pd
import pycountry as pyc
from epippy import data_path
def convert_country_codes(source_codes: List[str], source_format: str, target_format: str,
throw_error: bool = False) -> List[str]:
"""
Convert country codes, e.g., ... |
from typing import (
Tuple,
List,
Union,
Dict,
Optional,
)
import numpy as np
import pandas as pd
import itertools
from sklearn.ensemble import RandomForestRegressor
from .forest_tree import ForestTree
from copy import deepcopy
class FunctionalANOVA(object):
"""__init__
Args:
... |
"""
Multiband generalizations of Lomb-Scargle Periodograms
"""
from __future__ import division, print_function
__all__ = ['LombScargleMultiband', 'LombScargleMultibandFast']
import numpy as np
from .modeler import PeriodicModelerMultiband
from .lomb_scargle import LombScargle
from .lomb_scargle_fast import LombScar... |
# A straightforward implementation
# of the particle filter idea
#
# A particle filter is a sample based approach
# for recursive Bayesian filtering
# The particles are a population based discrete
# representation of a probability density function.
#
# The filter recursively updates
#
# - the particle locat... |
from __future__ import division
from CoolProp.CoolProp import Props, DerivTerms
def finite_diff(Output, Input1, Val1, Input2, Val2, Fluid, index, deriv, order, type='centered', dx=1e-3):
def f(index, dx):
if index == 1:
return Props(Output, Input1, Val1 + dx, Input2, Val2, Fluid)
else:... |
from django.conf import settings
from systems.plugins.index import BasePlugin
from plugins.parser.config import ConfigTemplate
from utility.data import ensure_list
import threading
import importlib
import glob
import re
import copy
import logging
import yaml
logger = logging.getLogger(__name__)
for directory in s... |
#
# Copyright (c) 2016 <NAME>
# All rights reserved.
#
# This file is part of Faber. It is made available under the
# Boost Software License, Version 1.0.
# (Consult LICENSE or http://www.boost.org/LICENSE_1_0.txt)
from __future__ import absolute_import
from . import scheduler
from .feature import lazy_set
from .featu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyTorch lightning implementation of a simple 2-layer-deep LSTM for genre classification of musical audio.
Feeding the LSTM stack are spectral {centroid, contrast}, chromagram & MFCC features (33 total values)
We use this toy dataset and a well-understood, ... |
from pytrends.request import TrendReq
#from IPython.core.pylabtools import figsize
import numpy as np
import pandas as pd
#import matplotlib as mpl
#import matplotlib.pyplot as plt
result = pd.DataFrame
# Define date to string formatter function
def date_to_string(datetimevar, form='%Y-%m-%dT%H'):
import pandas a... |
import sys
from vergeml.utils import VergeMLError, parse_ai_names
from vergeml.validate import load_yaml_file, ValidateDevice, ValidateData
from vergeml import __version__
from vergeml.env import Environment
from vergeml.plugins import PLUGINS
from vergeml.command import Command
import os.path
import logging
import get... |
#!/usr/bin/env python
from functools import reduce
__version__ = '0.3.0'
import requests
import xmltodict
import dateutil.parser
import lxml.builder as lb
from lxml import etree
from xml.parsers.expat import ExpatError
class SpreedlyError(Exception):
"""
Exception Handling
"""
def __init__(self, ... |
"""
==================================
:mod:`swarm` -- Swarm intelligence
==================================
This module provides standard swarm intelligence algorithms.
.. Copyright 2012 <NAME>
.. Permission is hereby granted, free of charge, to any person obtaining a copy
of ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import sys
import numpy as np
import logging
import time
from datetime import datetime
from argparse import ArgumentParser
import pandas as pd
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
import... |
""" PROTOCOL: SPI CONTROL FUNCTIONS: open, read, write, exchange, spy, close """
import ctypes # import the C compatible data types
from sys import platform, path # this is needed to check the OS type and get the PATH
from os import sep # OS specific file path separators
# load t... |
import os
from typing import Dict, List, Union
from PIL import Image as PImage
from vltk.abc import config
from vltk.inspection import get_args
from vltk.memory import get_most_free_gpu
# from vltk.loader.builder import init_datasets
from vltk.processing.image import Image
"""
Old config options that may be good to ... |
import pickle
import os
import sys
from datetime import datetime
import threading
import math
import json
import torch
from transformers import *
import re
from nltk.corpus import stopwords
import urllib
from collections import Counter
from torch.utils.data import DataLoader
from tqdm import tqdm
import numpy as np
imp... |
##############################################################################
# Copyright (c) 2019 opnfv.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.... |
import math
import numpy as np
# modules.parameterisation contains functions for the turbine and sluice gate flow calculation
from modules.parameterisations import turbine_parametrisation, gate_sluicing, turbine_sluicing
def lagoon_operation(h_i, h_o, t, status, control, turbine_specs, sluice_specs, flux_limiter=0.2... |
import json
from abc import ABCMeta, abstractmethod
from os.path import exists
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
from ... import builder
from ....core.ops import normalize
def entropy(p, dim=-1, keepdim=False):
return -torch.wher... |
import pytest
from flare.kernels.two_body_mc_simple import TwoBodyKernel
from flare.kernels.three_body_mc_simple import ThreeBodyKernel
from flare.kernels.cutoffs import quadratic_cutoff
from flare import struc, env
import numpy as np
# Choose parameters for the random structures.
n_atoms = 5
cell = np.eye(3) * 10
sp... |
"""
Encoding and decoding classes for Python 2 client/server communication.
This module is used by both the Python 2 server and the Python 3 client, with
some modification to handle object references.
The encoding supports basic types and data structures. Everything else will
be encoded as an opaque object reference... |
from typing import Optional, List, Tuple
from agoraapi.common.v3 import model_pb2
from agora import solana
from agora.solana import memo, token, system
from .creation import Creation
from .invoice import InvoiceList, Invoice
from .memo import AgoraMemo
from .payment import ReadOnlyPayment
from .transaction_type impor... |
import sys
import time
import os.path
from glob import glob
from datetime import datetime, timedelta
# data tools
import h5py
import numpy as np
import numba as nb
from scipy.ndimage import gaussian_filter
# custom tools
sys.path.insert(0, '/glade/u/home/ksha/WORKSPACE/utils/')
sys.path.insert(0, '/glade/u/home/ksha... |
import torch
import torch.distributions as td
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.distributions import constraints
from torch.distributions.exp_family import ExponentialFamily
from itertools import product
import numpy as np
class MaskedDirichlet(td.D... |
import faiss
import os
from os.path import exists, join, basename
from collections import OrderedDict
import numpy as np
import numpy.random
import datetime
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn.functional import relu
from torch.utils.data import Dataset
from lib.dataloader impor... |
import csv
import datetime
import os
import sys
import time
import traceback
from sys import platform
'Driver'
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
'Driver Exceptions'
from selenium.common.exceptions import *
'Parser'
from bs4 import BeautifulSoup
from bs4.e... |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... |
#
# Copyright (c) 2006-2013, Prometheus Research, LLC
#
from ..util import Printable, listof, tupleof
from ..adapter import Adapter, Protocol, adapt, adapt_many, call
from ..domain import (Domain, BooleanDomain, NumberDomain, DecimalDomain,
TextDomain, EnumDomain, DateDomain, TimeDomain, DateTimeDomain,
... |
# -*- coding: utf-8 -*-
# MIT license
#
# Copyright (C) 2018 by XESS Corporation / <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limit... |
"""
example script for running a RNA-seq analysis
python rnaseq_pipeline.py rnaseq_pipeline.yaml
you will have to write a couple of functions to group the input
data in useful ways
"""
from bipy.cluster import start_cluster, stop_cluster
import sys
import yaml
from bipy.log import setup_logging, logger
from bcbio.ut... |
import numpy as np
import numpy.linalg as la
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.cm as cm
from tqdm import tqdm
import sys
import SBW_util as util
from matplotlib.animation import FuncAnimation
# init cond
# plots 1D
# report (todo's, structure, division of ... |
# %%
import pandas as pd
import numpy as np
import requests # http 요청 모듈
from bs4 import BeautifulSoup # 웹 크롤링 모듈
from urllib.request import urlopen # 웹 크롤링 모듈
from urllib.parse import quote_plus, urlencode
from pandas import DataFrame, Series # 시리즈, 데이터프레임 모듈
from pandas import ExcelFile, ExcelWriter # 엑셀 읽기, 쓰기... |
"""
This module provides the UFLammps class for evaluating energies,
forces, stresses, and other properties using the ASE Calculator protocol.
Note: only pair interactions (degree = 2) are currently supported.
"""
from typing import List, Tuple
from datetime import datetime
import numpy as np
from scipy import interp... |
# container-service-extension
# Copyright (c) 2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
import platform
import signal
import sys
import threading
from threading import Thread
import time
import traceback
import click
import pkg_resources
from pyvcloud.vcd.client import BasicLoginC... |
import tensorflow as tf
import helper
import numpy as np
from collections import Counter
from tensorflow.contrib import seq2seq
from time import gmtime, strftime
import matplotlib.pyplot as plt
f_cost="uni.txt"
f_wr=open(f_cost,"a")
# Number of Epochs
num_epochs = 200
# Batch Size
batch_size =250
# RNN Size
rnn_size = ... |
from keras.models import Model
from keras.layers import Input, concatenate, Conv2D, MaxPooling2D, Conv2DTranspose, Activation
from keras.layers import BatchNormalization, Add, Flatten, Dense, Dropout
from keras.optimizers import Adam
from keras import backend as K
def dice_coef(y_true, y_pred):
smooth = 1.
y_t... |
"""Regression Tests"""
import os
import re
import unittest
import pytest
from nexus.reader import NexusReader
from nexus.handlers.data import DataHandler
@pytest.fixture
def bad_chars(regression):
return NexusReader(regression / 'bad_chars_in_taxaname.trees')
@pytest.fixture
def with_dash(regression):
ret... |
import asyncio
import pytest
import datetime
import socket
import os
import itertools
from hat import aio
from hat import util
from hat.syslog.server import common
import hat.syslog.server.backend
pytestmark = pytest.mark.asyncio
@pytest.fixture
def short_register_delay(monkeypatch):
monkeypatch.setattr(hat.sy... |
import numpy as np
from numba import cuda, int32, float32
from numba.cuda.testing import skip_on_cudasim, unittest, CUDATestCase
from numba.core.config import ENABLE_CUDASIM
def useless_syncthreads(ary):
i = cuda.grid(1)
cuda.syncthreads()
ary[i] = i
def useless_syncwarp(ary):
i = cuda.grid(1)
c... |
#!/usr/bin/env python3
# coding: utf-8
"""
Test panel class
Copyright 2017 MicaSense, 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 without limitation the ri... |
from __future__ import division
import json
import os
import shutil
import numpy as np
import torch, cv2
from random import choice
from torch.utils.data import Dataset
import json
from PIL import Image
import random
from utils.image import _palette
class _EVAL_TEST(Dataset):
def __init__(self, transform, seq_name)... |
# This Python file uses the following encoding: utf-8
from flask import render_template,redirect, url_for, abort, flash, request, current_app, make_response
from . import main
from .forms import EditProfileForm, EditProfileAdminForm, QuestionForm, AnswerForm
from .. import db
from ..models import User, Role, Permissio... |
import onnx
from onnx import helper
from onnx import TensorProto
from onnx import OperatorSetIdProto
import itertools
onnxdomain = OperatorSetIdProto()
onnxdomain.version = 12
# The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification.
onnxdomain.domain ... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns;
sns.set()
import scipy.cluster.hierarchy as sch
import os
import pickle
soll_labels = [
'Soll_1',
'Soll_2',
'Soll_3',
'Soll_4',
'Soll_5',
'Soll_6',
'Soll_7',
'Soll_8',
'Soll_9',
'Soll_... |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '../'))
import torchvision
import torch
import torch.nn as nn
from torch.utils.data import dataset
from rtpt import RTPT
from typing import Optional, List
from utils.training import train_model, LabelSmoothingCrossEntro... |
import os
import json
import bpy
import inspect
from itertools import chain
from math import radians, degrees
def snp_locateLibrary(library_path):
global SNP_LIBRARY_PATH
global SNP_BASE_DATA
SNP_LIBRARY_PATH = library_path
# import materials and linestyles from library
library = os... |
# Copyright 2018 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.
"""Functions to assist in notifying flake culprits."""
import logging
import textwrap
from google.appengine.ext import ndb
from infra_api_clients.coderevie... |
import mediapipe as mp
import cv2
import temp
from PIL import Image
# from imutils import face_utils
import os
import h5py
import numpy as np
import temp
import os
# from eyes_features import get_landmarks
eye_detect_file = '/home/data/wjc_data/src/data/'
eye_cascade = cv2.CascadeClassifier(os.path.join(eye_detect_... |
import pickle
import re
from functools import partial
from inspect import iscoroutinefunction
from itertools import chain
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from uuid import UUID
from anyio.to_thread import run_sync
from pydantic import validate_arguments
from pydantic.typing import AnyCa... |
#
# o o
# 8
# .oPYo. .oPYo. odYo. o8P o8 .oPYo. odYo. .oPYo. .oPYo.
# Yb.. 8oooo8 8' `8 8 8 8oooo8 8' `8 8 ' 8oooo8
# 'Yb. 8. 8 8 8 8 8. 8 8 8 . 8.
# `YooP' `Yooo' 8 8 8 ... |
import helper as Helper
import numpy as np
import tensorflow as tf
def common_train(self):
""" Training function shared between both link prediction and temporal prediction. """
pos_h_e = tf.squeeze(tf.nn.embedding_lookup(self.ent_embeddings, self.pos_head))
pos_t_e = tf.squeeze(tf.nn.embedding_lookup(sel... |
import copy
from models.xbert import BertLMHeadModel
from models.xroberta import RobertaForCausalLM
from models import XVLMBase, load_pretrained
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
class XVLM(XVLMBase):
def __init__(self, config):
super().__init__(confi... |
from typing import Dict, List, Union
from collections import defaultdict
import pickle
class ImpactTerm(object):
def __init__(self, impact_string: str, impact_group: str, string_pos: str, group_type: str):
self.string = impact_string
self.group = impact_group
self.pos = string_pos
... |
"""
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on a 2D projection of the iris
dataset. We only consider the first 2 features of this dataset:
- Sepal length
- Se... |
import gym
import pandas as pd
import numpy as np
from gym import spaces
from enum import Enum
from typing import List, Dict
from lib.env.render import TradingChart
from lib.env.reward import BaseRewardStrategy, IncrementalProfit, WeightedUnrealizedProfit
from lib.env.trade import BaseTradeStrategy, SimulatedTradeStr... |
"""
This script creates a dataset that is transformed in such a way that the tsetlin automata reads it correctly.
"""
print("Correcting board")
import csv
def Rearrange(list):
output = []
for column in range(6):
temp = 6 - column
for row in range(7):
index = (6 * row) + t... |
import requests as req
from flask import Flask, render_template, url_for, request, redirect
from flask_mqtt import Mqtt
import json
import pandas as pd
import datetime
import json
from geopy.geocoders import Nominatim
#app = Flask(__name__)
app = Flask(__name__, static_url_path='')
app.config['MQTT_BROKER_URL'] = 'MQ... |
"""
shutit.tk.setup (core ShutIt setup module)
Nomenclature:
- Host machine: Machine on which this script is run.
- Target: Environment to which we deploy (docker container or bash shell)
- Container: Docker container created to run the modules on.
- target_child pexpect-spawned chil... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
import time
import sys
import operator
import subprocess
import json
import yaml
import logging
import coloredlogs
logger = logging.getLogger('kube')
# don't change this
managed_by_val = "azk-to-kube"
import argparse
from pykube.config import KubeConfig
from kube_ht... |
import tensorflow as tf
from dps.utils import Parameterized, Param
from dps.utils.tf import tf_shape, tf_binomial_coefficient, build_scheduled_value
from auto_yolo.models.core import concrete_binary_sample_kl, tf_safe_log, logistic_log_pdf
class ObjKL(Parameterized):
obj_concrete_temp = Param(help="Higher value... |
import os, time
import argparse
import logging
import random
import string
import numpy as np
import mxnet as mx
from mxnet import gluon
from data import MovieLens
from model import GCMCLayer, BiDecoder
from utils import get_activation, parse_ctx, gluon_net_info, gluon_total_param_num, \
params_clip_g... |
"""
"""
from typing import List, Callable, NamedTuple
import argparse
import json
import logging
import os
from string import Template
import sys
import hashlib
import torch
from flask import Flask, request, Response, jsonify, render_template, send_from_directory
from flask_cors import CORS
from gevent.pywsgi import ... |
# Copyright (c) 2011 AOL 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 limitation the rights to use, copy, modify, merg... |
import torch.nn as nn
import torch
import math
import argparse
from tqdm import tqdm
# This enables the inbuilt cudnn auto-tuner to find the best algorithm to use for your hardware, e.g., wingrad conv op
torch.backends.cudnn.benchmark = True
NAME = 'dcgan'
batch_size = 1
latent_dim = 100
img_size = 256
channels = 3
#... |
#!/usr/bin/env python3
'''
NOTE: THIS IS OBSOLETE. USE BRATIAA
RECOMMENDED: https://github.com/oya163/bratiaa
Merge two conll files to check F1 and Kappa-score
for inter-annotator aggrement
Author: <NAME>
Date: 11/12/2019
How to run:
python utility/agreement.py -i test/oye... |
#copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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 l... |
"""Residual UNet and Attention UNet with silu activation function and Group Normalization"""
import os
import torch
import torch.nn as nn
import torchvision.transforms.functional as TF
class RecurrentBlock(nn.Module):
def __init__(self, out_channels, res=2):
super().__init__()
self.res = res
self.... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import argparse
import codecs
import json
import logging
import os
import shutil
import sys
import tensorflow as tf
from tensorflow.python.framework import graph_util
import numpy as np
from six import iteritems
import time
# Disable Tensorflow logging messages.
log... |
import wx
import numpy as np
import pickle
from narsil.tracking.siamese.trainDatasets import oneSet
class mainWindow(wx.Frame):
""" Main windows that helps loading data from one set of tracks
and annotate them
"""
def __init__(self, parent, title):
super(mainWindow, self).__init__(parent, titl... |
# -*- coding: utf-8 -*-
"""
/dms/edufolder/utils.py
.. enthaelt Hilfefunktionen fuer Lernarchive
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 05.06.2007 Beginn der Arbeit
0.02 27.... |
"""
Evalaution file to completly test the trained model
Usage:
--ConfigPath [PATH to configuration file for desired dataset]
"""
import os
import time
import torch
import argparse
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.dat... |
#!/usr/bin/env python3
"""
Operator for matching references to publications in database
"""
import tempfile
import logging
import gzip
import json
import os
import argparse
import elastic.common
from hooks import s3hook
from hooks.sentry import report_exception
logging.basicConfig()
logger = logging.getLogger(__name_... |
import concurrent.futures
import enum
import itertools
import json
import logging
from pathlib import Path
import cv2
import hydra
import numpy as np
import scipy.interpolate
import tifffile
from omegaconf import OmegaConf, DictConfig
from tqdm import tqdm
CONFIG_FILE = 'config.yaml'
class DistortMode(enum.Enum):
... |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import os
import random
import numpy as np
import tensorflow as tf
import tensorflow.contrib as tc
import bert
import main as graph
from vocab import Vocab
from utils.recorder imp... |
import datetime
import hashlib
import logging
import os
from functools import partial
from os import path
from PyQt5.QtCore import QObject, pyqtSignal, QSettings, QThread, QThreadPool, QRunnable, QTimer
from PyQt5.QtWidgets import QCheckBox, QRadioButton, QGroupBox, QWidget, QSplitter, QAction
from common.CustomUI im... |
#!/usr/bin/env python
#
# Copyright 2015 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... |
"""
Anyone who've tried to get through the A Song of Ice and Fire books written by <NAME> (the basis for the HBO
show Game of Thrones) knows that while the books are generally excellent, there are a lot of characters. A staggering
number, in fact, and it can be very hard to remember who's who and who is related to who ... |
from biopharma import units
from biopharma.core import SpecifiedDict, ModelComponent, SpecificationViolatedError
from biopharma.specs import Q, Value, Nested, Computed
import numbers
from pytest import raises
def test_class_instances():
class MyRandomClass(object):
def __init__(self, val):
se... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-02-25 19:48
import math
from typing import Iterable, Tuple, Callable
import torch
from torch.optim import Optimizer
from transformers import optimization
from elit.common.dataset import MultiTaskDataLoader
from elit.components.mtl.gated.joint_gated_mtl import Joint... |
"""
Descriptor computation helper utility. Checks data content type with respect
to the configured descriptor generator to skip content that does not match
the accepted types. Optionally, we can additionally filter out image content
whose image bytes we cannot load via ``PIL.Image.open``.
"""
import collections
import ... |
# Port of the 'cube' Gameduino demo/example code from the Arduino environment, for the Dazzler
# Gameduino in CircuitPython
# Harvey.Vrsalovic , May 2021
#
# This is more or less a "straight, naive" port from the C lang. and the Arduino libraries +
# Gameduino library into Python
# It is intended to be a startin... |
############################################################
#
# craft_poisons_htbd.py
# Hidden Trigger Backdoor Attack
# June 2020
#
# Reference: <NAME>, <NAME>, and <NAME>. Hidden
# trigger backdoor attacks. arXiv:1910.00033, 2019.
############################################################
import argparse
impor... |
"""The bot!"""
# Standard library:
import os
import random
import re
import logging
from typing import Dict, Optional, Sequence, Tuple, Union
# Third party:
import attr
import discord
from tabulate import tabulate
# Local:
from .discover import AudioCollection
# Listing of help aliases
HELP = ['help', 'h']
# Listin... |
import copy
import numpy as np
import pandas as pd
import matplotlib
from tabulate import tabulate
from visualizations import plot_barplot, draw_heatmap, plot_boxplot, plot_lineplot_sensitivity, plot_barplot_sensitivity, plot_radar, plot_boxplot_simulation
from pyrepo_mcda.mcda_methods import CODAS, TOPSIS, WASPAS, VI... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_urllib_parse_urlparse,
)
from ..utils import (
find_xpath_attr,
unified_strdate,
get_element_by_attribute,
int_or_none,
qualities,
)
# There... |
#coding:utf-8
import random
import time
import warnings
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
from torch import nn,optim
from torchvision.models.resnet import resnet50
from torch.autograd import Variable
from torch.utils.data import DataLoader
from Data_Loader import *
from ut... |
from app.views_dependency import *
from app.models import (
NaturalPerson,
Organization,
Reimbursement,
ReimbursementPhoto,
)
from app.reimbursement_utils import update_reimb_application
from app.comment_utils import addComment, showComment
from app.notification_utils import make_notification
__all__ =... |
#!/usr/bin/env python3
# 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.
# pyre-strict
from collections import defaultdict
from logging import Logger
from typing import Any, Dict, List, Optio... |
"""
FILES IN PACKAGE:
snn-stdp.py
get-networks-accuracy.py
read-pkl-spikes.py
iris-train.txt
iris-test.txt
README.md
Files generated after training:
results/input.pkl
results/output.pkl
Files generated after testing:
results/inputTest.pkl
results/outputTest.pkl
Author: <NAME>
Supervisor: Professor Dr. <NAME> (https:... |
"""Views for bootcamp applications"""
from collections import OrderedDict
import re
from django.db.models import Count, Subquery, OuterRef, IntegerField, Prefetch, Q
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from django_filters.rest_framework import DjangoFilterBacken... |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from .. import models
from .. import utils
# pour les vues
from . import export_base
from ..models import Ope_titre, Compte
from ..utils import Excel_csv
from .. import widgets as gsb_field
class Export_view_csv_base(export_base.ExportViewBase):
def e... |
__source__ = 'https://leetcode.com/problems/shortest-path-visiting-all-nodes/'
# Time: O(2^N * N)
# Space: O(2^N * N)
#
# Description: Leetcode # 847. Shortest Path Visiting All Nodes
#
# An undirected, connected graph of N nodes (labeled 0, 1, 2, ..., N-1) is given as graph.
#
# graph.length = N, and j != i is in the... |
#PID controller
from controller import Robot
from controller import LED
# create the Robot instance.
robot = Robot()
# get the time step of the current world.
timestep = int(robot.getBasicTimeStep())
#declare motor list
motor_list = ['front_right_wheel','front_left_wheel',
'rear_right_wheel','rear_left... |
import xlrd,time,random,os
from aip import AipSpeech
from pydub import AudioSegment
from pydub.playback import play
AudioSegment.converter = os.getcwd() + '/ffmpeg.exe'
APP_ID = '25322432'
API_KEY = 'fUneEWdu6CtTdv8qgbnoCUjH'
SECRET_KEY = '<KEY>'
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
word_all_copy = []
word_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/11/8 11:24
# @Author : bxf
# @File : TIME_TASK_OPT.py
# @Software: PyCharm
import requests
from model.util.newID import *
from model.util.PUB_RESP import *
'''
执行数据:
{"task_id":"TASK_181105000054","plugin_id":"P-1810160012","exe_type":2,... |
# A very simple Flask Hello World app for you to get started with...
from flask import Flask, request, render_template
import requests
import json
from vk_header import u_header
from urls import get_group_members_url, get_user_url, wall_post_delete_url, u_message_send_url, message_send_url
import os
import re
mod... |
import sys
import json
from python_input.geometry import np, WEST, SOUTH, EAST, NORTH, CENTER
from python_input.Collatz_inputter import get_edge, get_edge_v, init_json_dict, \
get_edges_write_word_then_move, string_to_colors, pos_to_serlist
def get_rule_110_router_module_edges_north_pole(bit, starting, length_par... |
#!/usr/bin/env python
import getopt, hashlib, math, os, shutil, sys, time
import ConfigParser, pickle
class File(object):
def __init__(self, path, filename):
self.path = path
self.filename = filename
self.localModified = None
self.remoteModified = None
self.hash = None
self.removed = False
self.partial... |
import os
from os.path import dirname, join, basename, exists
from typing import List, Tuple, Callable, Union
import itertools
import numpy as np
import pandas as pd
from tqdm import tqdm
from PIL import Image, ImageDraw
from openslide import OpenSlide
from ._functional import (
get_thumbnail,
get_downsamples... |
import json
import numpy as np
import copy
import warnings
import pycocotools.mask as maskutils
import torch
class Polygon(object):
"""
Polygons that represents a single instance of an object mask.
Args:
width, height (int): width and height of the image, in pixels.
category (int): value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.