text stringlengths 6.04k 39.5k |
|---|
#-- -- -- -- Python Data Science Toolbox (Part 2):
# Used for Data Scientist Training Path
#FYI it's a compilation of how to work
#with different commands.
### --------------------------------------------------------
# # ------>>>>>Iterators vs Iterables
# Let's do a quick recall of what you've learned
... |
# -*- coding: utf-8 -*-
import os
import re
import json
import requests
from . import bibliography
def bbl_to_bib(path):
context = {}
# 1. list all files
context['filenames'] = list_all_files(path, extensions=('tex', 'bbl'))
# 2. split content from bibliography
context['bbl'] = reduce(lambda x, ... |
import os
import torch
import numpy as np
import pandas as pd
from PIL import Image
from tqdm import tqdm
from collections import defaultdict
from torchvision.datasets.folder import default_loader
from torchvision.datasets.utils import download_url
from torch.utils.data import Dataset
from torchvision import transforms... |
from __future__ import division, print_function
__all__ = ["Signal", "LikelihoodError"]
from .global_imports import *
from . import global_imports
from .Data import Data
from .Instrument import Instrument, ChannelError
from .Background import Background
from .Interstellar import Interstellar
from .tools.energy_inte... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from tqdm import tqdm
from itertools import chain
from torch.nn import BCEWithLogitsLoss
from torch_geometric.data import DataLoader
from sklearn.metrics import roc_auc_score, average_precision_score
from tensorboardX import SummaryWriter
import os
from models import DGCNN
import argparse
import os.path as o... |
import json
import math
import pickle
import random
import signal
import time
import os
import threading
from joblib import Parallel, delayed
from mcts import parameters as p
from mcts import data_base
from mcts.smiles import SMILES
from mcts.node import Node
from rnn.rnn import load_model
def load_parameters_mcts(c... |
from collections import defaultdict
from datetime import date
from django.contrib.auth.decorators import user_passes_test
from django.core.serializers import serialize
from django.urls import reverse
from django.db import connection
from django.db.models import Count, Q
from django.http import HttpResponse
from django.... |
import logging
import sys
import unittest
from typing import List, Callable
from pytest import approx
from Xlib import X
from Xlib.display import Display
from Xlib.xobject.drawable import Window
from i3ipc import Connection, Event, TickEvent
logging.basicConfig(stream=sys.stdout,
format='[%(asctim... |
# -*- coding: utf-8 -*-
import boto3
from datetime import datetime
from urllib.request import urlopen
from io import StringIO, BytesIO
import io
import numpy as np
import pandas as pd
import plotly.express as px
import requests
import xml.etree.ElementTree as ET
import time
from zipfile import ZipFile
s3 = boto3.res... |
from collections import defaultdict
from itertools import count
from operator import itemgetter
from pathlib import Path
from typing import Dict, Optional
from typing import List, Tuple, Union
import htbuilder
import streamlit as st
from htbuilder import span, div, script, style, link, styles, HtmlElement, br
from htb... |
#!/usr/bin/env python3
#
# This file is part of LiteSPI
#
# Copyright (c) 2020 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: BSD-2-Clause
import argparse
import json
import os
import sys
import re
from git import Git, Repo
import progressbar
import time
from multiprocessing import Process
import subprocess
f... |
# ----------------------------
#! --- PixelPlotter 2.1 --- !
#?--- <NAME> ---?
#? CHANGE THESE VALUES TO CUSTOMIZE OUTPUT:
count = 3 # time in seconds before plotting begins
timeout = 0 # rendering timeout (0 to disable)
width = 128 # width of output image in px
tool = 'brus... |
#Import functions
import numpy as np
import h5py
import win32com.client
import os
import pandas as pd
import matplotlib.pyplot as plt
########################## GEOMETRY INPUTS ##########################
########################## HEC-RAS Options ##########################
def getLocations(fileName):
"""
... |
"""
Python 3 wrapper for identifying objects in images
Requires DLL compilation
Both the GPU and no-GPU version should be compiled; the no-GPU version should be renamed "yolo_cpp_dll_nogpu.dll".
On a GPU system, you can force CPU evaluation by any of:
- Set global variable DARKNET_FORCE_CPU to True
- Set environme... |
# coding=utf-8
# !/usr/bin/python3.6
"""
__synopsis__ : Visualize vectors in 2D using tsne.
__description__ :
__project__ : XCGCN
__author__ : <NAME> <<EMAIL>>
__version__ : ": "
__date__ : "26/06/19"
__copyright__ : "Copyright (c) 2019"
__license__ : This source code is licensed under th... |
#!/usr/bin/python3
# SPDX-License-Identifier: Unlicense
import os.path
import sys
import inspect
import datetime
template_cfg=None
replacements={}
filters={}
shortline=0
shortname='<file>'
fullname='<file>'
activeoutname='<Out>'
activeoutline=0
activedatetime=str(datetime.datetime.now().timestamp())
iserr=False
def g... |
import numpy as np
import matplotlib.pyplot as plt
from mdp import Gridworld, MountainCar
from policy_gradient_algorithms import one_step_actor_critic, proximal_policy_optimization
class Experiments:
gridworld_final_performance_episodes = 20
gridworld_actions_compare_value = 8
gridworld_y_min = 0
... |
"""pywizlight integration."""
import asyncio
import json
import logging
import socket
from time import time
from typing import Any, Dict, Tuple, Optional, Union, List
from asyncio_dgram.aio import connect as connect_dgram, DatagramStream
from pywizlight.bulblibrary import BulbClass, BulbType
from pywizlight.exception... |
# coding: utf-8
# Copyright (c) Materials Virtual Lab
# Distributed under the terms of the BSD License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import os
import abc
import io
import subprocess
import itertools
import numpy as np
from monty.tempfile import ScratchDir
f... |
from PySide6.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
import PySide6, os, shutil, webbrowser, tempfile, subprocess, sys, fileinput
import xml.etree.ElementTree as xml
import MadQt
from MadQt import Tools as Mt
# give this to users for them to create a shortcut
# https://pypi.org/proj... |
try:
from distributed_single_sentence_classification.model_interface import model_zoo
from distillation import distillation_utils
from loss import loss_utils, triplet_loss_utils
except:
from distributed_single_sentence_classification.model_interface import model_zoo
from distillation import distillation_utils
fro... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... |
# -*- coding:utf8 -*-
# File : policy_opt.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 12/08/2017
#
# This file is part of TensorArtist.
from .opr import vectorize_var_list
from tartist import random
from tartist.app.rl.utils.math import normalize_advantage
from tartist.core.utils.meta import notnone_property... |
"""
@file
@brief Function to solve the problem of the
`Route Inspection Problem <https://en.wikipedia.org/wiki/Route_inspection_problem>`_.
"""
import math
import random
import fractions
class SolutionException(Exception):
"""
wrong solution
"""
pass
def haversine_distance(lat1, lng1, lat2, lng2):
... |
#!/usr/bin/env impala-python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (... |
from datetime import date, datetime, time, timedelta, tzinfo
from typing import List
from dateutil.tz import gettz
from django.core.paginator import Paginator
from django.core.validators import MaxValueValidator
from django.db import models
from django.utils.timezone import localtime, make_aware
from constan... |
import os
import math
import torch
import random
import scipy as sp
import scipy.stats
import numpy as np
import torch.nn as nn
from PIL import Image
from alisuretool.Tools import Tools
from torch.optim.lr_scheduler import StepLR
import torchvision.transforms as transforms
from torch.utils.data.sampler import Sampler
f... |
import h5py
import numpy as np
from scipy.io import loadmat
from operator import itemgetter
import math
import scipy as sp
import cv2
import matplotlib.pyplot as plt
import os, sys
import time
import multiprocessing
import random
# Generate Observation Map
def func(theta, m, I, imax, L, w, N, anglemask):
print('... |
"""
Primary Chronostar script.
Perform a kinematic fit to data as described in Crundall et al. (2019).
Run this script with either simple argument
line inputs (call with --help to see options) or with a single input
config file. Unzip contents of config_examples.zip to see some examples.
"""
from __future__ import p... |
print('====================================================================================================')
print('== NCS 문제 1. 아래의 스크립트를 테스트해보면 x 의 원소가 out 의 원소로 변경되었을 것이다.'
'다시 테스트할 때 x 의 원소가 out 의 원소로 변경되지 않게 하려면 어떻게 해야하는가?')
print('============================================================================... |
import matplotlib as mpl
import numpy as np
import os
import matplotlib.pyplot as plt
import tkinter
import datetime
import struct
import ftplib
import glob
import tempfile
import pymongo
import requests
import sys
import scipy.signal as signal
import scipy.io.wavfile
import pywt
from unophysics import ladc, wavefu... |
import os
import numpy as np
############################################
### SET THESE VARIABLES BEFORE FIRST RUN ###
############################################
# Set mainpath to your main LIME directory (the one containing src, example, etc).
mainpath = '/path/to/limemaster/'
# Set templatepath to the direcoty wit... |
# qc.py
import dnaio
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pathlib import Path
from itertools import cycle
from itertools import islice
from fba.levenshtein import (
create_index,
query_index,
select_query
)
from fba.utils import open_by_suffix, get_logger
logger = g... |
import sqlite3
import pygame
import os
import sys
import random
import time
from Related_Files.garage_menu import fetch_all_data
from Related_Files.garage_menu import COINS
from Related_Files.garage_menu import draw_coin
pygame.init()
pygame.mixer.init()
# colors
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 2... |
# pylint default of HTC, disable some noisy messages :D
# pylint: disable=C0301,C0103,C0111
# References:
# https://github.com/polymorf/findcrypt-yara
# https://github.com/OALabs/FindYara
# -*- coding: utf-8 -*-
#==============================================================================
#
# All credit to <NA... |
import bpy
import bmesh
def _redraw_yasiamevil():
_redraw_yasiamevil.opr(**_redraw_yasiamevil.arg)
_redraw_yasiamevil.opr = bpy.ops.wm.redraw_timer
_redraw_yasiamevil.arg = dict(type='DRAW_WIN_SWAP', iterations=1)
def _limit_source(points, source_limit):
if source_limit != 0 and source_limit < len(points):
... |
# Copyright 2019 <NAME>. 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 ... |
# change_pn_spikes.py ---
# Author: <NAME>
# Created: Thu Feb 28 19:29:46 2019 (-0500)
# Last-Updated: Tue Mar 10 15:25:47 2020 (-0400)
# By: <NAME>
# Version: $Id$
# Code:
import sys
sys.path.append('/home/rays3/projects/ggn/common')
import argparse
import shutil
import os
import numpy as np
import h5py as ... |
#
# Copyright (c) 2014, 2016, 2018, 2020 LexisNexis Risk Data Management Inc.
#
# This file is part of the RadSSH software package.
#
# RadSSH is free software, released under the Revised BSD License.
# You are permitted to use, modify, and redsitribute this software
# according to the Revised BSD License, a copy of wh... |
# -*- coding: utf-8 -*-
"""Windows Registry plugin to parse the AMCache.hve Root key."""
import re
from dfdatetime import filetime as dfdatetime_filetime
from dfdatetime import posix_time as dfdatetime_posix_time
from dfdatetime import time_elements as dfdatetime_time_elements
from dfwinreg import errors as dfwinreg... |
import gc
import os
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import mean_squared_error, roc_auc_score, median_absolute_error
from termcolor import colored
from torch.optim.lr_scheduler import MultiStepLR
from torch import nn
from torch import optim
from tqdm import tqdm
fro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Matlab functions and functionality implemented in Python
"""
# __all__ = [ "units",
# "constants", "disp", "lag", "diff", "growth", "signum","vectorizer", "vectorize", "maxdiff",
# "transpose", "unitfactor",
#
# "spacing", "tan", "a... |
import vim
import re
from view import *
from utils import *
from conn import *
from change import *
#======================== Global Setup/Config ================================#
ExplorerCharOpened = u'\u25bd'
ExplorerCharClosed = u'\u25b6'
if int(vim.eval('exists("g:GeeknoteExplorerNodeOpened")')):
Explo... |
# MIT License
#
# Copyright (c) 2019 LABSS(<NAME>, <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 limitation the rights
# to use, copy, modif... |
#!/usr/bin/env python3
# whiteout.py
# Author: <NAME>
# Last Updated Jan 1, 2021
'''
A script to remove patterns in a file.
Designed with PDFs in mind.
It reads in a document as a byte string
and then tries identifying the text in
various encodings.
'''
import os
import re
import argparse
import pdftotext
from ... |
# -*- coding: ascii -*-
# STATE OF THE CODE:
#
# 1. Templates need testing.
# 2. Line number data is collected for various things.
# 3. dump() will remember comments that appear outside sections and templates.
# 4. { } delimits a section, [ ] delimits a template.
# 5. Overall, most key functionality is implemented and... |
#!/usr/bin/env python3.6
"""Estimators of flops, MACs, ACs, and energy consumption of ANN and SNN models during the inference.."""
# -- Built-in modules -- #
import csv
import os
from argparse import ArgumentParser
from datetime import datetime
# -- Third-party modules -- #
import keras_spiking
import numpy as np
im... |
#-*- coding: utf-8 -*-
import os
import json
import ssl
import click
import requests
import subprocess as _subprocess
from urllib.request import urlopen
import os.path
from utils import API_URL_BASE
from utils import get_header_basic_auth
import jinja2 as _jinja2
import shutil as _shutil
# _default_dataspine_templat... |
##
## Name: bulls.py
## Purpose: Classes representing bulletin summaries and data.
##
## Copyright (C) 2004-2006 <NAME>, All Rights Reserved.
##
## Some BlitzMail installations (notably, the original at Dartmouth
## College) provide a "bulletin" service similar to local Usenet news
## groups. The main interface to ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *********************************************************************************************************************
# load-census.py
# *********************************************************************************************************************
#
# A script for... |
import abc
from collections import defaultdict
import dataclasses
from hashlib import md5
import math
from mimetypes import types_map
import operator
import re
from typing import Any
import dask.base
from fastapi import Depends, HTTPException, Query, Response
import msgpack
import pydantic
from starlette.responses imp... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import re
import sys
import time
import zipfile
from abc import ABCMeta, abstractmethod
from collections i... |
"""
Utilities
<NAME> <<EMAIL>>
The Australian National University
Australian Centre for Robotic Vision
"""
import os
import torch
import pickle
import numpy as np
import scipy.io as sio
from tqdm import tqdm
from collections import defaultdict
from torch.utils.data import Dataset
from hicodet.hicodet import HICODe... |
# Copyright 2018 <NAME> <<EMAIL>>
#
# 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... |
#! /usr/bin/env python3
""" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
scoring the CWEs
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # """
import os, glob, sys
from importlib.machinery import SourceFileLoader
import enum, re
from besspin.base.utils.misc import *
impo... |
import logging
import multiprocessing
import unicodedata
from argparse import Namespace
from contextlib import closing
from itertools import chain, repeat
from multiprocessing.pool import Pool
from tqdm import tqdm
from transformers.tokenization_roberta import RobertaTokenizer
logger = logging.getLogger(__name__)
c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import base64
import os
import sys
import cs_methods
import helpers
from datetime import datetime
# GLOBALS/PARAMS
HOME_DIR = os.path.expanduser('~')
DIR_PATH = os.path.join(HOME_DIR, '.bulkstrike')
CRED_PATH = os.path.join(DIR_PATH, "credentials")
TOKEN_PATH ... |
# /* Copyright (C) 2010 <NAME>
# * Fixes and additional command for Ninja Pan/Tilt
# * Copyright (C) 2013,2017 <NAME>
# *
# * This program 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 v... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import gzip
import json
import time
from datetime import datetime
import networkx as nx
import warnings
warnings.filterwarnings("ignore")
import plotly.graph_objects as go
import matplotlib.pyplot as plt
from collections import Counter
import copy
#... |
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py 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 late... |
# Copyright (c) 2021. Universidad de Pinar del Rio
# This file is part of SCEIBA (sceiba.cu).
# SCEIBA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
import binascii
import json
import os
import time
from random import randint
... |
import math
import numpy as np
import torch
import torch.nn as nn
from dataloader import *
D_MODEL = 512 # 词向量维度
D_FF = 2048 # 全连接层维度
D_K = D_V = 64 # Q,K矩阵维度
N_LAYERS = 6 # 编码层和解码层层数
N_HEADS = 8 # 多头注意力个数
class PositionalEncoding(nn.Module):
def __init__(self, d_model, dropout=0.1, max_... |
'''
Provide some Quality Assurance by scoring datasets against <NAME> five stars of openness
'''
import datetime
import json
import math
import os
import six
import tempfile
import time
import traceback
import urlparse
import routes
import requests
from ckan.common import _
from ckan.lib import i18n
from ckan.plugin... |
###############################################################################
#
# Copyright 2020 - 2021, <NAME>, <NAME>, <NAME>, <NAME>, <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 Soft... |
import re
from django import forms
from django.http import Http404
from django.urls import reverse
from django.db.models import Q, Case, When, IntegerField, F
from django.shortcuts import render, get_object_or_404, redirect
from django.db.models.functions import Lower
from texts.search_fields import get_search_fields
f... |
"""Run this app with `python app.py` and visit http://127.0.0.1:8050/ in your web browser."""
# TODO: add source type: YahooIV
# TODO: make the params header a link that goes to a page that gives more information about the param.
# TODO: display 2D or 3D graph mouse controls as a div above the graph
import json
import... |
from __future__ import division
__author__ = 'saeedamen' # <NAME>
#
# Copyright 2019 Cuemacro
#
# 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... |
# updated from version of `trmf_v0.9.ipynb` as of 2019-02-28 17:00
import numpy as np
import numba as nb
import scipy.sparse as sp
from scipy.optimize import fmin_l_bfgs_b, fmin_ncg
from numpy.lib.stride_tricks import as_strided
from sklearn.utils.extmath import safe_sparse_dot
from .tron import tron
from .extmath... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.4
# kernelspec:
# display_name: Python 3.9.6 64-bit
# name: python3
# ---
# # Gesture game using mediapipe library
# This game make use of t... |
# 筛选故障页面,并从故障页面中抽取故障描述、故障日志、故障原因和故障修复方案
import os
from bs4 import BeautifulSoup
import re
import nltk
import csv
import json
from string import punctuation
# 将一段文本切分为最短句,即在nltk切分的基础上再按照','切分
def cut_mini_sentences(text):
mini_sentences = []
sentences = nltk.sent_tokenize(text)
for sentence in sentences:
... |
import functools
import os, sys
import time
import cv2
import numpy as np
import pickle
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import tensorflow as tf
import tensorflow.contrib.slim as slim
from sklearn import mixture
from sklearn.metrics.cluster import normalized_mutual_info_score
from scip... |
import os
import sys
from datetime import datetime
from netCDF4 import date2num
from pyniva import Vessel, TimeSeries, token2header
import pandas as pd
from ferrybox import ferryBoxStationClass as fb
import csv
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__created__ = datetime(2019, 1, 22)
__modified__ = datetime(2020... |
import nibabel as nib
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import os
import math
import struct
import csv
import time
def gpu_usage():
print('gpu usage (current/max): {:.2f} / {:.2f} GB'.format(torch.cuda.memory_allocated()*1e-9, torc... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import argparse
from datetime import datetime
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
from torch.autograd import Variable
from torchvision import datasets, transforms
import matplotlib
m... |
# -*- coding: utf-8 -*-
#
# tests/conftest.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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
#
# ... |
from model import Multi_Model
import pickle
from PIL import Image
import re
import os
from torchvision.transforms.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor
from transformers import BertModel, BertConfig, BertTokenizer, AdamW, get_cosine_schedule_with_warmup
from tqdm import tqdm
import torch.... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
#!/usr/bin/env python3
import numpy as np
import logging
import os.path
import time
import math
# logger setup
logger = logging.getLogger(__name__)
##### USER DEFINED GENERAL SETTINGS #####
#set new name for each experiment, otherwise files will be overwritten
EXP_NAME = 'cas9pace_20210217_darwin_expt'
EVOLVER_IP =... |
# Adapted from https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html
import argparse
import random
import sys
from collections import namedtuple
from pathlib import Path
# Prevent numpy from using up all cpu
import os
os.environ['MKL_NUM_THREADS'] = '1' # pylint: disable=wrong-import-position
impo... |
# (c) 2018-2021, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest
import sys
from ansible_colle... |
"""
Functions and code generate workloads
"""
from analysis import ProbabilityMap
import bisect
import datetime
import random
import random_control
class TimeController(object):
"""
The Time controller class controls the point in time in which a trace
generation process is. It also produces inter arriva... |
import numpy as np
from scipy.optimize import linear_sum_assignment
from scipy.stats import kendalltau
import torch
is_cuda = torch.cuda.is_available()
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def sinkhorn_unrolled(c, a, b, num_sink, lambd_sink):
"""
An implementation of a Sinkhorn layer... |
import abc
import itertools
from typing import Iterable
from .indexes import Index
from .internal import _InternalAccessor
from .merge import MergeExpression
from .operator import (ArithExpression, BooleanExpression, DataFrameLike,
SeriesLike, StatOpsMixin)
from .series import Series
from .utils... |
from collections import OrderedDict
from copy import deepcopy
import time
import torch
import torch.nn as nn
import torch.nn.functional as f
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
class FFNN(nn.Module):
"""
Feedforward neural network for mod... |
import os
from datetime import datetime as date
import sqlite3
import sys
from random import choice
from termcolor import cprint
from getpass import getpass
def BASE_encode(plain_text):
numbers = '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42... |
from binascii import hexlify
from typing import Dict
class CANFrame:
"""
Class for calculating the bitstream of a CAN frame.
"""
FIELD_NAMES = ['sof',
'ida',
'idb',
'ide',
'srr',
'rtr',
'r... |
import numpy as np
import cv2 as cv
import os
import argparse
import pickle
import random
import math
import copyreg
from camera_estimator import CameraEstimator
from homography_ransac import homography_ransac
from matcher import Matcher
from image import Image
######## Fixes cv.KeyPoint pickle error ################... |
import argparse
import dataclasses
import json
import os
import re
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import List, Dict, Callable, Optional, Union, Any
from ActionConditions import ActionConditionData, get_action_condition_data
from Asset_Extract import check_t... |
# -*- coding: utf-8 -*-
import copy
from collections import defaultdict
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Sequence,
Union,
)
from ..exc import SchemaError, UnknownType
from ..lang import ast as _ast
from .directives import SPECIFIED_DIRECTIVES
from .in... |
import tensorflow as tf
from tensorflow.contrib.layers.python.layers import fully_connected
from flip_gradient import flip_gradient
def pdist(x1, x2):
"""
x1: Tensor of shape (h1, w)
x2: Tensor of shape (h2, w)
Return pairwise distance for each row vector in x1, x2 as
a Tensor of sh... |
import argparse
import pyBigWig
import os
import sys
import numpy as np
import scipy.stats
import re
import lightgbm as lgb
import pickle
def calculate_mmm(input3d, axis=2): # input 3d output 3d; calculate max, min, mean along axis=2
output3d=np.zeros((input3d.shape[0], input3d.shape[1], 3))
output3d[:,:,0]= n... |
import sys
import os
import time
import random
import keyboard
STEPS_PER_SECOND = 60
class PyChip8:
def __init__(self, debug = False):
self.reset()
self.debug = debug
def __showDebugInfo(self):
if not self.debug: return
print(f'SP: {self.sp}, V: {self.v}, PC: {self.pc}... |
import numpy as np
import io
from numpy.lib.recfunctions import *
from .utils import *
from . import vdspec as vd
from . import vbspec as vb
from . import vbvd_common as vbvd
import os
from .header_parser import header_parser as hp
from .json_html_viewer import json_html_viewer as jview
def detect_vb_or_vd(datpath)... |
""" For use in dumping single frame ground truths of EuRoc Dataset
Adapted from https://github.com/ClementPinard/SfmLearner-Pytorch/blob/0caec9ed0f83cb65ba20678a805e501439d2bc25/data/kitti_raw_loader.py
<NAME>, <EMAIL>, 2019
<NAME>, <EMAIL>, 2019
"""
from __future__ import division
import numpy as np
from pathlib imp... |
"""Core functions of federate learning."""
import argparse
import copy
import numpy as np
from advertorch.attacks import LinfPGDAttack
from torch import nn
from federated.aggregation import ModelAccumulator, SlimmableModelAccumulator
from nets.slimmable_models import get_slim_ratios_from_str, parse_lognorm_slim_sched... |
# coding: utf-8
""" Tests for infer_potential.py """
from __future__ import division, print_function
__author__ = "adrn <<EMAIL>>"
# Standard library
import os, sys
import logging
import shutil
import time
# Third-party
import astropy.units as u
from astropy.utils import isiterable
import h5py
import matplotlib
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################
## External modules
##############################################
# module install command: pip install keyboard
import keyboard
# module install command: pip install admin
import admin
# module install command: pip install ... |
from django import forms
from django.db.models.functions import Lower
from django.forms.utils import flatatt
from django.forms import ValidationError
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse_lazy
from django.contrib.staticfiles.... |
# pylint: disable=no-member, not-callable
import logging
import os
import time
from pathlib import Path
from typing import Mapping, Optional, Sequence, Tuple, Union
import fasteners
import numcodecs
import numpy as np
import zarr
import swyft
from swyft.store.simulator import SimulationStatus, Simulator
from swyft.ty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.