text stringlengths 3.07k 22.1k |
|---|
import os
import ast
import pandas as pd
import numpy as np
from datetime import datetime
import time
import logging
level_config = {'debug': logging.DEBUG, 'info': logging.INFO}
FILE_SIZE = 500
BYTES_PER_PKT = 1500.0*8
MILLISEC_IN_SEC = 1000.0
EXP_LEN = 1000 # millisecond
class Metric:
def __init__(self,name... |
# Lanczos interpolation implementation adapted from
# https://github.com/sanghyun-son/bicubic_pytorch/
import math
import typing
import torch
from torch.nn import functional as F
__all__ = ['imresize']
_I = typing.Optional[int]
_D = typing.Optional[torch.dtype]
def cubic_contribution(x: torch.Tensor, a: float = -0... |
import codecs
from subprocess import call
import os
import json
import datetime
from datetime import date, timedelta
import sys
import calculator
# If key 'month_from' don't exist in data['jira-timesheet'] then we set last month in its place
# Configuration class
class Config:
_data = None
# I... |
import numpy as np
import pandas as pd
import multiprocessing as mp
import itertools
import time
from collections import Counter
import dynamic_refugee_matching.flowgen as flg
import dynamic_refugee_matching.assignment as dfa
import dynamic_refugee_matching.evaluate as evl
from dynamic_refugee_matching.utilities import... |
''' Unit tests for utils
'''
import collections
import numpy as np
import nose.tools
import mir_eval
from mir_eval import util
def test_interpolate_intervals():
"""Check that an interval set is interpolated properly, with boundaries
conditions and out-of-range values.
"""
labels = list('abc')
in... |
import numpy as np
import pandas as pd
from sklearn.pipeline import make_union
from suricate.dftransformers import ExactConnector, \
VectorizerConnector, DfApplyComparator, DfTransformerMixin, cartesian_join, Indexer, DfVisualSbs
from suricate.data.base import ix_names
from suricate.data.foo import getsource, gett... |
from __future__ import unicode_literals
from collections import OrderedDict
import datetime
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import Generi... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... |
"""
SAM and BAM-related constants and functions.
"""
import pysam
from riboviz import utils
PG_TAG = "PG"
""" SAM file ``PG`` (program) tag. """
SAM_EXT = "sam"
""" SAM file extension. """
BAM_EXT = "bam"
""" BAM file extension. """
BAI_EXT = "bai"
""" BAI file extension. """
SAM_FORMAT = "{}." + SAM_EXT
""" SAM file ... |
#!/usr/bin/env pytohn2
import numpy as np
from sklearn.model_selection import train_test_split
import sklearn.metrics
from data_handling import parse_data
import misc_tools
import settings
def skyline_pianorolls(input, onset=True):
"""
Perform the skyline algorithm on *pianoroll*. This just takes the
hig... |
# The MIT License (MIT)
#
# Copyright (c) 2019 <NAME> Winterbloom
#
# 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... |
import sys
import os
import time
import tqdm
import shelve
import argparse
import skimage.io
from torchvision import transforms
from collections import defaultdict
from pathlib import Path
import torch
import matplotlib
import numpy as np
from PIL import Image
import model.model as module_arch
from data_loader import ... |
from statistics import linear_regression
import numpy as np
from PIL import Image
import sys
from pathlib import Path
import os
import math
PATH = Path(sys.argv[1])
tileSize = int(sys.argv[2])
designDBUs = {
"8t1" : ((0, 390800), (0, 383040)),
"8t2" : ((0, 1301600), (0, 1148360)),
"8t3" : ((0, 1977170), (0, 141002... |
import asyncio
import functools
import inspect
import logging
import signal
import sys
import time
from concurrent.futures import thread
from datetime import datetime
from datetime import timedelta
from datetime import timezone
from datetime import tzinfo
from typing import Any
from typing import Callable
from typing ... |
#!/usr/bin/env python
########################################################################
# Threes! is a game by by <NAME>, <NAME>, <NAME>, #
# and Hidden Variable. This is created so that AI/ML strategies for #
# the game can be developed and tested easier, and is not intended as #
# a replacement of ... |
__author__ = 'benoit'
import datetime as dt
import os, sys, getopt
import hashlib
import pickle
import numpy as np
from collections import Counter
from .ui import *
from .solver import *
class Move:
def __init__(self, point, line):
self.point = point
self.line = line
def __str__(self):
... |
"""This file contains classes associated with Amino Acid and Rotamer
definitions as used by PDB2PQR.
Authors: <NAME>, <NAME>, <NAME>
"""
import copy
import re
from xml import sax
from . import structures
from . import residue
class DefinitionHandler(sax.ContentHandler):
"""Handle definition XML file content."""... |
from pathlib import Path
from shlex import split
from contextlib import contextmanager
import sys, shutil, os, venv, argparse, subprocess
PYINSTALLER_BUILD_DIR = os.getenv("PYINSTALLER_BUILD_DIR", "pyinstaller-build")
PYOXIDIZER_BUILD_DIR = os.getenv("PYOXIDIZER_BUILD_DIR", "pyoxidizer-build")
NUITKA_BUILD_DIR = os.ge... |
import datetime
import random
import string
import traceback
from enum import Enum
import requests
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.html import format_html... |
from datetime import datetime
import logging as logg
import telegram
from django.apps import apps
from django.conf import settings
from django.urls import reverse
from telegram import User, Chat, TelegramError, Message
from telegram.ext import DispatcherHandlerStop
from telegram.utils.helpers import escape
import tel... |
from logging import getLogger
from allauth.socialaccount.models import SocialAccount
from core.models import Course, CourseStudent, CourseWork, StudentSubmission
from users.models import CustomUser
logger = getLogger('gradify')
def import_course(course: dict, user: CustomUser):
"""
Checks if the current us... |
#!/usr/bin/env python
"""
pyxpiral.py - Pseudo-DataMatrix (de)coder.
"""
import argparse
import operator
import math
import binascii
import sys
import struct
import numpy
from PIL import Image
from math import gcd
try:
from pyxpiral import __version__
except:
from __init__ import __version__
class Pyxpiral:
... |
import time
import json
import pickle
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.firefox_binary import Fi... |
# -*- coding: utf-8 -*-
import copy
import os
import nuke
from nomenclator.symbol import OUTPUT_CLASSES, DEFAULT_EXPRESSION
import nomenclator.template
def fetch_next_version(path, pattern, token_mapping):
"""Fetch next version from scene files saved in *path*.
:param path: Path to fetch scene files from.... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Softbank Robotics Europe
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, t... |
from collections import defaultdict
from logging import basicConfig, DEBUG, INFO, getLogger
from argparse import ArgumentError
from bisect import bisect_left
from networkx import DiGraph
#from networkx.readwrite.graphml import write_graphml
from networkx.readwrite.gexf import write_gexf
from sqlalchemy.sql.functions ... |
"""Coupled Metropolis-Hastings implementation."""
import numpy as np
import scipy.stats as st
from .maximal_couplings import ReflectionMaximalCoupling
from .coupled_data import CoupledData
__all__ = ["metropolis_hastings", "unbiased_estimator"]
def _metropolis_accept(log_prob, proposal, current, current_log_prob, ... |
# -*- coding: utf-8 -*-
import os
from collections import Counter
import numpy as np
import scipy.io.wavfile as wav
from python_speech_features import mfcc
from config import Config
def get_wavs_lables():
conf = Config()
wav_files, text_labels = do_get_wavs_lables(conf.get("FILE_DATA").wav_path,
... |
__all__ = [
'CaseWhen',
'EmptyRule',
'PredictionRule',
'IsInRule',
'GreaterThan',
'GreaterEqualThan',
'LesserThan',
'LesserEqualThan',
'RangeRule',
'MultiRange',
'MultiRangeAny'
]
from typing import Union, List, Dict, Tuple
import numpy as np
import pandas as pd
from ig... |
import argparse
import os
import random
from typing import Dict, List
from imgaug import augmenters as iaa
from mrcnn import model as modellib
from mrcnn.config import Config
from maskrcnn.dataset import MaskrcnnMasksDataset, MaskrcnnViajsonDataset
# -----------------------------------------------------------------... |
import argparse
import os
import sys
import numpy as np
np.set_printoptions(threshold=sys.maxsize)
import PIL
from PIL import Image
from scipy.ndimage import label
from typing import Dict, List, Any
import pandas as pd
from tqdm import tqdm
def load_results(results_root: str, gt_class_dirs=('pos', 'neg')):
"""L... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (c) 2015, <NAME> <<EMAIL>>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above co... |
#!/usr/bin/env python
import datetime
import errno
import matplotlib
import matplotlib.pyplot as plt
import os
import shutil
import subprocess
import sys
### ADJUST THIS TO YOUR ENVIRONMENT ###
eth3d_datasets_path = '/local/home/zjiang/data/eth3d/' # the folder containing the training and test folders
evaluation_pr... |
from collections import namedtuple
from enum import Enum
import traceback
import logging
import attr
from .. import repositories, miscellaneous, services, entities
logger = logging.getLogger(name=__name__)
class MemberRole(str, Enum):
OWNER = "owner"
DEVELOPER = "engineer"
ANNOTATOR = "annotator"
AN... |
from .utils import parse_datetime
class Model(object):
@classmethod
def from_dict(cls, model_dict):
raise NotImplementedError
def __repr__(self):
state = ['%s=%s' % (k, repr(v)) for (k, v) in vars(self).items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(state))
class... |
import numpy as np
from frm_modulations import linear_mod_list,linear_mod_const
from commpy.filters import rrcosfilter
from scipy.signal import upfirdn
import scipy
from commpy.filters import rrcosfilter
from functools import lru_cache
from scipy.signal import filtfilt, firwin,lfilter, welch
max_sps = 64
(t,ps) = rr... |
import itertools
import re
import urllib.parse
from collections import Counter
from datetime import date
from itertools import groupby
from itertools import zip_longest
from typing import Any
from typing import Collection
from typing import Dict
Result = Dict[str, Any]
def decorator(func: Any) -> Any:
def wrappe... |
# from knausj_talon/code/keys.py
from talon import Module, Context, actions
import sys
debug = False
# Talon Alphabet
# letters_alphabet = " ".join([
# 'air bat cap drum each fine gust',
# 'harp sit jury crunch look made near',
# 'odd pit quench red sun trap urge vest',
# 'whale plex yank zip']).split... |
#!/usr/bin/env python
"""
Harness demo, a game example.
Tested with Python 3.4, may or may not work with Python 2!
"""
from random import randint, shuffle
from harness import Harness
game = Harness(title="pysdl2 HARNESS demo", width=240, height=240, zoom=3)
if game.has_controllers:
# use first game controller;... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates the arguments for the patch manager for LLVM."""
from __future__ import print_function
import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test suite for zcomx/modules/html/meta.py
"""
import copy
import unittest
from applications.zcomx.modules.book_types import BookType
from applications.zcomx.modules.books import Book
from applications.zcomx.modules.creators import \
AuthUser, \
Creator
from a... |
import numpy as np
from numpy import sin, cos, log
from _routines import ffi, lib
from threading import Thread, Lock
import quaternion
def basic_eval(q, a, b, c, max_iter, shape=None):
if shape is None:
for z in (q, a, b, c):
if hasattr(z, 'shape'):
if shape is None:
... |
import asyncio
import base64
import json
import os
from datetime import datetime, timedelta
from typing import Dict, List, Optional, Union
from urllib import parse as urlparse
import aiohttp
from spotify.classes import *
BASE_URL = "https://api.spotify.com/v1/"
class SpotifyClient:
"""A simple client for perfo... |
"""Evaluation server for FeatureHub user notebooks."""
# flask imports
from functools import wraps
import json
import os
import sys
from urllib.parse import quote
from flask import Flask, redirect, request, Response
import logging
# from jupyterhub.services.auth import HubAuth
from featurehub.evaluation.future import ... |
# -*- coding: utf-8 -*-
import click
from urls import IMAGES
from base_request import DigitalOcean, print_table, CONTEXT_SETTINGS
@click.group()
def images_group():
"""
images command group
"""
pass
def validate(dic, option_list):
"""
images command validation
"""
for key in dic.viewkeys():
if key in opt... |
# Copyright 2019 SiFive, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You should have received a copy of LICENSE.Apache2 along with
# this software. If not, you may obtain a copy at
#
# https://www.apache.org/licenses/LI... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# ============================================================================
# Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with th... |
import jittor as jt
from jittor import Module
from jittor import nn
# Definition of normalization layer
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-5, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os.path as osp
import sys
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
import time
import numpy as np
import argparse
from scipy import stats
import gpflowSlim as gfs
from gpflowSlim... |
from tkinter import Frame,Button,Text,Entry,Tk,StringVar,Label,END,Scrollbar
from GrandExchange import GrandExchange
import numpy as np
master = Tk()
sorttoggle = False
lastsort = 0
def showResults(sort=0):
global sorttoggle, lastsort
label3['text']='\nResults:\n'
exchange = GrandExchange.Exchange()... |
from tkinter import *
import random
import time
def ref():
x = random.randint(1000,600000)
randomref = str(x)
rand.set(randomref)
#cof = float(fries.get())
cob = float(burger.get())
c_of_cheese = float(cheese.get())
coc = float(chicken.get())
cod = float(drink.get())
#cost_of_fries... |
import numpy as np
import collections
from operator import itemgetter
np.set_printoptions(linewidth=1024, edgeitems=1000)
delta = {'N': (-1, 0), 'W': (0, -1), 'E': (0, 1), 'S': (1, 0)}
inv_delta = {v: k for k, v in delta.items()}
def distance(p1, p2):
return np.array(p2) - np.array(p1)
def manhattan_distance(p... |
from synpo.network import *
from synpo.component import *
from synpo.utils import *
import numpy as np
import time
import os
import pickle
import torch
from torch.nn.utils.clip_grad import clip_grad_norm
import random
import copy
from synpo.utils import argmax1d, extract
# Information profiling
def profile_action_val... |
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
from tensorflow.keras import Sequential
import tensorflow.keras.layers as nn
from einops import rearrange
from einops.layers.tensorflow import Reduce
def gelu(x, approximate=False):
if approximate:
coeff ... |
# -*- coding: utf-8 -*-
#
# This file is part of the SKA PST LMC project
#
# Distributed under the terms of the BSD 3-clause new license.
# See LICENSE for more info.
"""This module contains tests for the BEAM component managers class."""
import json
import logging
import time
from typing import Any, Callable, List, ... |
from __future__ import print_function
from platform import system, machine
from posix import O_RDONLY
import os
import sys
import json
from sandbox import *
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
'''
class SelectiveOpenPolicy(SandboxPolicy):
SC_open = (2, 0) if machine() == 'x86_64... |
#!/usr/bin/env python3
from pathlib import Path
import cv2
import depthai as dai
import numpy as np
import time
import argparse
test_network = 'mobilenet_1h'
test_health = 'fiveclass'
create_video = False
networks = {
'mobilenet_1h':{'path':'models/bee_detection_v2021_202104141915.blob','size':300},
... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2019-2020 CNRS
# 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 limita... |
import random
from pathlib import Path
import tempfile
import json
from typing import List, Dict, Any, Optional, Tuple
from allennlp.common.params import Params
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.vocabulary import Vocabulary
fro... |
import numpy as np
import pandas as pd
from scipy.stats import norm, percentileofscore
from tqdm.notebook import tqdm
def rv_cc_estimator(sample,n=22):
"""
Realized volatility close to close calculation. Returns a time series of the realized volatility.
sample: series or dataframe of closing prices indexed by date... |
"""This module defines functions for loading JWST's data model schema files which
describe reference parameters and their values. The schema files are used to
validate reference and rmap parameters to screen out illegal values. In particular
the resulting TpnInfo objects describe rmap constraints which are not enf... |
from tvm.tensor_graph.nn.layers import Layer, Conv3d, BatchNorm3d, ReLU, \
GlobalAvgPool3d, Linear, Sequential
from tvm.tensor_graph.nn.functional import elementwise_add
from tvm.tensor_graph.core import ForwardGraph, BackwardGraph, compute, \
GraphTensor,... |
from __future__ import unicode_literals
from decimal import Decimal
from djangotoolbox.fields import ListField
from six import string_types
import logging
from django.utils import timezone, dateparse
from tastypie.serializers import Serializer
logger = logging.getLogger(__name__)
import couchbase
from django.db impo... |
import pandas as pd
import os
import seaborn as sns
from matplotlib import pyplot as plt
from slc_hunger_risk.config import data_dir, plot_dir
from icecream import ic
pd.set_option("max_rows", 200)
pd.set_option("max_seq_items", 200)
commodities = {
"rice": "1006",
"wheat": "1001",
"wheat flour": "1101"... |
# -*- coding: utf-8 -*-
"""
@date: 2021/5/4 下午7:11
@file: torchvision_resnet_to_zcls_resnet.py
@author: zj
@description: Transform torchvision pretrained model into zcls format
first, download RepVGG repo and set env
git clone https://github.com/DingXiaoH/RepVGG.git
export PYTHONPATH=$PYTHONPATH:/path/to/RepVGG
"""
i... |
"""
Core classes for autodp:
Mechanism --- A `mechanism' describes a randomized algorithm and its privacy properties.
All `mechanism's (e.g., those in the `mechanism_zoo' module) inherit this class.
Transformer --- A transformer takes one or a list of mechanism and outputs another mechanism
... |
import heapq
from .import pmxdef
class Bonegraph():
# {parent: {child: {n: {key: attr}}}}
def __init__(self):
self.edges = {}
self.preds = {}
def add_node(self, a):
if a not in self.edges:
self.edges[a] = {}
if a not in self.preds:
self.preds[a] = {... |
# (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 2000-2009 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also availabl... |
# VAE on MNIST
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
from torch.utils.data import DataLoader
import os
import numpy as np
import matplotlib.pyplot as plt
from ae import SynDataset
class VAE(nn.Module):
def __init__(self, layers, criterion):
super(V... |
from scipy.stats import wasserstein_distance
from sklearn.preprocessing import scale
from math import cos, sin
import os
import cv2
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from tqdm import tqdm
import csv
from sklearn.metrics import mean_squared_error
from sklearn.metrics impor... |
# coding: utf-8
# # DGA DETECTION MODEL
# In[1]:
# IMPORT MODULES
import pandas as pd
import numpy as np
get_ipython().magic('matplotlib inline')
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import train_test_split
from sklearn import metrics
fr... |
from twisted.trial.unittest import TestCase, SkipTest
from bl.testlib import ClockRunner, TestReactor, TestInstrument
from bl.scheduler import BeatClock, Meter, Tempo
try:
import pypm
from bl.midi import PypmWrapper, init, getInput, getOutput
from bl.midi import MidiHandler, MidiDispatcher
from bl.mid... |
# Cobalt Build System - 0.0.4
# Copyright (C) 2020, 2021 <NAME>.
# This project is licensed under MIT License (See LICENSE.md).
import os, sys, subprocess, shutil;
import json, argparse;
#################################
# Config
#################################
def_build_dir = "builddir";
def_build_file = "build.n... |
import functools
import time
import numpy as np
from .ecs import Component
from .ecs.components import Flag, IntFlag, Int, Counter, FloatComponent, String, EntityReference, EntitiesRefs
from .ecs.components import component_type
from . import flags
from .geometry import Direction, Position, Size, Rectangular, WithPos... |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
"""
Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the Apache License Version 2.0.You may not use
this file except in compliance with the License.
This program ... |
# Copyright 2016 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 required by applicable law or ag... |
import datetime
from dateutil.relativedelta import relativedelta
from sqlalchemy import func, desc, and_, exists, cast, TIME
from sqlalchemy.sql import label
from app import db
from app.user_models import User
def default_dates(from_date=None, to_date=None):
dt = datetime.datetime
if not from_date:
... |
"""
This file defines the model classes that wrap PSFs from
galsim into the CatSim interface
"""
import numpy
import galsim
__all__ = ["PSFbase", "DoubleGaussianPSF", "SNRdocumentPSF",
"Kolmogorov_and_Gaussian_PSF"]
class PSFbase:
"""
This is the base class for wrappers of GalSim's PSF classes. To... |
# pytorch implementation of:
# "Reservoir Computing on the Hypersphere" - <NAME> arXiv:1706.07896
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
import re
import pickle
import time
from random import shuffle
from pytorch_tools import to... |
import argparse
import os
import pandas as pd
import tez
import transformers
import numpy as np
import random
import torch
import itertools
from sklearn import metrics
import transformers
from transformers import AdamW, get_linear_schedule_with_warmup
import torch.nn as nn
from torch.optim.lr_scheduler import LambdaLR
... |
from pylibdmtx.pylibdmtx import decode, encode
import cv2
import numpy as np
import sys
import time
import os
from PIL import Image
####################################################################################################
def readingDecode():
#* empty function to pass to
def empty(a):
... |
import face_embedding
import argparse
import cv2
import os
import sys
import datetime
import time
import pickle
import numpy as np
import mxnet as mx
import sklearn
from sklearn.cluster import DBSCAN
from essh_detector import ESSHDetector
from mtcnn_detector import MtcnnDetector
import face_preprocess
parser = argpar... |
import cv2
import numpy as np
import random
import math
import copy
class Node(object):
def __init__(self, pos):
self.pos = pos
self.neighbors = []
self.g = float('inf')
self.h = float('inf')
self.f = float('inf')
self.p = None
class PRM(object):
def __init__(... |
#! /usr/bin/python3
"""
File: IPsearchWithinACpolicy.py
Usage: is a python script that makes use of the requests
module to search within an Access Control Policy for a specified IP.
./IPsearchWithinACpolicy.py [-h] [-u USERNAME] [-p PASSWORD] [-f FMC] [-i SEARCH] [-e] [-c]
python3 ./IPsearchWithinACpolic... |
import os
import random
from typing import List, Dict
import networkx as nx
import numpy as np
from routing.LND_routing import get_route
from utils.common import LND_DEFAULT_POLICY
from utils.common import calculate_route_fees, get_new_position_for_agent_node
from utils.visualizers import visualize_graph_state
def ... |
# Copyright 2019 The University of Toledo
#
# 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... |
'''A module containing functions that allow one to scrape data from
the Bestiary pages of d20pfsrd.com and place it in a database'''
import argparse
import traceback
from lxml.html import parse
from core.builders.creature.d20pfsrd import build as d20_build
from core.builders.creature.dict import build as dict_build
... |
from experiments import (
plot_evolution_of_density,
plot_evolution_of_velocity,
plot_measured_viscosity_vs_omega,
plot_couette_flow_evolution,
plot_couette_flow_vel_vectors,
plot_poiseuille_flow_vel_vectors,
plot_poiseuille_flow_evolution,
plot_parallel_von_karman_vortex_street,
x_s... |
import constants as const
from config import SkynetConfig
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from gamestate import GameState
#ok, let it all be simple
game = GameState()
def gatekeeper(bot, update):
if not game.initiated:
game.initiated = True
game.progress[0... |
# -*- coding: utf-8 -*-
# Copyright 2017-present i2CAT
#
# 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... |
#!/usr/bin/python3
"""
@copyright:
Copyright (C) Mellanox Technologies Ltd. 2014-2020. ALL RIGHTS RESERVED.
This software product is a proprietary product of Mellanox Technologies
Ltd. (the "Company") and all right, title, and interest in and to the
software product, including all associated intellec... |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# pylint: disable=E1101
"""
This module deals with pixel-wise calibration for eis_prep - zero values, dark
current, hot, warm and dusty pixels.
"""
import datetime as dt
import numpy as np
from scipy.io import readsav
import locale
import heapq
from bs4 import Beautifu... |
"""Robot navigator.
Based on Patrick's RobotNavigator.
"""
import rospy
import actionlib
from actionlib_msgs.msg import GoalStatus
from geometry_msgs.msg import PoseStamped, PoseWithCovarianceStamped, Twist
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseActionResult
from nav_msgs.srv import Get... |
# Inspired by:
# Article: https://medium.com/@pierre_guillou/faster-than-training-from-scratch-fine-tuning-the-english-gpt-2-in-any-language-with-hugging-f2ec05c98787
# Ipynb:https://colab.research.google.com/drive/1B3rgV5maqb-5ZabRBm9eN4wMrSQw0Uni?usp=sharing#scrollTo=XEe0F5shdOw7
# Additional resource: https://www... |
import argparse
from collections import defaultdict
from itertools import combinations
import matplotlib.pyplot as plt
from tqdm import tqdm
from typing import Dict
import pandas as pd
from scirex.evaluation_scripts.salient_bootstrap_comparison_bucketing import draw_box_plot_with_error_bars
from scirex.metrics.paired... |
import numpy as np
import torch
import torch.nn as nn
from torch.nn.modules.utils import _triple
import torch.nn.functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
import math
import os
import datetime
from matplotlib import pyplot as plt
class SpatioTemporalConv(nn.Module):
def __init__(self, ... |
"""
Test CPS and PUF data file contents.
"""
import os
import pytest
import numpy as np
def unique_recid(data, dataname):
"""
Test that RECID values are unique.
"""
recid = data['RECID']
unique, counts = np.unique(recid, return_counts=True)
recid_count = dict(zip(unique, counts))
duplicate... |
import cv2
import numpy as np
import time
import DobotDllType as dType
# Vision init
mask=None
capture=None
lastIndex = 5
# 吸盤中心點調整
X_Center = 320
Y_Center = 240
"""
<--負--Y--正-->
^
| 正
X
| 負
V
"""
# Load YOLO model
weights = "weights/yolov4-coin_last.weights"
cfg = "cfg/yolov4-coi... |
#
# Copyright 2021 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/licenses/LICENSE-2.0
#
# Unless required by appli... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sunday 16 May 2020
@author: earjba
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import chardet
import statsmodels.formula.api as smf
def substring_after(s, delim):
return(s.partition(delim)[0])
def plot(df1, d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.