text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2017 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy... |
#!/usr/bin/env python3
# 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.
from inspect import isclass
from typing import Dict, List, Optional, Tuple, Type
import torch
from ax.core.types impor... |
# -*- coding: utf-8 -*-
#
"""
Created on Sat Sep 8 21:52:07 2018
@author: arjun
"""
import datetime
import json
import mongoengine
import xetrapal
import pandas
from . import documents, utils
from copy import deepcopy
import requests
from xetrapal import gdastras
from xetrapal import smsastras
a = xetrapal.karma.l... |
import itertools
import cv2
import yaml
import pathlib
import argparse
import concurrent.futures
from typing import Iterable, Union
import numpy as np
from data.data_set import DataSet
from scene import Scene
from scene.track.track import RailPoint
class SegmentationLabel:
"""
Generation of segmentation la... |
from copy import deepcopy
from globals import *
import zones as zns
import life as lfe
import render_los
import bad_numbers
import zones
import alife
import numpy
import tiles
import maps
import logging
import time
import sys
def astar(life, start, end, zones, chunk_mode=False, terraform=None, avoid_tiles=[], avoi... |
"""
This module implement classes to handle statistical tests on likelihood models
Author: <NAME>, 2011--2015
"""
import warnings
import numpy as np
from nibabel.onetime import auto_attr
from scipy.linalg import inv
from scipy.stats import t as t_distribution
from nilearn._utils.glm import positive_reciprocal
# In... |
import time
import argparse
import numpy as np
import torch
import matplotlib.pyplot as plt
from torch import nn, optim, autograd
import data_preprocess as data_pre
import random
def setup_seed(seed):
# 设置随机数种子
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)... |
### Author <NAME> and <NAME> - 1 June 2020 ###
# This script creates a changed view on media into classes of medium and supplements
## SHOULD BE IN PREPROCESSING TERRA
from dataclasses import dataclass, field
import numpy as np
import pandas as pd
import re
import argparse
import time
import warnings
# Currently use... |
########################################################################################################################
# #
# This file is part of kAIvy ... |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... |
import torch
import torch.nn as nn
from collections import deque
import numpy as np
import random
BATCH_SIZE = 128
LR = 0.01
START_EPSILON = 0.1
DELAY_EPSILON = 0.999
FINAL_EPSILON = 0.01
EPSILON = START_EPSILON
GAMMA = 0.99
MEMORY_SIZE = int(2e5)
MEMORY_THRESHOLD = int(1e3)
SYNE_FREQUENCY = int(1e3)
LEARN_FREQUENCY =... |
# Copyright (c) 2019 Leiden University Medical Center
#
# 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, me... |
"""
Copyright (c) 2020 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WI... |
# Crowdsrc imports
from crowdsrc.settings import TOKEN_EXPIRE_TIME
from crowdsrc.src.models import *
from crowdsrc.src.serializers import *
# Django imports
from rest_framework.serializers import Serializer, ModelSerializer, CharField, SerializerMethodField
from django.db.models import Model, Q
from django.contrib.aut... |
from instructions import to_stack_registers
from opcodes import INTERNAL_CALL_OPCODE
from expressionblock import ExpressionBlock
import os
def get_prefix(depth):
return " " * depth
class ExternalFunction(object):
def __init__(self, signature, graph, tracker, entry_exit):
self.signature = signature
self.grap... |
"""
Group related functions.
These group related functions generally align one-for-one with published API calls categorized in the group category
API v2 - https://t3n.zendesk.com/forums/21013480-Groups
Groups object variables:
groups.alias
Group object variables:
group.id
group.name
group.description
group.t... |
import json
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import EmailMessage
from django.db import transaction
from django.db.models import Q, Count
fr... |
# coding=utf-8
from time import sleep
from collections import namedtuple
import readchar
from math import *
import numpy
import json
import pigpio
from plotter import Plotter, Pen
from turtle_plotter import PantoGraphTurtle
def hypotenuse(side1, side2):
return sqrt(side1**2 + side2**2)
class PantoGraph(Plotter... |
# TODO update this code to the new API (IrrepsData)
import argparse
import random
import time
from itertools import count
import haiku as hk
import jax
import jax.numpy as jnp
import numpy as np
import optax
import torch
import torch.multiprocessing
import torch_geometric as pyg
import wandb
from e3nn_jax import (Gate... |
# NOTE: Could modularize this further by creating a fixtures dir and importing
# See: https://gist.github.com/peterhurford/09f7dcda0ab04b95c026c60fa49c2a68
from pathlib import Path
from random import randint
import json
import logging
import os
from bids.layout.writing import build_path as bids_build_path
import nibab... |
"""A module with functions for loading the pudl database tables."""
import contextlib
import logging
import os
import pandas as pd
import pudl
import pudl.constants as pc
logger = logging.getLogger(__name__)
class BulkCopy(contextlib.AbstractContextManager):
"""
Accumulate several DataFrames, then COPY FR... |
# Copyright 2014 Cloudbase Solutions Srl
# 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 r... |
# Copyright 2020 RethinkDB
#
# 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, so... |
"""
This module contains the code for regression analysis for the bug reporting
processes considered
"""
import time
import logging
import statsmodels.api as sm
import pandas as pd
import matplotlib.pyplot as plt
import gtconfig
import penaltyexp
import simdata
import syseval
if gtconfig.is_windows:
import winso... |
import os
import numpy as np
import mxnet as mx
import pickle
def load_pickle(pickle_file):
try:
with open(pickle_file, 'rb') as f:
pickle_data = pickle.load(f)
except UnicodeDecodeError as e:
with open(pickle_file, 'rb') as f:
pickle_data = pickle.load(f, encoding='l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
# class Prolog(object):
# def __init__(self):
# self.key = "PROLOG"
# self.File_Format = None
# self.Software = None
# self.Data_prepared_by = None
# self.Location = None
# self.Date_Local... |
#!/usr/bin/env python
# coding: utf-8
# We left off with the disturbing realization that even though we are satisfied the requirements of the sampling theorem, we still have errors in our approximating formula. We can resolve this by examining the Whittaker interpolating functions which are used to reconstruct the sig... |
"""The ABQ Data Entry application
Chapter 3 Version
"""
# Tkinter imports
import tkinter as tk
from tkinter import ttk
# For creating the filename
from datetime import datetime
# For file operations
from pathlib import Path
# For creating the CSV file
import csv
# Create a dict to hold our variables
variables = d... |
"""
# minHash Image Clustering (MHIC) algorithm (Seed Generation Only)
Implementation based on
* [Large-Scale Discovery of Spatially Related Images](ieeexplore.ieee.org/iel5/34/4359286/05235143.pdf) by <NAME> and <NAME>
* [Scalable Near Identical Image and Shot Detection - Microsoft](https://www.microsoft.com/en-us/r... |
"""
Python main script for plotting metrics of object detction groud truth vs predicted set
"""
import os
import numpy as np
import torch
import glob
from PIL import Image
from metrics_od.utils.general import xywh2xyxy,xyxy2xywh
from metrics_od.utils.metrics import ConfusionMatrix
def xyxy2cord(loaded_tensor,gn_... |
# -*- coding: utf-8 -*-
import os
import logging
import shutil
import datetime
from django.conf import settings
from django.db.models import Manager as DefaultManager
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from easy_thumb... |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# 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 a... |
import argparse
from datetime import datetime
import h5py
import numpy as np
import tensorflow as tf
import importlib
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = BASE_DIR
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'models'))
sys.path.append(os.path.join(RO... |
import multiprocessing
import multiprocessing.sharedctypes
import ctypes
import time
import logging
from collections import namedtuple
import traceback
from pymc3.exceptions import SamplingError
import errno
import numpy as np
from fastprogress.fastprogress import progress_bar
from . import theanof
logger = logging.... |
import pytest # noqa: F401
import calliope
import logging
import datetime
import os
import tempfile
import xarray as xr
import pandas as pd
from calliope.core.util import dataset, observed_dict
from calliope.core.util.tools import memoize, memoize_instancemethod
from calliope import exceptions
from calliope.core.u... |
from datetime import datetime, date
import os
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.files.storage import FileSystemStorage
from django.http import HttpResponse, JsonResponse
from django.shortcuts... |
"""Miscellaneous utility functions."""
from functools import reduce
from PIL import Image
import numpy as np
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
import spacy
import re
import cv2
import time
#from keras_bert.tokenizer import Tokenizer
#from keras_bert.loader import load_trained_model_from_checkpoint,... |
from django.contrib.auth.models import User
from django.shortcuts import render, render_to_response, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.urls import reverse, resolve
from django.utils.six.moves.urllib.parse import urlparse
from django.template import Contex... |
import pygame
BLACK = 0, 0, 0
WHITE = 255, 255, 255
DARK_GREEN = 65, 79, 71
GREEN = 89, 153, 78
BROWN = 193, 154, 107
FONT = None
onAutoMod = False
import time
class Instruction:
rect = pygame.Rect(0, 0, 600, 80)
text = "Your Goal is to Have One Peg Remaining"
def draw(self, surf):
text = FONT.ren... |
import json
import time
import nltk
import pandas as pd
import requests
from bs4 import BeautifulSoup
import argparse
from tqdm import tqdm
SLEEP_TIME = 1.5
# Websession Parameters
GSCHOLAR_URL = 'https://scholar.google.com/scholar?start={}&q={}&hl=en&as_sdt=0,5'
ROBOT_KW = ['unusual traffic from your computer netwo... |
from typing import List
import torch
from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence
def add_vector( x: torch.Tensor, v: torch.Tensor, dim: int) -> torch.Tensor:
sh = [1]*x.ndim
sh[dim] = len(v)
return x + v.view(*sh)
def div_vector( x: torch.Tensor, v: torch.Tensor, dim: int) -> torc... |
import os
import numpy as np
import cv2
import math
def DCmakedir(path):
if os.path.exists(path):
return
else:
os.mkdir(path)
def imageRotate(img,theta):
rows,cols = img.shape[0:2]
angle = -theta*math.pi/180
a = math.sin(angle)
b = math.cos(angle)
width = int(cols * math.fa... |
#!/usr/bin/env python
import unittest
import cogent3.align.progressive
import cogent3.evolve.substitution_model
from cogent3 import DNA, make_unaligned_seqs
from cogent3.align.align import (
classic_align_pairwise,
global_pairwise,
local_pairwise,
make_dna_scoring_dict,
make_generic_scoring_dict,... |
import tkinter as tk
from tkinter import Message, Text
import cv2
import shutil
import csv
import os
import numpy as np
from PIL import Image,ImageTk
import pandas as pd
import datetime
import time
import tkinter.ttk as ttk
import tkinter.font as font
window = tk.Tk()
window.title("Face_Recogniser")
dialog_title = '... |
import argparse
import os
import pandas as pd
import matplotlib.pyplot as plt
import sys
sys.path.append('../')
from load_paths import load_box_paths
import matplotlib as mpl
import matplotlib.dates as mdates
from datetime import date, timedelta, datetime
import seaborn as sns
from processing_helpers import *
# from ... |
#!/usr/bin/env python
#
# author: <NAME>
#
# This program provides a MPI-based parallization for checksumming
#
#
from __future__ import print_function
import os
import hashlib
import argparse
import stat
import sys
import signal
import cPickle as pickle
import shutil
from mpi4py import MPI
from cStringIO import String... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: <NAME> <<EMAIL>>
# @date: Tue Aug 11 14:07:00 CEST 2015
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... |
"""
Mechanism base class, as well as helper functions for parsing Mechanism arguments
to pycryptoki functions.
"""
import logging
from ctypes import c_void_p, cast, pointer, POINTER, sizeof, create_string_buffer, c_char
import warnings
from six import integer_types, binary_type
from pycryptoki import cryptoki
from p... |
import os
import random
import time
import pytest
from ufo2ft.fontInfoData import (
dateStringToTimeValue,
getAttrWithFallback,
normalizeStringForPostscript,
)
@pytest.fixture
def info(InfoClass):
self = InfoClass()
self.familyName = "Family Name"
self.styleName = "Style Name"
self.units... |
import fnmatch
import json
import urllib.parse
from collections import defaultdict
from collections import namedtuple
from collections.abc import Mapping, Sequence
from functools import partial
from os import path, environ
from tornado import template
from ..__version__ import __version__ as version
from ..exceptions... |
#!/usr/bin/env python
"""
Retrieve the latest service health data from https://status.aws.amazon.com/data.json and
process it to build a database of service outtages.
https://status.aws.amazon.com/ contains a list of services and their regions in unfriendly
Javascript and HTML.
"""
import requests
import re
from bs4 ... |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: gdal_retile.py testing
# Author: <NAME> <even dot rouault @ mines-paris dot org>
#
###############################################################################... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,md,py:nomarker
# text_representation:
# extension: .py
# format_name: nomarker
# format_version: '1.0'
# jupytext_version: 1.10.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ## CNN - Data... |
#MenuTitle: Kerning: Set Groups
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import copy
__doc__="""
Sets kerning groups and tags.
"""
Glyphs.clearLog()
#Glyphs.showMacroWindow()
# set kerning group for base glyphs
list = """
a a n
b h o
c o c
d o d
e o e
schwa o o
f f f
g g g
h... |
import logging
from typing import Any
from typing import Dict
from typing import Iterable
from typing import List
import boto3
import botocore.exceptions
import neo4j
from . import ec2
from . import organizations
from .resources import RESOURCE_FUNCTIONS
from cartography.config import Config
from cartography.intel.aw... |
"""Transfer the required public functions."""
# Import built-in modules
from __future__ import print_function
import codecs
import json
import logging
import os
import re
import subprocess
import sys
import time
import configparser
from builtins import str
# Import local models
from rayvision_sync.constants import ... |
#!/usr/bin/env python3
import os
import sys
from datetime import datetime
import datetime as dt
import argparse
import csv
import numpy as np
import time
import itertools
import random
import pickle
import re
import math
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
import matplotlib.dates as m... |
# -*- coding: utf8 -*-
import logging
# from settings import CLASS_LEVEL1
# import all the variables and classes in .py
from settings import VOCABULARY_SIZE
from settings import SAVE_DIR
from settings import TRAINING_INSTANCES
from settings import TRAIN_SET_PATH
import os
import sys
import pandas
import numpy
import ... |
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.shortcuts import redirect
from django.utils.translation.trans_real import to_language
import commonware.log
import jingo
import waffle
from waffle.decorators import waffle_switch
import amo
from amo.decorators import l... |
import numpy as np
import math
from .split import split1
from .util import add_value
from . import global_val as gv
import pdb
def __vert1(j, z, f, x1, x2, f1, f2):
if j == 0:
j1 = 1
else:
j1 = 0
x = z[j1]
if x1 == math.inf:
x1 = z[j]
f1 = f1 + f[j]
elif x2 == mat... |
from __future__ import annotations
import re
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import List
from typing import Optional
from typing import overload
from typing import Tuple
from typing import Type as TypingType
from typing import TypeVar
from typing import Union
... |
import traceback
import math
import numpy as np
import litenn as nn
import litenn.core as nc
from litenn.core import CLKernelHelper as ph
def conv2DTranspose (input_t, kernel_t, stride=2, dilation=1, padding='same'):
"""
conv2DTranspose operator.
input_t Tensor shape must be
... |
"""
KeyValueDisplay, a collection of labels and entry pairs that functions like
a budget MultiframeList.
"""
import tkinter as tk
from tkinter import ttk
# Format using w as targeted bindtag, tw as widget to scroll.
SCROLLCOMMAND = """
if {{[tk windowingsystem] eq "aqua"}} {{
bind {w} <MouseWheel> {{
{tw} yview sc... |
#!/usr/bin/env python3
"""Generate psa_constant_names_generated.c
which is included by programs/psa/psa_constant_names.c.
The code generated by this module is only meant to be used in the context
of that program.
An argument passed to this script will modify the output directory where the
file is written:
* by defaul... |
"""ImageNet data module."""
import argparse
import json
import multiprocessing as mp
import os
from time import time
from typing import Dict, List, Optional, Tuple
import numpy as np
from torch.utils.data import DataLoader
from torchvision import transforms
from imagenet_training.data.base_data_module import BaseDa... |
import random
from random import sample
import argparse
import numpy as np
import os
import pickle
from tqdm import tqdm
from collections import OrderedDict
from sklearn.metrics import roc_auc_score
from sklearn.metrics import roc_curve
from sklearn.metrics import precision_recall_curve
from sklearn.covariance import L... |
import copy
import os
import sys
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import torch
import numpy as np
import codes.graph_utils as gu
from codes.simulator import ByzantineWorker, DummyDecentralizedTrainer
from codes.utils import filter_entries_from_json
from codes.attacks import get... |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2019-08-02 14:38:36
# @Last Modified by: <NAME>
# @Last Modified time: 2020-07-03 09:23:07
# @Email: <EMAIL>
import cv2
import math
import numpy as np
import torch
import transforms3d
class Compose(object):
def __init__(self, transforms):
self.transf... |
from pytube import YouTube
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import We... |
"""Platform for Flexit AC units with CI66 Modbus adapter."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
ClimateEntityFeature,
HVACAction,
HVACMo... |
import logging
import uuid
import requests
import paypalrestsdk as paypal
from django.db import models
from django.conf import settings
from django_extensions.db.models import TimeStampedModel, TitleSlugDescriptionModel
from django.urls import reverse_lazy
from django.core.mail import mail_managers
from framework.beh... |
#encoding=utf-8
'''
@Time : 2020/11/17 08:40
@Author : Inacmor
@File : body.py
@Noice :
@Modificattion :
@Author :
@Time :
@Detail :
'''
import torch.nn as nn
import torch.nn.functional as F
import torch
from model.net.backbone import Conv_BN_Act, CSPDarknet53
... |
#!/usr/bin/env python3
""" Graph Visualizer using Pygame
"""
import sys
import enum
import math
import pygame
import argparse
import graph_algo
from functools import partial
class Color(enum.Enum):
# Material Theme Colors
Background = (38, 49, 50)
Barrier = (176, 190, 196)
Visited = (255, 81, 81)
... |
from random import shuffle
from os import getcwd
from pathlib import Path
#Function performs smict to induce tag hierarchy
def smict(annotations, vocabulary = None, alpha = 0.7):
#If vocabulary not given, generate vocabulary
if vocabulary == None:
vocabulary = []
for entity in annotations:
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 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/LICE... |
from dataclasses import dataclass
from typing import Optional
import django_tables2 as tables
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.db.models import DateField, DateTimeField
from django.template import Context, Template
from django.urls import reverse
from dj... |
import math
import time
from typing import Tuple
import numpy as np
from pgdrive.utils.cutils import import_cutils
cutils = import_cutils()
number_pos_inf = float("inf")
number_neg_inf = float("-inf")
def safe_clip(array, min_val, max_val):
array = np.nan_to_num(array.astype(np.float), copy=False, nan=0.0, pos... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
def conv_pass(
fmaps_in,
kernel_size,
num_fmaps,
activation="relu",
name="conv_pass",
fov=(1, 1, 1),
voxel_size=(1, 1, 1),
prefix="",
):
"""Create a convolution pass::
f_in... |
import abc
from copy import copy
from functools import partial, singledispatch
from typing import Callable, Dict, List, Optional, Tuple, Union
import aesara.tensor as at
from aesara.gradient import DisconnectedType, jacobian
from aesara.graph.basic import Apply, Node, Variable
from aesara.graph.features import Already... |
from bs4 import BeautifulSoup
from catwarbot import game
import json
import statistics
def init_map():
with open("catwarbot/map/mapa-final.xml") as fp:
data = fp.read()
with open("catwarbot/map/steps/mapa_0.svg", "w") as fp:
fp.write(data)
def print_frontera(root, t1, t2, css_class):
fro... |
"""Test suite for our zeromq-based message specification."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import re
import sys
from distutils.version import LooseVersion as V
try:
from queue import Empty # Py 3
except ImportError:
from Queue import Empt... |
#!/usr/bin/env python
#coding=utf-8
import rospy
from gazebo_msgs.srv import *
from math import cos, pi, sin, sqrt
class _Getch:
"""Gets a single character from standard input. Does not echo to the
screen."""
def __init__(self):
try:
self.impl = _GetchWindows()
except Import... |
# 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
# distributed under the ... |
import datetime as dt
from os.path import join
from typing import Dict, List, Tuple, Union
import click
import pandas as pd
from pyspark.sql import SparkSession, functions as F
import bgbb_airflow
from bgbb import BGBB
from bgbb.sql.bgbb_udfs import add_mau, add_p_th, mk_n_returns_udf, mk_p_alive_udf
from bgbb_airflo... |
from __future__ import division
import os
import sys
import re
import string
import json
import time
import math
from collections import Counter
import numpy as np
import networkx as nx
import base64
import csv
# padding, unknown word, end of sentence
base_vocab = ['<PAD>', '<UNK>', '<EOS>']
padding_idx = base_vocab.... |
#!/usr/bin/env python3
#
# Copyright (C) 2017-2019 <NAME>, <NAME>, <NAME>
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Given a AFL or kAFL workdir, process the contained corpus in
kAFL Qemu/KVM to obtain PT traces of individual inputs.
The individual traces are save... |
"""Module grouping tests for the sondering search module."""
import datetime
import pandas as pd
import pytest
from owslib.fes import PropertyIsEqualTo
from pydov.search.boring import BoringSearch
from pydov.search.sondering import SonderingSearch
from pydov.types.boring import Boring
from pydov.types.sondering impor... |
from typing import Optional, List
import torch
import torch.nn.functional as F
import torch.distributed as dist
from torch import Tensor
from torch.nn.parameter import Parameter
from . import _reduction as _Reduction
from ..__init__ import _PARALLEL_DIM
from ..__init__ import set_attribute
from ..distributed import... |
import functools
import re
import parsimonious
from parsimonious import (
expressions,
)
from eth_abi.exceptions import (
ABITypeError,
ParseError,
)
grammar = parsimonious.Grammar(r"""
type = tuple_type / basic_type
tuple_type = components arrlist?
components = non_zero_tuple / zero_tuple
non_zero_tup... |
import os
import json
import boto3
import botocore
import logging
import datetime
import isodate #pip3 install isodate --target .
from urllib.parse import unquote
from flatten_json import flatten #pip3 install flatten_json==0.1.7 --target .
logger = logging.getLogger()
logger.setLevel(os.environ['LOG_LEVEL'])
s3Re... |
import keras
import argparse
import numpy as np
from keras.datasets import cifar10, cifar100
from keras.preprocessing.image import ImageDataGenerator
from keras.layers.normalization import BatchNormalization
from keras.layers import Conv2D, Dense, Input, add, Activation, GlobalAveragePooling2D
from keras.callbacks impo... |
# Copyright (c) 2018 Cloudify Platform Ltd. 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 ap... |
"""This module sets up type classes like DictType and ListType that
define types for arbitrary objects. The main use case is to specify
the types of Zulip events that come from send_event calls for
verification in test_events.py; in most other code paths we'll want to
use a TypedDict.
This module consists of workarou... |
import pytest
from firedrake import *
import thetis.utility as utility
import numpy as np
@pytest.fixture(scope="module")
def mesh2d():
return UnitSquareMesh(5, 5)
@pytest.fixture(scope="module")
def mesh(mesh2d):
fs = utility.get_functionspace(mesh2d, 'CG', 1)
bathymetry_2d = Function(fs).assign(1.0)
... |
import wx
import re
import platform
import datetime
import Utils
reNonTimeChars = re.compile('[^0-9:.]')
def secsToValue( secs, allow_none, display_seconds, display_milliseconds ):
if secs is None and allow_none:
return secs
v = Utils.formatTime(
secs,
highPrecision=True, extraPrecision=True,
forceHours... |
# coding=utf-8
# Copyright 2018 The TF-Agents 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 applicable law... |
import operator
import sys
import cv2
import matplotlib.pyplot as plt
# """
# throw error and exit
# """
# def error(msg):
# print(msg)
# sys.exit(0)
"""
check if the number is a float between 0.0 and 1.0
"""
def is_float_between_0_and_1(value):
try:
val = float(value)
if val > 0.0 an... |
import json
import uuid
import shlex
from datetime import datetime
from copy import deepcopy
from functools import reduce
from collections import Mapping, defaultdict
from .schema import TransformationTypes, ARG_MAP
from .transformer import BaseTransformer
def update_nested_dict(d, u):
for k, v in u.items():
... |
import itertools
import json
import random
import time
from ast import literal_eval as make_tuple
from multiprocessing import Process, Queue
import numpy as np
import psutil
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.gaussian_process i... |
from __future__ import print_function
from flask import Flask
from flask import request
from flask import render_template
from google.cloud import speech_v1p1beta1 as speech
from sklearn.metrics.cluster import adjusted_rand_score
import io
import os
import logging
import time
import boto3
import uuid
import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.