text stringlengths 3.07k 22.1k |
|---|
import asyncio
import contextlib
import datetime
import logging
import discord
from redbot.core import commands, Config, version_info, VersionInfo
from redbot.core.utils.chat_formatting import box, pagify
from redbot.core.utils.predicates import MessagePredicate
from typing import Union
default_wave = "\N{WAVING HAN... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... |
import ROOT
import itertools
import math
from DataFormats.FWLite import Events, Handle
from array import array
import numpy
def median(lst):
return numpy.median(numpy.array(lst))
def fetchSegmentsPhi(event,ontime=True,twinMux=True):
phiSeg = Handle ('L1MuDTChambPhContainer')
if twinMux:
eve... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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
#
# Unle... |
import streamlit as st
import pandas as pd
import numpy as np
import json
import pickle
from PIL import Image
import streamlit.components.v1 as components
import xgboost
import shap
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import os
#Setting the page configuration
square_ic... |
#!/usr/bin/env python
"""
reservedinstancecheck - Checks compliance for reserved instance use
USAGE: reservedinstancecheck [options]
Options:
-h, --help Show this dialog
-r, --region REGION AWS region to examine
-R, --reservations Show active reservations
-u, --unused ... |
from datetime import datetime, timedelta
from .abcs import Resource
from . import utils
class Category(Resource):
endpoint = "categories"
def __init__(self, data, http):
super().__init__(data, http)
self.name = data["name"]
self.type = data["type"]
self.rules = data["rules"... |
# encoding: utf-8
"""
Sorry for have not reimplemented the code.
Copied from SpanNER.
"""
import torch
def span_f1(predicts, span_label_ltoken, real_span_mask_ltoken):
'''
:param predicts: the prediction of model
:param span_label_ltoken: the label of span
:param real_span_mask_ltoken: 1 for real sp... |
import argparse
import os
import shutil
import random
from random import Random
import numpy as np
from PIL import Image
import torch
import pytorch_lightning as pl
import Augmentor
import torchvision.datasets as dset
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Dataset
from torchvision ... |
from typing import List, Union
from quicktions import Fraction
import numbers
__all__ = ['BEATWISE_EXCEPTIONS', 'QuarterDuration']
#: {offset: {quarter_duration: return value(s), ... }, ...}
BEATWISE_EXCEPTIONS = {0: {5: (3, 2), 6: (6,)}}
class QuarterDuration(numbers.Rational):
"""
A Class specifically des... |
from docx import Document
from docx.shared import Cm, Mm, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
import json, datetime, sys, boto3
import matplotlib.pyplot as plt
import statistics
print ('# Transcription')
job_start = datetime.datetime.now()
# Function to help convert timestamps from s to H:M... |
"""
Preprocesses raw population data for French regions.
Generates: `ages-french-regions.csv` a file with stratified age ranges:
,0-9,10-19,20-29,30-39,40-49,50-59,60-69,70-79,80+
"""
import sys
import pandas as pd
from path import Path
# Step 1 Load population data from "population-fra-INSEE-departement.csv"
data... |
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
import json
from datetime import datetime
import ijson
import scrapy
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from kingfisher_scrapy import util
from kingfisher_scrapy.items import File, FileItem
class Paraguay... |
import os
import numpy as np
import pytest
import torch
from skimage.metrics import peak_signal_noise_ratio as ski_psnr
import ignite.distributed as idist
from ignite.exceptions import NotComputableError
from ignite.metrics import PSNR
from ignite.utils import manual_seed
def test_zero_div():
psnr = PSNR()
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
COMP0088 lab exercises for week 4.
Add your code as specified below.
A simple test driver is included in this script. Call it at the command line like this:
$ python week_4.py
A 6-panel figure, `week_4.pdf`, will be generated so you can check it's doing what you
... |
"""
Python implementation of communication with Rejseplanen API.
More information about the API can be found at
https://help.rejseplanen.dk/hc/en-us/articles/214174465-Rejseplanen-s-API
"""
from datetime import datetime
import requests
from .classes import *
from .constants import *
def _request(service, params, ti... |
import cv2
import sys
sys.path.append('../')
from tqdm import tqdm
from lib import fileTool as FT
# from lib.pwcNet.pwcNet import PWCDCNet
# from lib.RAFT.raftNet import RAFT
# from lib.forwardWarpTorch.forwardWarp import forwadWarp
# import torch
from pathlib import Path
from DVSBase import ESIMReader
import numpy as... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
import math
from argparse import Namespace
from dataclasses import dataclass, field
from... |
#!/usr/bin/env python
"""
androidfde2john.py, program to "convert" Android FDE images / disks into JtR
friendly format. All the heavy lifting is done by the code written by <NAME>.
On ICS (Android 4.0.x), I found out that the encryption footer
resides in a separate partition (of size 8MB).
Copyright (c) 2013 <NAME>
... |
import os
from .helpers import package_up_vars as _package_up_vars
from .models import WorkerNodesCounter
import json
import requests
import msgpack
import taxcalc
from requests.exceptions import Timeout, RequestException, ConnectionError
from .helpers import arrange_totals_by_row
from ..constants import START_YEAR
imp... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
r"""
This file defines classes for representing config data/settings.
Config data is modeled as key-value pairs. Keys a... |
# Copyright 2021 ONDEWO GmbH
#
# 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, ... |
"""Functions related to networking.
Containing functions to download files from the internet. Supports
download *zipped* files from Google Drive.
"""
# pylint: disable=R0914,R0915,W0612
import os
import sys
import time
import zipfile
import urllib.request
import http.cookiejar
from omnizart.utils import ensure_path_... |
"""This script creates a regression test over metarl-TRPO and baselines-TRPO.
Unlike metarl, baselines doesn't set max_path_length. It keeps steps the action
until it's done. So we introduced tests.wrappers.AutoStopEnv wrapper to set
done=True when it reaches max_path_length. We also need to change the
metarl.tf.sampl... |
#!/usr/bin/env python3
"""
Tool for TLSA/DANE
Usage:
gentlsa.py generate <zone> <port> [--hostname <shorthost>] [--info] [--cloudflare] [--dryrun]
gentlsa.py verify <zone> <port> [--hostname <shorthost>] [--info]
gentlsa.py cloudflare [--info] [--listzones] # not implemented yet
gentlsa.py file <certfi... |
import re
import asyncio
import random
# Kanged from:
# https://github.com/pokurt/Nana-Remix/blob/master/nana/modules/pm.py
# https://github.com/pokurt/Nana-Remix/blob/master/nana/assistant/inline.py#L239
from pyrogram import Client, filters
from pyrogram.raw import functions
from pyrogram.types import InlineKeyboard... |
# coding:utf-8
#!/usr/bin/python
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# note: this module should reamin py2.7 compatible (Maya) so no f'strings
... |
from django.core.cache import cache
from django.db.models import Manager, Sum
from django.db.models.query import RawQuerySet
from kolibri.content.models import AssessmentMetaData, ChannelMetadataCache, ContentNode, File
from le_utils.constants import content_kinds
from rest_framework import serializers
from .content_d... |
import numpy as np
import matplotlib.pyplot as plt
from time import time
from tqdm import tqdm
from KDEpy.FFTKDE import FFTKDE
import seaborn as sns
SEED = 42
np.random.seed(SEED)
class Sampler(object):
"""
General Markov Chain Monte Carlo sampler.
To be subclassed exclusively.
"""
__slots__ = '... |
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# This source code is licensed under an MIT license found in the LICENSE file in the root directory of this project.
#
from itertools import product
import numpy as np
import rlutils as rl
notes = ('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#')
def get_fre... |
#!/usr/bin/python3
import socket
import sys
import os
from binascii import hexlify
from sortedcontainers import SortedDict
BUFFER_SIZE = 512
SERVER_PORT = 4000
CLIENT_PORT = 10000
CLIENT_ADDRESS = 'localhost'
SERVER_ADDRESS = '127.0.0.1', SERVER_PORT
FIRMWARE = 'firmware.bin'
CHUNK = 255
MOD = 65536
WINDOW_SIZE = 2040... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import ast
import time
from util.util import string_to_float,symbol_list
from util.config import config
from kafka import KafkaConsumer
from cassandra.cluster import Cluster,NoHostAvailable
from producer import get_intraday_data,get_historical_data
# ================... |
# File: TopoSort.py
# Description: Assignment 23 | Topological Sort
# Student Name: <NAME>
# Student UT EID: mrm5632
# Course Name: CS 313E
# Unique Number: 50205
# Date Created: 11-25-2019
# Date Last Modified: 12-02-2019
class Stack (object):
# stack constructor
def __init__ (self):
... |
## Tests for SPIRALTAP
## Various tests for pySPIRALTAP inputs
## by MW, May 2016
##+ some code is copy-pasted from cstools.py
from __future__ import print_function
import sys
#sys.path.append('..')
import pySPIRALTAP
#from pySPIRALTAP import pySPIRALTAP
import cstools
import numpy as np
## ==== Test inputs
## ==== ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 26 18:27:58 2016
@author: <NAME>
"""
import random
import csv
from sklearn import metrics
def IndividualBuilder(size, possList, probList):
"""
Args:
size (int) - the list size to be created
PossArr - a list of the possible mutations
t... |
import torch
import time
import numpy as np
import torch
import open3d as o3d
from torch.utils.data import DataLoader, Dataset, ConcatDataset, random_split
from .event_utils import gen_discretized_event_volume, normalize_event_volume
from easydict import EasyDict
from tqdm import tqdm
import os
import cv2
import pdb
f... |
from selenium import webdriver
import time
from datetime import datetime
import datetime
import json
def core_function(real_start, real_end):
driver = webdriver.Firefox(executable_path=r'D:\geckodriver.exe')
lib = 'http://zuowei.cczu.edu.cn/'
cookies_1 = {
"hostOnly": True,
"httpOn... |
import pickle
import queue
import time
from threading import Thread
import grpc
from hypernets.dispatchers.cfg import DispatchCfg as c
from hypernets.utils import logging, fs
from .proto import spec_pb2_grpc
from .proto.spec_pb2 import SearchResponse, PingMessage
logger = logging.get_logger(__name__)
class TrialIt... |
import requests
import time
import shutil
import json
import copy
import pathlib
import os
from urlpath import URL
from azure.storage.blob import BlockBlobService, ContentSettings
from utils.blob_utils import BlobStorage
from utils.vott_parser import process_vott_json, create_starting_vott_json, build_id_to_VottImageTa... |
from collections import OrderedDict
from functools import cmp_to_key
from devito.ir.iet import (Iteration, HaloSpot, SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC,
VECTOR, WRAPPABLE, ROUNDABLE, AFFINE, OVERLAPPABLE, hoistable,
useless, MapNodes, Transformer, retrieve_it... |
import random
from collections import OrderedDict
from copy import deepcopy
import networkx as nx
import numpy as np
from networkx import DiGraph
from evosorocore.NetworkUtils import neg_abs, neg_sqrt_abs, neg_square, normalize, sigmoid, sqrt_abs, neg_sign
from evosorocore.NetworkUtils import vox_xyz_from_id
class ... |
#!/bin/python3
import time
import multiprocessing
import csv
import glob
import sys
import argparse
import traceback
from memsql.common import database
ERROR = "***ERROR***"
DEBUG = False
NL = "\n"
# 3-node cluster - aggs = "172.31.57.177:3306,172.31.59.251:3306,172.31.53.236:3306"
DEFAULT_FILES="/tmp/files/person/... |
import numpy as np
import six.moves.cPickle as pickle
import gzip
import os
def load_mnist_data(dataset):
""" Load the dataset
Code adapted from http://deeplearning.net/tutorial/code/logistic_sgd.py
:type dataset: string
:param dataset: the path to the dataset (here MNIST)
"""
# Download the M... |
#!/bin/env python3
import base64
import io
from collections import defaultdict
from statistics import mean, stdev
from typing import Tuple
import numpy as np
from matplotlib import axes
from matplotlib import pyplot as plt
from data_structure.filter_info import ExposureInfo
from data_structure.focus_result import Foc... |
import dataclasses
import logging
from pathlib import Path
import numpy as np
import pandas as pd
import torch
import torchvision
from sklearn.metrics import roc_auc_score
from torch import nn, optim
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
from utils.data.eegdataloader import EegDataSet... |
#!/usr/bin/env python
# coding: utf-8
import os
import re
import sys
from subprocess import Popen, PIPE
from flask import (Flask, request, render_template, jsonify, abort, redirect,
Response, url_for)
from flask.ext.login import (LoginManager, UserMixin, current_user,
log... |
from datetime import timedelta
import pandas as pd
from kaleidoscope.globals import OptionType, Period
from kaleidoscope.options.option_query import OptionQuery
from kaleidoscope.options.option_strategy import OptionStrategy
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
class O... |
import Hippocampus
import Environment
import ValueLearning
import Graphics
import Agents
# Packages for visualization and analysis
import time
import threading
import numpy as np
import matplotlib.pylab as pl
def testMaze(n_training_trials, n_navigation_trials):
"""
No comments here. Look at single_maze_learn... |
import time
import numpy as np
import scipy as sp
import pandas as pd
from scipy.sparse import csr_matrix, coo_matrix
import numpy.linalg as la
import numpy.random as rnd
import theano
from scipy.sparse import coo_matrix, random as sparse_rnd
from scipy.sparse.linalg import norm as sparse_norm
import theano.tensor as... |
# from Blocks import *
# blockhandler = handler
import Blocks
# from Item import *
# itemhandler = handler
from oredictnames import *
import Inventorys
import json
import os
import globals as G
import Item.Item as Item
import config
import exceptionhandler
class Grid:
crafting_1x1 = "mcpython:interfaceses:crafti... |
import requests
import discord
from discord.ext import commands, tasks
from pytz import timezone
from discord import embeds
from datetime import datetime
import time
import pytz
import t
import tweepy
import json
from PIL import Image
from selenium import webdriver
PATH = 'chromedriver.exe'
now = datetime.now()
curre... |
"""
HTML document parser module
It provides functions for extracting translatable strings from a HTML document
and creating an XLIFF 1.2 document that can be translated in most offline
and online CAT tools: SDL Trados, Deja Vu, memoQ, Transifex, SmartCAT
and many others.
"""
import re
import logging
import types
from... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import abc
import numpy as np
import pandas as pd
from qlib.log import TimeInspector
EPS = 1e-12
class Processor(abc.ABC):
def __init__(self, feature_names, label_names, **kwargs):
self.feature_names = feature_names
self.l... |
import requests_html, openpyxl, ntpath, os, datetime
import PySimpleGUI as sg
import numpy as np
import pandas as pd
from pathlib import Path
from bs4 import BeautifulSoup as BSoup
from requests.exceptions import ConnectionError
from requests.exceptions import ReadTimeout
from openpyxl.utils.dataframe import da... |
__source__ = 'https://leetcode.com/problems/utf-8-validation/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/utf-8-validation.py
# Time: O(n)
# Space: O(1)
#
# Description: Leetcode # 393. UTF-8 Validation
#
# A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:
... |
import numpy as np
import os
import pickle
import ra
import fft
import argparse
from scipy.misc import imresize
from cgls import cgls
from filterplot import filterplot
from gaussian2d import gaussian2d
from hashkey import hashkey
from math import floor
from matplotlib import pyplot as plt
from scipy import interpolate
... |
from flask import Flask, render_template, request, flash, redirect, url_for
import rpy2.robjects as ro
import os, string, random, json, re
from bson import json_util
from bson.json_util import dumps
from pymongo import MongoClient
from jinja2 import Template
from xhtml2pdf import pisa # import html->pdf gen... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Parse TAP to produce appropriate exit code and emojified summary.
Test Anything Protocol (testanything.org) is an output format for tests.
Hightlights:
* Standalone script with one single dependency (python 2.7 or 3.x)
* Platform agnostic - runs on windows, ma... |
import os
import numpy as np
import re
import six
import jieba
import gc
# 获取文件夹下所有文件,包括子文件夹
def file_name(file_dir):
L = []
for root, dirs, files in os.walk(file_dir):
for file in files:
# if os.path.splitext(file)[1] == '.jpeg':
L.append(os.path.join(root, file))
return L... |
import torch
import math
from torch import nn, Tensor
from torch.nn import functional as F
from .modules.common import ConvModule
class DetailBranch(nn.Module):
def __init__(self) -> None:
super().__init__()
self.S1 = nn.Sequential(
ConvModule(3, 64, 3, 2, 1),
ConvModule(64... |
from __future__ import print_function, division
import os
import sys
import logging
import pprint
import time
import numpy as np
import pickle
import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn as cudnn
import cv2
from PIL import Image
import warnings
warnings.filterwarnings("ignor... |
# Copyright (c) 2021 PaddlePaddle 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... |
# -*- coding: utf-8 -*-
from __future__ import annotations
import urllib.parse
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional
__author__ = 'lundberg'
# Friendly names for supported AttrTypes
from tld import get_fld
SUPPORTED_TYPES = ['domain name', 'URL', 'IP addre... |
import torch
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
def compute_affinity(src_img,
dst_img,
temperature=1.,
normalize=True,
softmax_dim=None,
mask=None):
batches, channels = sr... |
import requests
import time
import re
import rsa
import binascii
import json
import logging
import log
import base64
import urllib.parse
import threading
import queue
from config import weibo_username, weibo_password
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gec... |
# coding=utf-8
#
# created by kpe on 16.03.2019 at 12:56 AM
#
from __future__ import division, absolute_import, print_function
import json
import inspect
from typing import Text, Type, Any, Dict
import argparse
class Param:
""" Provides a parameter specification to be used within a Params instance. """
def... |
"""Extension of utilities.py to provide functions required to check the
version information of ensembl and determine if it needs to be updated.
Classes:
Ensembl: Extends the SrcClass class and provides the static variables and
ensembl specific functions required to process ensembl.
Functions:
get_SrcC... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
import os
import json
import sqlite3
import pickle
import pandas as pd
from flask import Flask, jsonify, request, Blueprint
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# Create_app
app = Flask(__name__)
CORS(app)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqli... |
from tkinter import * #import tkinter library (despkot interface)
import backend
import os
import http.client
import json
import subprocess
creds = '<PASSWORD>'
def Illness_Drug():
e4.delete(0,END)
e4.insert(END,e5.get())
e6.delete(0,END)
e6.insert(END,selected_tuple_2)
search_wi... |
'''
Created on Jul 21, 2020
@author: vladislavkargin
'''
import numpy as np
import random
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
#import matplotlib.lines as mlines
import rgs.mndrpy.Utility as ut
import rgs.mndrpy.DyckPaths as dp
#import mndrpy.ElementTL as tl
class Pairing(object):
... |
from openprocurement.tender.core.procedure.models.award import Award
from openprocurement.tender.core.procedure.context import get_now, get_request, get_tender
from openprocurement.tender.core.procedure.utils import get_first_revision_date
from openprocurement.api.constants import RELEASE_2020_04_19
from openprocuremen... |
'''
Created on Jan 23, 2017
@author: JosePinilla
'''
import os
import sys
import json
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
##### DIFFUSION
from diffusion import diffusion
##### ROUTING
from traverse_router import legalize
VERBOSE = False
PLOT = False
# Chimera and Dimensions
C... |
# Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 <NAME>.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import unittest
import autoconfig
import parser_test_case
from pygccxml import parser
from pygccxml import declarations
from pygccxml... |
# This code is reused from https://github.com/deepmipt/DeepPavlov/blob/master/deeppavlov/metrics/fmeasure.py
import itertools
from collections import OrderedDict
def chunk_finder(current_token, previous_token, tag):
current_tag = current_token.split('-', 1)[-1]
previous_tag = previous_token.split('-', 1)[-1]
... |
"""
Convert parsed grammar into AST nodes.
"""
from future.builtins import bytes
# Semantics
# =========
#
# A semantics object is used by the parser to construct AST nodes. Our semantics
# converts parser AST nodes which reflect the mechanism of the parser into AST
# nodes which better reflect the semantics of the p... |
# pylint: disable=unused-argument
import typing as _t
from collections import OrderedDict
import json
from django.conf import settings
from django.db import transaction
from django.http import Http404
from django.test import Client
from rest_framework import permissions as rest_permissions, throttling, request as drf_... |
# coding=utf-8
import json
import math
from jingtum_python_lib.config import Config
from jingtum_python_lib.utils import is_number, utils
from jingtum_python_baselib.utils import *
from jingtum_python_baselib.wallet import Wallet
fee = Config.FEE or 10000
set_clear_flags = {
'AccountSet': {
'asfRequireDe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Fable Input Output
# https://github.com/silx-kit/fabio
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: <NAME> (<EMAIL>)
#
# This program is free software: you can redistribute it an... |
""" A pure python multiple-terminal bdd representation.
That is to say a path through the bdd can result in any
action. For example A, B, C or undefined (None).
"""
# Copyright 2019 <NAME>, Wand Network Research Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this f... |
import logging
import mxnet as mx
import numpy as np
import os
import urllib
import pickle
import sys
#import cv2
from mxnet import init
from mxnet import gluon
from mxnet import autograd
from mxnet import nd
from mxnet.gluon.model_zoo.vision import resnet50_v1
### The shape of input image.
### Aspect Ratio 1:1 # (1... |
"""
HELLO, I am green_4.py
-------------------------------------------------------------------------------
MIT License Copyright (c) 2017 <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 wi... |
import numpy as np
JND = 2.3
M_rgb_to_xyz = np.array([[0.4124564, 0.3575761, 0.1804375],
[0.2126729, 0.7151522, 0.0721750],
[0.0193339, 0.1191920, 0.9503041]])
M_xyz_to_rgb = np.linalg.inv(M_rgb_to_xyz)
# https://en.wikipedia.org/wiki/LMS_color_space#Hunt.2C_RLAB
M... |
from skimage.segmentation import quickshift, mark_boundaries
import numpy as np
import matplotlib.pyplot as plt
from IPython.core.display import display, HTML
import cv2
def show_vis_explanation(explanation_image, cmap=None):
"""
Get the environment and show the image.
Args:
explanation_image:
... |
import numpy as np
from numpy.polynomial.legendre import leggauss
import scipy
def leggausslobatto(N):
return [
(np.array([-1, 1]), np.array([1.0, 1.0])),
(np.array([-1, 0, 1]), np.array([1.0, 4.0, 1.0]) / 3),
(np.array([-1, -0.4472135954999579, 0.4472135954999579, 1]),
np.array([... |
#!/usr/bin/env python3
import logging
import subprocess
from backend.corpora.dataset_processing.process import (
get_bucket_prefix,
)
import time
import numpy as np
import psutil
import tiledb
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def process(dataset_id: str, cellxgene_... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .module import *
from .patchmatch import *
class FeatureNet(nn.Module):
def __init__(self):
super(FeatureNet, self).__init__()
self.conv0 = ConvBnReLU(3, 8, 3, 1, 1)
# [B,8,H,W]
self.conv1... |
#! /usr/bin/env python3.7
import argparse
import csv
import hashlib
import logging
import pandas as pd
from Bio import SeqIO
from Bio.Seq import Seq
def load_fna(file_name: str):
with open(file_name, 'r') as fna_file:
return next(SeqIO.parse(fna_file, 'fasta'))
def load_potentials(file_name: str):
... |
"""
Canboat Json file reader and parser
"""
import datetime
import json
import logging
from typing import Dict, List, Set
import warnings
from cantools.database import Database
from cantools.database import Message
from cantools.database import Signal
def get_unique_id(id_: str, reserved_ids: Set[str]) -> str:
... |
import contextlib
import inspect
import functools
import json as pyjson
import logging
import os
import re
import typing
from collections.abc import Mapping
from urllib.parse import urlparse, ParseResult
from pathlib import Path
import marshmallow as ma
from dotenv.main import load_dotenv, DotEnv, _walk_to_root
__ver... |
"""
* This file is part of PYSLAM
*
* Copyright (C) 2016-present <NAME> <<EMAIL>>
*
* PYSLAM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later v... |
"""
Script calculates regressions on snow cover index (SWE!!!) for only models
Notes
-----
Author : <NAME>
Date : 22 July 2019
"""
### Import modules
import datetime
import numpy as np
import matplotlib.pyplot as plt
import cmocean
from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid
import read_M... |
# Written by <NAME>
import torch
import torch.distributed as dist
from torch import nn
from ...utils.dist_utils import get_dist_info
__all__ = ["TripletLoss", "SoftmaxTripletLoss", "SoftSoftmaxTripletLoss"]
def euclidean_dist(x, y):
m, n = x.size(0), y.size(0)
xx = torch.pow(x, 2).sum(1, keepdim=True).expa... |
# coding: utf-8
# author: <NAME>
import tensorflow as tf
import numpy as np
import time
import os
import sys
import skiplstm
import data_help_yelp
flags = tf.app.flags
flags.DEFINE_integer('hidden_units', 300, 'hidden dim of lstm')
flags.DEFINE_integer('emb_size', 300, 'word embediding size')
flags.DEFINE... |
# -*- coding:utf-8 -*-
import json
import logging
import numpy
import tornado.web
import tornado.gen
import tornado.escape
from tornado.httpclient import AsyncHTTPClient
from bson.json_util import dumps, loads
from pymongo import ReturnDocument
AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClien... |
'''miscellaneous utilities.'''
from pypeerassets.provider import Provider, RpcNode, Explorer, Cryptoid
from pypeerassets.exceptions import (InvalidDeckSpawn,
InvalidDeckMetainfo,
InvalidDeckIssueMode,
Inval... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import json
import time
import logging
from . import builder_config
from .utils import save_profiled_results, merge_info
from nn_meter.builder.backends import connect_backend
logging = logging.getLogger("nn-Meter")
def convert_models(b... |
import logging
RANDOM_SEED = 20201234
import argparse
import openml
import os
import numpy as np
import string
import pandas as pd
import scipy
import math
OPENML_REGRESSION_LIST = [201, 1191, 215, 344, 537, 564, 1196, 1199, 1203, 1206,
5648, 23515, 41506, 41539, 42729, 42496]
NS_LIST = list(string.ascii_lowercase) + ... |
"""
File for test case generation
"""
import time
from typing import List
import kubernetes as k8s
from illuminatio.k8s_util import labels_to_string
from illuminatio.rule import Rule
from illuminatio.test_case import NetworkTestCase
from illuminatio.host import ClusterHost, GenericClusterHost
from illuminatio.util imp... |
#!/usr/bin/env python
import argparse
import glob
import os
import re
import subprocess
import sys
import pandas as pd
from utilities.log_util import get_logger, log_command
BCL2FASTQ = 'bcl2fastq'
S3_RETRY = 5
S3_LOG_DIR = 's3://trace-genomics/TraceGenomics/logs'
ROOT_DIR_PATH = '/tmp'
def get_default_requirem... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.