text stringlengths 3.07k 22.1k |
|---|
__Author__ = "<NAME>"
__Project__ = "Construct Data"
__Created__ = "01/11/2018"
__all__ = ['make_data_square']
import numpy as np
import pandas as pd
from warnings import warn
def make_data_square(trade_dataframe=None,
imp_var_name: str = "importer",
exp_var_name: str = "exp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 13:20:48 2019
@author: asabater
"""
from PIL import Image
import numpy as np
from yolo3.model import preprocess_true_boxes
def rand(a=0, b=1):
return np.random.rand()*(b-a) + a
import cv2
# Perform data augmentation over an annotation lin... |
"""This module provides secure versions of common mathematical statistics functions.
The module is modeled after the statistics module in the Python standard library, and
as such aimed at small scale use ("at the level of graphing and scientific calculators").
Functions mean, median, median_low, median_high, and m... |
import sys
sys.path.insert(0, '')
import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
from .utils import import_class, count_params
from .ms_gcn import MultiScale_GraphConv as MS_GCN
from .ms_tcn import MultiScale_TemporalConv as MS_TCN
from .ms_gtcn import SpatialTemporal_MS_GCN, UnfoldT... |
__author__ = '<NAME>'
"""
Submitted by: <NAME>
i.d: 318013356
date: 25.03.2020
"""
from copy import deepcopy
import random
import argparse
import traceback
random.seed(30)
# ## Reed Solomon error correction
class ReedSolomon:
# Galois fields
# -- exponents (anti-logarithms)
__GFEXP = [0] * 512
# -- l... |
#!/usr/bin/env python
# pylint: disable=no-value-for-parameter
import click
from decimal import Decimal
import time
import math
from datetime import datetime
from tfchainbalances import unlockhash_get
import stellar_sdk
import requests
FULL_ASSETCODES = {
"TFT": "TFT:GBOVQKJYHXRR3DX6NOX2RRYFRCUMSADGDESTDNBDS6CDV... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. 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/LI... |
from collections import Mapping, Hashable
from operator import add
import pytest
from pyrsistent import pmap, m, PVector
import pickle
def test_instance_of_hashable():
assert isinstance(m(), Hashable)
def test_instance_of_map():
assert isinstance(m(), Mapping)
def test_literalish_works():
assert m() is... |
import discord
import os
from discord.ext import commands
from AVARON_func import *
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
CHANNEL_ID = 706355172301078577
STATUS_CHANNEL_ID = 707196746824024074
@bot.event
async def on_ready():
"""起動時に通知してくれる処理"""
print('ログ... |
#!/usr/bin/env python
import sys
import serial
import time
import os.path
import cv2 as cv
import numpy as np
# load image
def load(file):
img = cv.imread(file, 1)
return cv.GaussianBlur(img, (11, 11), 5)
# black image at the size of im
def black(im):
return np.zeros(im.shape[0:2], np.uint8)
# taken f... |
import os
from robustness import datasets, model_utils
from torchvision import models
from torchvision.datasets import CIFAR100
import torch as ch
from . import constants as cs
from . import fine_tunify
from .custom_models.vision_transformer import *
pytorch_models = {
'alexnet': models.alexnet,
'vgg16': mod... |
#!/usr/bin/env python3
"""Provides the ability to find IPv4 ASCOM Alpaca servers on the local networks.
Uses the netifaces library to find the broadcast IPs that can be used for
sending the UDP discovery message.
Note that I've chosen to omit support for IPv6 because I don't need it for
testing Tiny Alpaca Server.
T... |
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
import sys
import cv2
import math
from sklearn.metrics import accuracy_score, f1_score
class ClassifyEnv(gym.Env):
"""Classification as an unsupervised OpenAI Gym RL problem.
Includes scikit-learn digits d... |
#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import time
global_server_list = ['172.16.17.32', '192.168.127.12', '172.16.58.3', '172.16.58.3', '172.16.58.3', '192.168.127.12', '192.168.3.11', '192.168.127.12', '172.16.58.3', '172.16.31.10', '172.16.58.3', '192.168.3.11', '192.168.3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 The FATE 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/licens... |
#Copyright 2020 ModEngineer
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, softwa... |
import sys
sys.path.append('./scripts')
from scripts.ExpStats import runExpWithName
from scripts.Nader import genSourceExp, runOnlyNader
from scripts.Nader import runNader
from scripts.ResultPresenter import genFig5, genFig9, genFig8
import subprocess
import os
import filecmp
import shutil
import argparse
from tqdm.aut... |
from import_export import resources
from import_export.admin import ImportExportActionModelAdmin
from django import forms
from django.conf.urls import url
from django.contrib import admin
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import... |
import colorsys
import json
import socket
import logging
from enum import Enum
from .decorator import decorator
from .flow import Flow
MUSIC_PORT = 37657
_LOGGER = logging.getLogger(__name__)
@decorator
def _command(f, *args, **kw):
"""
A decorator that wraps a function and enables effects.
"""
self... |
"""spin-weight harmonic transform module
This module has benefited from pre-existing work by <NAME>
"""
from __future__ import print_function
import os
import numpy as np
import pyfftw
from lenspyx.shts import fsht
from lenspyx import utils
def vtm2map(spin, vtm, Nphi, pfftwthreads=None, bicubic_prefilt=False, ... |
# Third-party
import astropy.units as u
import numpy as np
from scipy.signal import argrelmin
# Project
from . import PhaseSpacePosition, Orbit
__all__ = ['fast_lyapunov_max', 'lyapunov_max', 'surface_of_section']
def fast_lyapunov_max(w0, hamiltonian, dt, n_steps, d0=1e-5,
n_steps_per_pullbac... |
'''
FILE: main.py
PURPOSE: Main class -- maps the controller to the URL
MODIFIED: 6 March 2014
AUTHOR: <NAME>
'''
from google.appengine.api import urlfetch
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.api.images import get_se... |
from re import search
import botocore.exceptions
from functools import lru_cache
from workdocs_dr.aws_clients import AwsClients
from workdocs_dr.document import DocumentHelper
class WdFilter:
def __init__(self, userquery=None, foldernames=[], folderpattern=None) -> None:
self.userquery = userquery
... |
import random
from random import randint
import networkx as nx
import math
import matplotlib.pyplot as plt
import Evaluation as eval
#This is local search heuristic Simulated Annealing.
def anneal_DS(old_solution, allocated_network_topology):
#This is algortihm 9 - Optimize DDS placement
#print('----------SA-----... |
# -*- coding: utf-8 -*-}
import json
import logging
import urllib
import jwt
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from thorn.app_auth import requires_auth, requires_permission
from flask import request, current_app, Response
from flask_restfu... |
import math
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def grayscale(img):
"""Applies the Grayscale transform
This will return an image with only one color channel
but NOTE: to see the returned image as grayscale
(assuming your grayscaled image is cal... |
"""
celeste_bot.py
"""
import requests
import re
from time import sleep
from datetime import datetime
from typing import Callable
from enum import IntEnum
from data_models import CelesteGameVersion, Credentials, CelesteGames
from random import randint, random
from requests.models import Response
from urllib.parse impo... |
"""Errors for the binobj package."""
import typing
from typing import Any
from typing import Iterable
from typing import Optional
from typing import TypeVar
from typing import Union
import more_itertools as m_iter
from binobj.typedefs import FieldOrName
from binobj.typedefs import StructOrName
if typing.TYPE_CHECK... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created 2022
@author: <NAME>
"""
from Levenshtein import distance as levenshtein_distance
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
print('Now Executing Trastuzumab Train/Val/Test Splitting...')
"""
This script serv... |
from text_classification import generate_model, model_validation
from modify_dataset import modify_dataset_and_raw_data_with_percentage_size_to_keep
from modify_dataset import modify_dataset_select_features
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import Comp... |
""""""
import os
import re
import sys
import readline
try: # pragma: no cover
from urllib import urlretrieve # NOQA
except ImportError: # pragma: no cover
# PY3K
from urllib.request import urlretrieve # NOQA
import tempfile
from zipfile import ZipFile, is_zipfile
readline # make pyflakes happy, readli... |
# Copyright (c) 2013 Red Hat, 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 writ... |
import logging
import tkinter as tk
import traceback
from thonny import get_workbench
from thonny import jedi_utils
tree = None
class BaseNameHighlighter:
def __init__(self, text):
self.text = text
self._update_scheduled = False
def get_positions_for(self, source, line, column):
rai... |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ classifiers.py ]
# Synopsis [ 'Naive Bayes' and 'Decision Tree' training, testing, and tunning functions ]
# Author [ <NAME> (Andi611) ]
# Copyright [ Copyl... |
from datetime import timedelta
from typing import Any, Dict, Optional, Sequence
from physlearn.names import DataBaseName, LabelType, NonSignalDataType, SignalType
from physlearn.typing import Array
class Signal:
"""A signal base class.
Args:
start_time: The time from the beginning of the record until ... |
# Copyright 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 16:54:42 2017
@author: Xiaobo
"""
import numpy as np
from mpi4py import MPI
import commands
import os
import sys
path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(path)
#sys.path.append('/Users/Xiaobo/git/CloudMerge/CloudMerge/cl... |
#<NAME>
#Purdue University
#Email: <EMAIL>
#DESCRIPTION: Code written to isolate the magnitudes of harmonics of a
#given f_0 for a given audiofile/stimulus.
#Additional Dependencies: scipy, numpy, matplotlib
# pip3 install scipy
# pip3 install numpy
# pip3 install matplotlib
#May require ffmpeg on Ubuntu/Linux as we... |
import numpy as np
from math import inf as infinity
from itertools import product
from collections import defaultdict
import random
import time
# Initializing the Tic-Tac-Toe environment
# Three rows-Three columns, creating an empty list of three empty lists
state_space = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ... |
"""python 3.7+
Run allele stage2_var_obj methods.
<NAME> 2019-2022
"""
import sys
import os
import exceptions
from run_scripts.tools import run_mash_screen, create_dataframe, \
apply_filters, create_csv, get_variant_ids
def sort_genes(gene, stage2_var_obj, allele_or_gene, session):
"""
Main r... |
import shutil
import sys
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Tuple
import pytest
import hesiod.core as hcore
from hesiod import get_cfg_copy, get_out_dir, get_run_name, hcfg, hmain
from hesiod.core import _parse_args
def test_args_kwargs(base_cfg_dir: Path, sim... |
import torch
import torch.nn as nn
from . import common
from .utils import register_model
from .. import SR_conv_init
from ..layerwise_model import LayerWiseModel
@register_model
def Plain_layerwise(in_nc=3, n_feats=50, nf=None, widths=None, num_modules=16, out_nc=3, scale=4, tail='easy',
mean_sh... |
import numpy as np
import librosa
import json
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys
sys.path.append('vggish/')
from math import pi
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import OneHotEncoder
import pickle
import xgboost as xgb
from scipy.fftpack import fft, hilb... |
import torch
from torch import Tensor
from .optimizer import Optimizer, required
from typing import List, Optional
class SGD(Optimizer):
r"""Implements stochastic gradient descent (optionally with momentum).
.. math::
\begin{aligned}
&\rule{110mm}{0.4pt} ... |
__author__ = 'antonellacalvia'
import AST as Tree
def constantsPass(tree, funcs):
vars = {}
def run(n, pos= 0, name= ""):
for iter in range(len(n.nodes)):
i = n.nodes[iter]
if not n.isEnd():
run(i, iter, i.name if type(i) in [Tree.FuncBraceOpen, Tree.FuncBody] o... |
#!/usr/bin/env python3
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import init
from tqdm import tqdm
import random
import math
import operator
import matplotlib.pyplot as plt
import numpy as np
use_cuda = torch.cuda.is_available()
cla... |
#!/usr/bin/env python3
import csv
import datetime
import os
import shelve
from time import time
import matplotlib.pyplot as plt
import numpy as np
from scipy.special import expit as activation_function # sigmoid function
from scipy.special import logit as inverse_activation_function
import wget
# CONFIG
DATA_DIR =... |
#!/usr/bin/env python2.7
import numbers
from operator import itemgetter
import math
import xxhash_cffi as xxhash
import socket
import numpy as np
import sys
import numpy
from scipy import stats
import dpkt
import time
import argparse
from datetime import datetime
VERBOSE_ITEM = "1112.238.162.249"
def hll_rank(has... |
"""
This module defines some plotting functions that are used by the
BALTO GUI app. It should be included in the same directory as
"balto_gui.py" and the corresponding Jupyter notebook.
"""
#------------------------------------------------------------------------
#
# Copyright (C) 2020. <NAME>
#
#-------------------... |
#!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# 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.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual s... |
#!/usr/bin/env python3
# pylint: disable=logging-not-lazy,subprocess-popen-preexec-fn,consider-using-with
import argparse
import logging
import os
import re
import shutil
import signal
import subprocess
import tempfile
import time
from typing import List, Optional
import requests
MODULE_NAME = 'sample_metadata'
LOCAL... |
import sys
from os import path
import PySimpleGUI as _sg
from .. import __version__, USE_DUMMY_SENSOR
from .._lib.misc import find_calibration_file
from .._lib.udp_connection import UDPConnection
from .._lib.types import PollingPriority
from . import settings
from ._run import run as _gui_run
def _group(title, obje... |
#
# -*- coding: utf-8 -*-
#
# This file is part of reclass
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import itertools as it
import operator
import pyparsing as pp
from six import iteritems
from six... |
from struct import unpack
from supyr_struct.field_type_methods import *
from reclaimer.constants import *
def tag_cstring_parser(self, desc, node=None, parent=None, attr_index=None,
rawdata=None, root_offset=0, offset=0, **kwargs):
"""
"""
assert parent is not None and at... |
import itertools
import logging
import re
from functools import reduce
from math import ceil, floor, log
from typing import Union, Any, Dict, Callable, List, Optional
import datetime
from checkov.terraform.parser_functions import tonumber, FUNCTION_FAILED, create_map, tobool, tostring
"""
This file contains a custom ... |
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, copysign
from scipy.optimize import brenth
from scipy.optimize import fsolve,fmin_l_bfgs_b,fmin_cg,fminbound
"""
sign of the number
"""
def sign(x):
if x==0:
return 0
else:
return copysign(1,x)
"""
if function f can't b... |
# Routine to calibrate the image frames of Halpha for estimation of
# absolute flux of net emission line by using line and continuum image
# frames of standard objects and program objects.
import os.path
import numpy as np
from scipy import interpolate
from scipy.optimize import curve_fit
import matplotlib.pyplot a... |
# 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... |
#!/usr/bin/env python3
# -+-coding: utf-8 -+-
#--------------------------------------------
# Authors: <NAME> <<EMAIL>>
#
#--------------------------------------------
# Date: 05.09.19
#--------------------------------------------
# License: BSD (3-clause)
#--------------------------------------------
# Updates
#-----... |
"""
script to create pandas Dataframes with all results from multiple runs of the EQL stored inside.
"""
__author__ = "<NAME> (GMi)"
__version__ = "1.2.0"
__date__ = "07.09.2020"
__email__ = "<EMAIL>"
__status__ = "Development"
import numpy as np
#from matplotlib import pyplot as plt
import pandas
import sympy
i... |
"""High-level sound and video player."""
from __future__ import print_function
from __future__ import division
from builtins import object
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# All rights reserved.
#
# Redistribution and use in source ... |
# coding=utf-8
import traceback
import h5py
import skimage.transform
from keras.utils import Sequence
import numpy as np
import cv2
import glob
import pandas as pd
import os
from kf_util import flip_axis
def rgbf2bgr(rgbf):
t = rgbf*255.0
t = np.clip(t, 0.,255.0)
bgr = t.astype(np.uint8)[..., ::-1]
return bgr
d... |
import tweepy
import logging
import time
from newsplease import NewsPlease
from newspaper import Article
from newspaper import fulltext
import requests
from lxml import html
import requests
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
# text to image
import numpy as np
import textwrap
impo... |
# coding=utf-8
# Copyright 2021 The Google Research 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... |
"""This file defines the model."""
import logging
import numpy as np
import tensorflow as tf
from dan.losses import get_adv_losses
from dan.utils import load_component
LOGGER = logging.getLogger(__name__)
def get_l2_norm(tensor):
"""Return the l2 norm of a tensor."""
return tf.sqrt(1e-8 + tf.reduce_sum(
... |
# Copyright The PyTorch Lightning team.
#
# 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... |
import os
import pytest
from lib.clients.GcpClient import GcpClient
from lib.clients.BaseClient import BaseClient
from unittest.mock import patch
from googleapiclient.http import HttpRequest
from googleapiclient.model import JsonModel
from googleapiclient.http import HttpMock
from google.cloud.exceptions import NotFoun... |
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.utils.translation import get_language_bidi
__all__ = ['ChosenWidgetMixin', 'ChosenSelect', 'ChosenSelectMultiple',
'ChosenGroupSelect', 'DateWidget', 'RelatedFieldWidgetWrapper',
'TimeWidget', 'SplitDateTime', 'ArrayFieldS... |
"""This module defines the DataSeries class, the elementary data structure of ixdat
An ixdat DataSeries is a wrapper around a numpy array containing the metadata needed
to combine it with other DataSeries. Typically this means a reference to the time
variable corresponding to the rows of the array. The time variable i... |
import cv2
import sys, os, glob, re
import json
from os.path import join, dirname, abspath, realpath, isdir
from os import makedirs
import numpy as np
from shutil import rmtree
from ipdb import set_trace
from .bench_utils.bbox_helper import rect_2_cxy_wh, cxy_wh_2_rect
def center_error(rects1, rects2):
"""Center e... |
from _token import Token, get_chars_of, get as get_tgi, get_tokens_by_replies as get_ttr, get_eof_token, get_token_by_priority as get_ttp, max_prio
from _constant import DIGITS
from _error import IllegalCharError, InvalidSyntaxError, RTError
from _node import NumberNode, BinOpNode, UnaryOpNode
from _value_type import N... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
import copy
import pickle
import random
import os
import torch
import torch.nn.functional as F
import torch.distributed as dist
import numpy as np
from torch.autograd import Variable
from gym.spaces import Discrete, Box
import ped_env
import rl
from rl.utils.miscellaneous import str_key
def set_dict(target_dict, v... |
"""
course_catalog tasks
"""
import logging
from datetime import datetime
import celery
import rapidjson
import requests
import boto3
from django.conf import settings
from django.contrib.auth.models import User
import pytz
from course_catalog.utils import load_course_blocklist
from course_catalog.constants import Plat... |
# -*- coding:utf-8 -*-
import hashlib
import hmac
import time
try:
from urllib import quote # Python 2.X
except ImportError:
from urllib.parse import quote # Python 3+
from functools import reduce
import json
import base64
import requests
import random
class Sts:
secret_id = None
secret_key = None
... |
import os
import time
from collections import deque
import numpy as np
import tensorflow as tf
from ppo2 import explained_variance, mean_or_nan, swap_and_flatten
from utils import loghandler
from utils.distributions import CategoricalPdType
"""
Implementation of Advantage Actor Critic (A2C):
Advantage Actor Cri... |
# Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
# Date: October 20, 2011
"""
This is the blade_platform module which deals with the environment
variable.
"""
import os
import subprocess
import configparse
import console
from blade_util import var_to_list
class BuildArch... |
import asyncio
import datetime
import discord
from discord.ext import commands
import constants
from utils import confirm, get_user
class Infraction:
def __init__(self, points: int, reason: str, timestamp: datetime.datetime, mod_id: int):
self.points = points
self.reason = reason
self.ti... |
import os
import pickle
import random
import warnings
from copy import deepcopy
import fire
import torch
from gpytorch.utils.warnings import NumericalWarning
from sim_helpers import fit_outcome_model, run_one_round_sim
from test_functions import problem_setup
warnings.filterwarnings(
"ignore",
message="Could... |
#!/usr/bin/env python3
# Python application to add a Bluetooth Current Time Service to a Linux Bluez
# server. Connection to Bluez is using DBus. Adapted from the HRS and Battery
# GATT server example.
import dbus
import dbus.exceptions
import dbus.mainloop.glib
import dbus.service
import logging
try:
from gi.r... |
'''
analysis
~~~~~~~~
This module collects all useful functions to be used
by the worker when performing a fuzzing analysis
'''
import os
import random
import string
from config import Config
import logging as logger
import time
import worker_timeout as wt
import shutil
import seeds_generator as sg
import ast
import ... |
import asyncio
import logging
import typing
import urllib.parse
import sprockets.mixins.http
import tornado.web
import yarl
from imbi import errors, models, version
def generate_key(project: models.Project) -> str:
"""Generate a SonarQube project key for `project`."""
return ':'.join([project.namespace.slug... |
import os
import numpy as np
import json
import random
from PIL import Image
from PIL import ImageDraw
import torch
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
class DatasetBase(Dataset):
"""Base dataset for VITON-GAN.
"""
def __init__(self, opt, mode, data_... |
import mmcv
import numpy as np
import pytest
from os import path as osp
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet3d.datasets.pipelines import (LoadAnnotations3D, LoadPointsFromFile,
LoadPointsFromMultiSweeps)
def test_load_points_from_indoor_file():
sun... |
from __future__ import print_function
from os import system
from time import sleep
# system = print
# sleep = print
'''
3 MT, 2 MW, 3 MC
'''
num_reps = 3
num_thread = 64
shard_modes = [True, False]
multi_gets = [1, 3, 6, 9]
def start_vms():
print("starting VMs")
for i in range(1, 9):
print("Starting ... |
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.models.programdb.mission.mission_integration_test.py is part of The RAMSTK
# Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for testing Mission module... |
#!/usr/bin/env python3
import os
import sys
import argparse
import operator
import math
import numpy as np
parser = argparse.ArgumentParser(description='Process output of Kraken run on contigs.')
parser.add_argument('-c','--contig', default="", help='per-contig output from Kraken')
parser.add_argument('-r','--report'... |
#!/usr/bin/env python
"""Training on a single process."""
import os
import shutil
import torch
from onmt.inputters.inputter import build_dataset_iter, \
load_old_vocab, old_style_vocab, build_dataset_iter_multiple, make_tgt, reload_news_fields
from onmt.inputters.news_dataset import load_pretrained_tokenizer
from... |
import pickle
import numpy as np
import pytest
import pandas as pd
from copy import deepcopy
from veritastool.metrics.modelrates import *
from veritastool.model.model_container import ModelContainer
from veritastool.fairness.customer_marketing import CustomerMarketing
import sys
sys.path.append("veritastool/examples/cu... |
import pygame
from data.troops import *
from data.defenses import *
from data.attack_levels import *
import math
WIDTH = 800
HEIGHT = 600
state = 0
level = 0
totalDamageDone = 0
totalDamageTaken = 0
class Table:
def __init__(self,width,height):
self.width=width
self.height=height
self.ca... |
NO_ERROR = 0
MISTAKE = 1
FIXED_MISTAKE = 2
CHEAT = 3
ACROSS = 0
DOWN = 1
def make_hash(data):
try:
from hashlib import md5
m = md5()
except:
import md5
m = md5.new()
m.update(data)
return m.hexdigest()
class BinaryFile:
def __init__(self, filename=None):
if... |
import pickle
import json
import reparse_utils
from utils import *
import os
import math
import datetime
import json
import security_utils
'''
Utilities to deal with IO-Operations. This includes writing the final data to a GEOJSON file.
'''
def dump_to_file(arr, filename):
with open(filename, 'wb') as fp:
... |
"""
Module for shapefile resampling methods.
This code was originailly developed by <NAME>.
(https://github.com/basaks)
See `uncoverml.scripts.shiftmap_cli` for a resampling CLI.
"""
import tempfile
import os
from os.path import abspath, exists, splitext
from os import remove
import logging
import geopandas as gpd
im... |
import json
from datetime import timedelta
from enum import Enum, unique
from insomniac.database_engine import *
from insomniac.utils import *
FILENAME_INTERACTED_USERS = "interacted_users.json" # deprecated
FILENAME_SCRAPPED_USERS = "scrapped_users.json" # deprecated
FILENAME_FILTERED_USERS = "filtered_users.json"... |
#!/usr/bin/env python3
import logging
import os
import subprocess
import time
import yaml
# Common utils
def run_check_process(cmd: str, **kwargs) -> None:
env = os.environ.copy()
env = {**env, **kwargs}
subprocess.run(
cmd.split(),
check=True,
stdout=subprocess.DEVNULL,
... |
from ..core import CommandSuite
from ..args import Arg
from ..utils import DBView, sanitize, getname
import discord
import asyncio
import time
import os
import json
def sanitize_channel(name):
return sanitize(name, '~!@#$%^*-<>', '_').rstrip()
PARTY_DURATION = 86400 # 24 hours
Parties = CommandSuite('Parties')
... |
#!/usr/bin/python3
#
#Thames - A software to scrape the internet to identify the themes of websites built on WordPress.
#Author - <NAME> (Twitter - badbit0)
from threading import Thread
from os import path
import requests
import json
import re
import time
import sys
import os
import argparse
#tic = tim... |
import os
import h5py
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import svm
import Models.PrepareData as PD
import SignalExtractor.graph_plots as gp
#iterate through signal events
#figure out how to get accuracy of predictions
#files needed bed file sam file
def get_locations(sam_locs,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.