text stringlengths 6.04k 39.5k |
|---|
import logging
import os
from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union
from transformers import AutoTokenizer
from seqeval.metrics.sequence_labeling import get_entities
from copy import deepcopy
from tqdm.auto import tqdm
import torch
from torch import nn
from torch.u... |
# Copyright 2018 <NAME>
#
# 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
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################################################
# Much of following code is from by JAR
from __future__ import print_function
import csv
import os
import re
import logging
from taxalotl.ott_schema import InterimTaxonomy... |
import argparse
import pickle
import random
import util
import keras
import numpy as np
from keras import Input, Model
from configparser import ConfigParser
from keras.callbacks import ModelCheckpoint, EarlyStopping
from keras.layers import Conv2D, MaxPool2D, Concatenate, Flatten, Dropout, Dense
from keras.optimizers i... |
from django.contrib.auth import get_user_model
from rest_framework import viewsets # new
from users.models import CustomUser,PhoneOTP
from users.serializers import (
RegisterVendonSerializer,
RegisteCustomerSerializer,
LoginwithPhoneCustomerSerializer,
LoginVendorSerializer,
EmailVerificationSeriali... |
"""
Definition of the log likelihood distribution in terms of the parameters of the model and the datasets which are use.
"""
import numpy as np
from scipy.interpolate import interp1d
from scipy.integrate import cumtrapz as cumtrapz
from scipy.constants import c as c_luz #meters/seconds
c_luz_km = c_luz/1000
import ... |
from __future__ import unicode_literals
from pepper.framework import *
from pepper.language import *
from pepper.language.name import NameParser
from pepper.framework.sensor.face import FaceClassifier
from pepper import config, ApplicationBackend
from pepper.knowledge.sentences import *
from pepper.knowledge import a... |
# Built-In modules
import os, sys, time, traceback
from os.path import isdir, isfile
from pathlib import Path as pt
from io import StringIO
import contextlib
# Tkinter
from tkinter import Frame, IntVar, StringVar, BooleanVar, DoubleVar, Tk, filedialog, END, Text
from tkinter.ttk import Button, Checkbutton, Label, Ent... |
###############################################################################
# Imports
import sys
import argparse # Argument parser
import networkx as nx
import matplotlib.pyplot as plt
import random
from sympy import to_dnf
from sympy.parsing.sympy_parser import parse_expr
import ast # String to dict
from impo... |
"""MQueue is a queueing primitive that provides composing new queues
from selecting ("choose") and mapping ("map") other queues.
For base use you create instances of MQueue that you can put and take
elements to and from. If you need to read from multiple MQueues, you
can use "select" to do that directly, but "choose" ... |
import torch
import numpy as np
import logging
import os
from torchvision.utils import save_image
import cv2
import shutil
import matplotlib.pyplot as plt
import random
import csv
import cmd
import yaml
import sys
logging.basicConfig(format='%(message)s', level=logging.INFO)
Runtime=None
Experiment=None
logger=None
c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
This program is free software; you can redistribute it and/or modify
it under the terms of the Revised BSD License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
... |
"""Utilities for downloading and providing data from openslr.org, libriSpeech, Pannous, Gutenberg, WMT, tokenizing, vocabularies."""
# TODO! see https://github.com/pannous/caffe-speech-recognition for some data sources
import os
import re
import sys
import wave
import numpy
import numpy as np
import skimage.io # sci... |
"""doc
# leanai.model.layers.box_tools
> Convert the output of a layer into a box by using the anchor box.
"""
from typing import List, Tuple
from collections import namedtuple
import torch
import math
import numpy as np
from torch import Tensor
from torch.nn import Module
from torchvision.ops import nms
from leanai.c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 4 03:55:51 2018
@author: k3jackson
"""
import os
import subprocess
import time
import sys
import configparser
#sys.path.append('ctdcal/')
import ctdcal.process_ctd as process_ctd
import ctdcal.fit_ctd as fit_ctd
def process_all_new():
ssscc... |
import datetime
import matplotlib.pyplot as plt
import numpy as np
from Read_Data import read_data, calc_climb_rate
markers = ['.', ',', 'o', 'v', '^',
'<', '>', '1', '2', '3',
'4', 's', 'p', '*', 'h',
'H', '+', 'x', 'D', 'd',
'|', '_']
line_styles = ['-', '--', '-.', ':',
... |
"""
MIT License
Copyright (c) 2021 <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, modify, merge, publish, distri... |
# Main
import numpy as np
import pandas as pd
import streamlit as st
# Sklearn
import sklearn
import sklearn.metrics as metrics
from sklearn.impute import SimpleImputer, KNNImputer
from sklearn import svm, tree, linear_model, neighbors, ensemble
from sklearn.metrics import roc_curve, precision_recall_curve, auc
from s... |
import torch
import os
import os.path as osp
from pdb import set_trace as st
def compute_diff(trial_weight, weight):
diff = (trial_weight - weight).clone().abs()
return diff
def compute_mul(trial_weight, weight):
diff = (trial_weight - weight).abs()
mul = (diff * weight).clone().abs()
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
"Example of solving (U,V,P)"
def conv_loss(domain_size=32, dtype=torch.FloatTensor):
"convolutional loss function based on steady heat equation"
K = torch.tensor([[... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 17:00:07 2018
Modified Wed Dec 5 2018 (Fix Issue 2, Handle DC Loads)
Modified on 02/25/2019 for version 0.1.0
Modified on 03/06/2019 to correct in updating soc
@author: <NAME>
------------------------------------------------------------------... |
'''Una pizzería de la ciudad ofrece a sus clientes una amplia variedad de pizzas de fabricación propia,
varios tamaños (8, 10 y 12 porciones).
Los clientes tienen a disposición un menú que describe para cada una de las variedades, el nombre,
los ingredientes y el precio según el tamaño y el tipo (a la piedra, a la p... |
from django.db import models
from django.contrib.auth.models import AbstractUser , BaseUserManager
from time import gmtime, strftime
from django.utils import timezone
from django.conf import Settings
from .validators import phone_validator
from django.utils.text import slugify
from django.template.defaultfilters import... |
from functools import lru_cache
import scipy.interpolate
import numpy as np
from astropy import constants as const
def el2xv(a, e, i_, peri_, node_, f_, mstar=None, degrees=True,
au=True, return_2d=False):
'''Convert orbital elements to positions and velocities.
Output length is in same units a... |
import pcp_utils
import sys
import os
import click
import yaml
import open3d as o3d
import tensorflow as tf
# add gym and baseline to the dir
gym_path = pcp_utils.utils.get_gym_dir()
baseline_path = pcp_utils.utils.get_baseline_dir()
graspnet_path = pcp_utils.utils.get_6dof_graspnet_dir()
sys.path.append(gym_path)
sys... |
from os.path import join, realpath, dirname, exists, isdir
from os import listdir
import os
import logging
import glob
import numpy as np
import json
from collections import OrderedDict
import cv2
from PIL import Image, ImageColor
import webcolors
import matplotlib.pylab as plt
import matplotlib.image as mpimg
import t... |
import hashlib
import itertools
import json
import logging
import pathlib
import pickle
import random
import re
import shutil
import typing
from copy import deepcopy
from operator import eq
import networkx as nx
import networkx.algorithms.isomorphism as iso
import pandas as pd
import yaml
from monty.json import MontyD... |
import helpers
import pytest
import falcon_kit.functional as f
import collections
import logging
import os
import re
import io
thisdir = os.path.dirname(os.path.abspath(__file__))
example_HPCdaligner_fn = os.path.join(thisdir, 'HPCdaligner_synth0_new.sh')
example_HPCdaligner_small_fn = os.path.join(
thisdir, 'HPCd... |
# coding: utf-8
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import codecs
import fnmatch
import itertools
import os
import re
import shutil
import subprocess
from jinja2 import Template
from .util import command
f... |
"""An Extensible Parallel Runtime Library for Rekall.
Runtime: the entrypoint for running large tasks.
Its construction takes a factory function for a worker pool, which are
described in the following section.
WorkerPool Factories:
inline_pool_factory
A factory for a pool that executes tasks in se... |
"""InPhaDel: Genotypes and phase deletions on a single chromosome using a specific classification model
Trains models for phasing deletions using underlying WGS+HiC data
"""
import sys
import os
import pickle
import pandas as pd
import numpy as np
import warnings
from itertools import izip
from sklearn import svm
f... |
#!/usr/bin/env python3
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
plt.rcParams.update({
"figure.max_open_warning" : 200,
"font.size" : 15,
"font.family": "calibri", # use serif/main font for text elements
})
import sys
... |
import re
import math
from .datetime_string import to_seconds, to_timedelta
import logging
import os
logger = logging.getLogger()
class CSVFile:
indexes = {}
columns = []
headers_dict = {}
file_name = ''
@staticmethod
def read_rows_from_file(source_file_name):
rows = []
try:
... |
#!/usr/bin/env python
# coding: utf-8
from clusc.utils import *
import os
import tensorflow as tf
import scipy.sparse as sp
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_string('f', '', 'kernel')
flags.DEFINE_integer('hidden3', 64, 'Number of units in hidden layer 3.')
flags.DEFINE_integer('discriminator_o... |
# -*- coding: utf-8 -*-
import pytest
from snakespace import SnakeSpace
__author__ = "cmrfrd"
__copyright__ = "cmrfrd"
__license__ = "mit"
def test_simple_snakespace():
S = SnakeSpace()
assert (S == "")
assert (str(S) == "")
assert (str(S) != " ")
def test_init_snakespace():
S = SnakeSpace('yo.w... |
import copy
import os
import json
from django import template
from django.conf import settings
from django.utils.timezone import now
from django.db.models.query import QuerySet
register = template.Library()
def dump_to_json_file(given, file_name="dashboard"):
path = os.path.expanduser(
settings.LOCAL_TES... |
import asyncio
import random
import urllib.parse
import uuid
from bson import ObjectId
from sanic import Blueprint
from sanic.log import logger
from sanic.views import HTTPMethodView
from sanic.response import json
from sanic_openapi import doc
from task_runner.runner import check_endpoint
from ..model.database impor... |
# Copyright 2021 by RaithSphere
# With thanks to Ryuvi
# All rights reserved.
# This file is part of the NeosVR-HRM,
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
import argparse
import configparser
import logging
import math
... |
# 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 or agreed... |
import numpy as np
import pandas as pd
import os
import re
from glob import glob
import torch
import torchvision
import torch.nn as nn
from torch.utils.data import Dataset,DataLoader
from torchvision.io import read_image
import torchvision.transforms as T
from PIL import Image,ImageOps
import torch.nn.functional as F
f... |
import pytest
from mock import Mock
from spacy.tokens import Doc, Token
from spikex.defaults import spacy_version
from spikex.matcher import Matcher
@pytest.fixture
def matcher(en_vocab):
rules = {
"JS": [[{"ORTH": "JavaScript"}]],
"GoogleNow": [[{"ORTH": "Google"}, {"ORTH": "Now"}]],
"Ja... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
该脚本有两次运用
1.每天凌晨定时执行一次 默认的 #python send_spam_rpt.py
2.每分钟执行一次 检测是否有自定义发送时间的 #python send_spam_rpt.py customer_sendtime
"""
from gevent import monkey
monkey.patch_time()
monkey.patch_socket()
import re
import os
import sys
import time
import smtplib
import logging
im... |
import os
import sys
import time
import json
from Bio.Seq import Seq
from collections import defaultdict
def convert_to_relative_position(exon_list):
result, start = [], 0
for exon in exon_list:
exon_len = exon[-1]-exon[0]
# Using a list-index starting with 1
start = start+1
... |
import numpy as np
import unittest
import random
import warnings
from scipy.stats import pearsonr
from sklearn.datasets import make_classification, make_regression
from sklearn.model_selection import KFold, StratifiedKFold
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegressi... |
# Copyright (c) 2014 OpenStack Foundation.
#
# 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... |
import configparser
import os
import xmltodict
import logging
import argparse
from ardoqpy import ArdoqClient, ArdoqClientException
parser = argparse.ArgumentParser(description='Import ArchiMate Open Exchange Format files to Ardoq.')
parser.add_argument('-c', action="store", default='ardoq_archimate.cfg', help='Relati... |
# -------------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2018 pxlc<EMAIL>
#
# 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 re... |
#!/usr/bin/env python3
"""Computes consensus for RGZ classifications.
Heavily based on https://github.com/willettk/rgz-analysis, MIT licensed:
The MIT License (MIT)
Copyright (c) 2014 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation fi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 27 16:42:52 2019
@author: <NAME>
"""
import cv2
import numpy as np
import time
import math
import sys
class KalmanObj:
XX = 0.
PP = 0.01
def __init__(self, m, Qval, Rval):
self.K = np.zeros((m,m))
self.xx = np.zeros... |
# =====================================================
# Authors <NAME> and <NAME>
# =====================================================
import cairo
import gi
import shutil
import GUI
import Modal
import Functions as fn
import threading
import signal
gi.require_version('Gtk', '3.0')
gi.require_version('Gd... |
#%%
# Reproduce fixed point analysis figures
import math
import numpy as np
import numpy.linalg as linalg
import torch
import pandas as pd
import os
import os.path as osp
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from sklearn.decomposition import PCA
import scipy.s... |
"""
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 without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
import csv
import glob
import os
import re
import pandas as pd
import json
from statistics import *
class Point:
xAxis = []
yAxis = []
x = []
y = []
class LabelAnnotation:
text = []
def annotating_traces_to_json(traces, path):
if len(traces) == 0:
print_warning("Empty traces!")
... |
import copy
import torch
import numpy as np
from liegroups.torch import SO3, utils
def test_from_matrix():
C_good = SO3.from_matrix(torch.eye(3))
assert isinstance(C_good, SO3) \
and C_good.mat.dim() == 2 \
and C_good.mat.shape == (3, 3) \
and SO3.is_valid_matrix(C_good.mat).all()
... |
import argparse
import numpy as np
import tensorflow as tf
import scipy.stats as sps
import tensorflow_probability as tfp
import seaborn as sns
from matplotlib import pyplot as plt
from utils_model import softplus_inverse, expected_log_normal, monte_carlo_student_t, VariationalVariance
from callbacks import Regressio... |
# -*- coding: utf-8 -*-
"""Reads and prepares triples/statements for INDRA.
Run with:
python -m src.stonkgs.data.indra_extraction
"""
import json
import logging
import os
from typing import Any, Dict, List, Tuple
import networkx as nx
import pandas as pd
import pybel
from pybel.constants import (
ANNOTATIONS,
... |
"""Util functions for seed rejection on tracking
"""
import torch
from IPython import embed
from torchvision import transforms
def add_fourth_channel(image, random_pos, random_sz):
""" Performs normalization and adds fourth channel.
args:
image: The three channel RGB image.
random_pos: the tlx... |
##! usr/bin/python3
# %%
import config
from src.model.desc_model import define_style_descrminator, StyleNet
from src.model.gan_model import define_cnt_descriminator, define_gan, define_generator
#from src.model.wavelet_gan_model import define_cnt_descriminator, define_gan, define_generator
import os
import logging
i... |
"""WIP: Reporter that produces a text file that gives high level
information on the progress of a simulation.
"""
from collections import defaultdict
import itertools as it
import logging
from datetime import datetime
import time
from copy import copy
import numpy as np
import pandas as pd
from tabulate import tabulat... |
import koji as brew
import json
import sys
import os
import shutil
import tempfile
from optparse import OptionParser
# Do we want to filter through the CVE checker
filter_cve = True
# Just do the downloads, and don't alt-src
data_downloadonly = False
# This should never have CVEs and CVE checker hates it (timeout = ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 28 11:47:11 2022
@author: awatson
"""
'''
Make a browseable filesystem that limits paths to those configured in
settings.ini and according to authentication / groups.ini
'''
import traceback
from flask_login import (
current_user,
... |
import numpy as np
import os
import pickle
import sys
from statistics import median
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
from matplotlib import rc
from matplotlib import cm
import matplotlib
import matplotlib.patches as mpatches
import matplotlib
from collections import... |
# this is MetaVideo dataset that implementa lazy load
import torch
import torchvision
from torch.utils.data import Dataset
import glob, json
import numpy as np
import os
import socket, shutil, subprocess
from PIL import Image
from torchvision import transforms as T
from scipy.spatial.transform import Rotation, Slerp
im... |
"""
TODO:
copy in data dir
targzip
post
DONE:
clean date_time string
rename types:
type -> type_string
processed_type -> item_type
merge the data
save file
only 1 section (check content is correct): checked
"""
import datetime
import os
import re
import requests
import urllib.parse
import time
from bs4 impor... |
"""Data augmentation functionality. Passed as callable transformations to
Dataset classes.
The data augmentation procedures were interpreted from @weiliu89's SSD paper
http://arxiv.org/abs/1512.02325
"""
import torch
from torchvision import transforms
import cv2
import numpy as np
import random
import math
from utils... |
# -*- coding: utf8 -*-
"""
String functions
"""
from mathics.builtin.base import BinaryOperator, Builtin, Test
from mathics.core.expression import (Expression, Symbol, String, Integer,
from_python)
class StringJoin(BinaryOperator):
"""
>> StringJoin["a", "b", "c"]
=... |
#mutations:
#dshift by [val={1,3}]
#drandom delete 1
#drandom delete 3 consecutive
#drandom delete 3 random (essentially RD1 three times)
#drandom add 1
#drandom add 3 consecutive
#drandom add 3 random
#drandom switch
from argparse import ArgumentParser
import multiprocessing
import random
import statisti... |
import os
import pickle
import numpy as np
import torch
from torch.utils.data import Dataset
import re
import jieba
import fasttext
class InputExample(object):
def __init__(self, unique_id, text_a, text_b):
self.unique_id = unique_id
self.text_a = text_a
self.text_b = text_b
class Input... |
from logging import disable
import os
import configparser
from discord.ext import commands
import discord
from discord import Status
from discord.activity import Activity, ActivityType
from discord_components import Select, Button, DiscordComponents, interaction, ActionRow, SelectOption
from discord_components.componen... |
"""
OpenFlow 1.3 prints
"""
from hexdump import hexdump
from pyof.foundation.basic_types import BinaryData
import libs.tcpiplib.prints
from libs.gen.prints import red, green
from libs.openflow import of13
import libs.openflow.of13.dissector as dissector
from libs.tcpiplib.process_data import dissect_data
def prin... |
"""Wrapper around fortran's glacier code using ctypes
"""
from __future__ import division, print_function
import os, tempfile, warnings
from ctypes import CDLL, POINTER, c_int, c_double, c_char_p, c_bool, byref
# from numpy import empty, diff
import numpy as np
from .settings import GLACIERLIB # first import
# from .... |
""" Bivariate operators"""
from .base import *
from .activation import BoundSqrt, BoundReciprocal
class BoundMul(Bound):
def __init__(self, input_name, name, ori_name, attr, inputs, output_index, options, device):
super().__init__(input_name, name, ori_name, attr, inputs, output_index, options, device)
... |
from .numbers import Integer, Rational, Number
from .symbol import Symbol
from .operations import Pow, Mul, Add, base, exponent, term, const
from .subs import _map
from .evaluate import *
from .order import _isordered
from .matix import Matrix
from .symbol import Undefined
from fractions import gcd
#~~~~LE... |
# -*- coding: utf-8 -*-
"""
Preprocess Chigaco Taxi dataset from BigQuery to TFRecords using TensorFlow Transform
"""
import argparse
import pandas as pd
import numpy as np
import datetime
import os
import sys
import tensorflow as tf
import json
import apache_beam as beam
import tensorflow_transform as tft
from tenso... |
# 2020.02.26-Changed for building GhostNet
# Huawei Technologies Co., Ltd. <<EMAIL>>
# modified from the code: https://github.com/balancap/tf-imagenet/blob/master/models/mobilenet/mobilenet_v2.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 ... |
# -*- coding: utf-8 -*-
import disco
import gevent
import json
import requests
from random import randint, choice
from gevent.pool import Pool
from disco.bot import CommandLevels
from disco.types.user import User as DiscoUser
from disco.types.message import MessageTable, MessageEmbed
from rowboat.types import Field,... |
import torch
import torch.nn as nn
import torch.nn.functional as f
from prettytable import PrettyTable
from c2nl.modules.char_embedding import CharEmbedding
from c2nl.modules.embeddings import Embeddings
from c2nl.modules.highway import Highway
from c2nl.encoders.rnn_encoder import RNNEncoder
from c2nl.decoders.rnn_de... |
#!/usr/bin/env python3
# %WER 18.28 [ 3682 / 20138, 338 ins, 645 del, 2699 sub ]
"""
simple TDNNF implementation, but no randomization used. the updates
are done every iteration.
"""
import argparse
import os
import torch
import torch.optim as optim
import torch.nn.functional as F
import torch.nn as nn
import... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2019 <NAME>. See LICENSE file for details.
from __future__ import unicode_literals
import string
from logger import log
class FontManager(object):
def __init__(self):
self.fonts = dict()
# serif
# self.add_font([], 'accanthi... |
'''
Functionality for defining persistent, parameterizable computed asset types.
Exported definitions:
Artifact (abstract `Target` subclass): A typed view into a directory.
`Artifact` is intended to be subclassed by application authors.
DynamicArtifact (`Artifact` subclass): An artifact with dynamic fi... |
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.commit()
... |
import pytest
from iguanas.rules._convert_rule_dicts_to_rule_strings import _ConvertRuleDictsToRuleStrings
import pandas as pd
import numpy as np
@pytest.fixture
def _data():
np.random.seed(0)
X = pd.DataFrame(
{
'A': np.random.uniform(0, 100, 100),
'B': ['foo', 'bar'] * 50,
... |
import numpy as np
import cv2
import os
import glob
from os.path import join
import json
from data_utility import image_normalization
from keras.applications.vgg16 import preprocess_input
# load data directly from the npz file (small dataset, 48k and 5k for train and test)
def load_data_from_npz(file):
print("Lo... |
from mo_sql_parsing import parse
AGGREGATE_FUNCTIONS = ['max', 'min', 'count', 'avg', 'sum']
SCALAR_FUNCTIONS = ['sqrt']
BOOLEAN_OPERATORS = ['and', 'not', 'or']
COMPARISON_OPERATORS = ['eq', 'gt', 'gte', 'lt', 'lte', 'ne']
NULL_OPERATORS = ['exists', 'missing'] # exists → is not null, missing → is null
STRING_OPERA... |
import sys
import numpy as np
import pytest
from itertools import product
from stardist.models import Config3D, StarDist3D
from stardist.matching import matching
from stardist.geometry import export_to_obj_file3D
from csbdeep.utils import normalize
from utils import circle_image, real_image3d, path_model3d, NumpySequen... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
import numpy as np
from numpy.linalg import inv
from scipy.optimize import least_squares
import matplotlib.pyplot as plt
def find_nearest(array, values):
if array.ndim != 1:
array_1d = array[:,0]
else:
array_1d = array
values = np.atleast_1d(values)
values_idx = np.searchsorted(array... |
import os
from collections import defaultdict
from collections import namedtuple
from glob import glob
from random import shuffle
from tempfile import TemporaryDirectory
from time import sleep
import motmetrics
import torch
import numpy as np
from lap._lapjv import lapjv
from shapely.geometry import Point
from shapely... |
import os
import time
import math
import sys
class MergeJoin:
def __init__(self, m, left_relation, right_relation, tuples):
self.m = m # main memory buffers
self.tuples = tuples # number of tuples in one block
self.left_tuple_size = 0 # size of each tuple in bytes for left relation
... |
import base64
import cv2
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from chart_studio import plotly
import networkx as nx
import torch
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import Figur... |
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from python.Level1.stock import Stock
import pandas as pd
import numpy as np
import os
import s... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 11 14:52:30 2020
@author: firo
parallel run of experimental network with gamma fit waiting time distribution
"""
import sys
homeCodePath=r"H:\10_Python\005_Scripts_from_others\Laurent\wicking_pnm"
if homeCodePath not in sys.path:
sys.path.append(homeCodePath)
import... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
module: oracle_ldapuser
short_description: Syncronises user accounts from LDAP/Active directory to Oracle database
description:
- Syncronises user accounts from LDAP... |
import os
# comment out below line to enable tensorflow logging outputs
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(physical_devices) > 0:
tf.config.experimental.set_memory_growth(physical_devices[0], True)
import c... |
import six
from six.moves import range
import django
from django import forms
from django.contrib.admin.widgets import AdminFileWidget
from django.contrib.contenttypes.forms import BaseGenericInlineFormSet
from django.core import validators
from django.core.exceptions import ValidationError
from django.core.files.uplo... |
from owl_augmentator.owl_augmentator import augment, augment_class, AugmentationType
import owlready2
from .utils import *
import math
import numpy
from sympy import geometry
from shapely import wkt
from shapely.geometry import Point, Polygon, LineString
_INTERSECTING_PATH_THRESHOLD = 8 # s, the time interval in wh... |
import copy
import numpy as np
from PySide2.QtCore import QObject, QThreadPool, Qt, Signal
from PySide2.QtWidgets import QMessageBox
from hexrd import indexer, instrument
from hexrd.cli.find_orientations import write_scored_orientations
from hexrd.cli.fit_grains import write_results as write_fit_grains_results
from ... |
from flask import Flask
from flask import render_template
from flask import Blueprint
from flask import flash
from flask import request
from flask import redirect
from flask import jsonify
from flask import Markup
from flask import g
from flask import session
import functools
import json
import hashlib
import logging
... |
from Entities import *
import FX
import Img
import Object
missile=Img.sndget("Expmiss")
laugh=Img.sndget("bosslaugh")
tp=Img.sndget("teleport")
def bombattack(world,ssize):
while True:
tx=randint(9-ssize,9+ssize)
ty=randint(9-ssize,9+ssize)
if world.is_clear(tx,ty):
bomb=Bomb(tx,... |
# Test the initial velocity computation
import os
from shutil import copytree
from shutil import copy
def compute_initial_velocities(Q_100, num_cases_initial):
"""Create four cases on each side of the seconday draft input by user. two velocities on each side of the initial U_100
Computing the velociti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.