text stringlengths 3.07k 22.1k |
|---|
"""Access NLDI and WaterData databases."""
import numbers
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import geopandas as gpd
import networkx as nx
import numpy as np
import pandas as pd
from pandas._libs.missing import NAType
from pygeoutils import InvalidInputType
from .exceptions impo... |
from django_enumfield import enum
class BetterEnum(enum.Enum):
def is_an_enum(label):
return label in EmotionType.labels.values()
is_an_enum = staticmethod(is_an_enum)
def get_enum_from_label(label):
if not EmotionType.is_an_enum(label):
return -1
return EmotionType.lab... |
""" compile_labels.py
Compiles all available labels in a single file.
"""
import os, sys
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
def load_original_dataset(labels_dataset_addr, relative_label_addr, dataset_addr):
if dataset_a... |
#-*-coding: utf-8 -*-
"""
/dms/utils_form.py
.. enthaelt Hilfefunktionen zum Aufbau von Formularen
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 09.05.2007 Beginn der Arbeit
0.02 ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... |
"""
# Copyright (c) 2018 Works Applications 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... |
#!/usr/bin/env python
import argparse
from argparse import ArgumentParser
import json
from datetime import datetime
import math
import operator
import os
import sys
import re
def create_parser():
parser = ArgumentParser(description='Generate an HTML document containing interactive charts composed of data from mul... |
from pathlib import Path
import pytest
from valarpy import Valar
@pytest.fixture(scope="module")
def setup():
with Valar(Path(__file__).parent / "resources" / "connection.json"):
yield
class TestMetamodel:
def test_create(self, setup):
from valarpy.model import Users
user = Users(... |
import os
import logging
import time
import warnings
import numpy as np
import cv2
from PIL import Image
def random_hsv(img,ratio=0.5):
random_hsv_ratio = np.random.uniform(ratio, 1.0+ratio, 3)
hsv_img = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
hsv_img = hsv_img.astype(np.uint16)*random_hsv_ratio
hsv_im... |
import math
import random
from typing import Dict, Any, Optional, Tuple
import PIL
import torch
from PIL import Image
from torchvision import transforms as transforms
import rock.ssd.prior_boxes
from rock.ssd.encoder import Encoder
from rock.ssd.encoder import iou
class SSDCropping(object):
""" Cropping for SSD... |
import json
import os
import pickle
import re
import sys
from pathlib import Path
def get_path_projects(path_olap: str):
"""
:return:
['$HOME\\projects\\automate-ssas-build\\examples/bi-project_name-olap',
'C:\\Users\\Env:USER\\projects\\automate-ssas-build\\examples/bi-TWO-olap']
"""
list_pa... |
from flask import (
render_template,
flash,
redirect,
url_for,
request,
jsonify,
current_app,
send_from_directory,
abort,
)
from flask_babelex import _
from flask_login import current_user, login_required
from datetime import datetime
from app import db
from app.models import PartDe... |
import os
import json
import logging
from django.conf import settings
from rest_framework.exceptions import ValidationError
from api.utilities.basic_utils import read_local_file
from api.data_structures import create_attribute, \
DataResourceAttribute, \
VariableDataResourceAttribute, \
SimpleDag, \
D... |
# coding=utf-8
import sys
import os
sys.path.append(os.path.dirname(os.getcwd()))
from argparse import ArgumentParser
import cv2
import PIL.Image
import skvideo.io
import numpy as np
# import Brutesac
import SaddlePoints
from functools import wraps
import time
from scipy.spatial import ConvexHull
def predictOnTiles(ti... |
import pytz
from django.db import models
from django.conf import settings
from phonenumber_field.modelfields import PhoneNumberField
from django.contrib.auth.models import User
import uuid
import logging
from django.utils import timezone
from django.utils.translation import gettext as _
from django.utils import transl... |
#encoding=utf-8
"""
Created on 9:52 2018/11/14
@author: <NAME>
"""
# encoding=utf-8
"""
Created on 15:09 2018/11/13
@author: <NAME>
"""
import numpy as np
import scipy.io
import scipy.linalg
import sklearn.neighbors
import sklearn.metrics
def kernel(ker, X, X2, gamma):
if not ker or ker == 'pr... |
import os
import re
import json
import requests
import unicodedata
import pandas as pd
from datetime import datetime
SHEET_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vTt0fy2RR0fMYkm71jftBCGeP3ehHPiKbhjINx9wVSuFMPZaQAM0rZLcAEmKEbhCbvjSPugStZnENgB/pubhtml?gid=73056877&single=true"
def url_content(url):
... |
from unittest import SkipTest
from nose.plugins.attrib import attr
import numpy as np
from holoviews import Curve, Points, Image, Dataset, RGB, Path, Graph
from holoviews.element.comparison import ComparisonTestCase
try:
from holoviews.operation.datashader import (
aggregate, regrid, ds_version, stack, di... |
"""
Updated and maintained by <EMAIL>
Copyright 2022 destination2unknown
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import tkinter as tk
class PID(object):
def __init__(
self,
Kp=1.0,
Ki=0.1,
Kd=0.01,
setpoin... |
import pickle
import argparse
import collections
import tree
import torch
import models
import data_utils
import train_helper
import numpy as np
from tqdm import tqdm
MAX_LEN = 30
batch_size = 1000
parser = argparse.ArgumentParser()
parser.add_argument('--save_file', '-s', type=str)
parser.add_argument('--vocab_... |
import torch
import torch.nn as nn
from src.inputters.dataset import SOS_token, PAD_token
class ContextRNN(nn.Module):
def __init__(self, vocab_size, hidden_size, dropout, n_layers=1, use_cuda=False):
super(ContextRNN, self).__init__()
self.vocab_size = vocab_size
self.hidden_size = ... |
#!/usr/bin/env python3
from __future__ import with_statement
import os
import sys
import errno
import argparse
import code
import pprint
import json
import stat
import fuse
import fusepy
import time
import urllib3
import requests
import certifi
from fusepy import FUSE, FuseOSError, Operations
from boxsdk import OAut... |
"""
This module contains the tests for timeconv function
"""
# Standard library imports
# Third party imports
from pytest import approx
#https://www.scivision.dev/pytest-approx-equal-assert-allclose/
import numpy as np
from numpy.random import default_rng
# Local application imports
from myorbit.util.timeut import *
f... |
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
# See LICENSE. <EMAIL>.
"""Steezy Yara rule Generator.
Python script written to make a lazy Irish person do less work.
"""
import os
import re
import sys
import logging
import argparse
from pprint import PrettyPrinter
import r2pipe
from mkyara import YaraGenerator
fro... |
import numpy as np
import pandas as pd
import numpy.random as npr
from operator import xor
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(font_scale = 1.3)
sns.set_style('white')
def pns(z, y):
y_giv_z = np.sum(z * y) / np.sum(z)
y_giv_nz = np.sum((1-z) * y) / np.sum(1-z)
lb = np.maximu... |
import re
import primer3
from .utils import *
from .models import Job
from .router import in_database
from .thirds.issr import generate_alignment
from django.http import JsonResponse
def display_location(gid):
show = 'false'
db_config = get_ssr_db(gid)
with in_database(db_config):
count = SSRAnnot.objects.coun... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 12 12:30:30 2021
@author: sahand
"""
import pandas as pd
import numpy as np
from tqdm import tqdm
dir_root = '/home/sahand/GoogleDrive/Data/Corpus/Dimensions AI unlimited citations/clean/' # ryzen
# dir_root = '/mnt/6016589416586D52/Users/z5204044/G... |
import os
import tempfile
from easydict import EasyDict
import click
import cv2
import numpy as np
import pandas as pd
import tensorflow as tf
from luminoth.utils.mosaic import assemble_mosaic, _set_fill_value
from luminoth.utils.overlay_bbs import overlay_bb_labels
from luminoth.utils.split_train_val import LUMI_CSV... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import namedtuple
import pandas as pd
import numpy as np
from queue import Queue
from collections import deque
Item = namedtuple("Item", ['index', 'value', 'weight'])
# def solve_it(input_data):
# # Modify this code to run your optimization algorithm
# ... |
#!/usr/bin/env python3
# SWACheckInBot.py - checks in for a SWA flight based on user input
from datetime import date, datetime, time, timedelta
import os
import pathlib
import re
import sys
from time import sleep
import pyinputplus as pyip
from selenium import webdriver
from selenium.webdriver.common.by import By
fr... |
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import math
import numpy as np
from Simple_FISs import split_vector_given
def get_plot_points(fuzzy_system):
def to_x_y_vectors(centers, widths):
x_values = []
y_values = []
for center, width in zip(centers, widths):
... |
# -*- coding: utf-8 -*-
""" Deep CEST/MT-MRF reconstruction
A deep NN is used for mapping CEST parameters from raw CEST-MRF data
Or Perlman 2021 (<EMAIL>)
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
import scipy.io as sio
import matplotlib... |
# This file contains mostly numpy reference implementations for ground truth bbox encoding for the yolo loss.
import numpy as np
from scipy.special import logit, expit
class Box:
def __init__(self):
self.xmin = None
self.ymin = None
self.xmax = None
self.ymax = None
self.... |
import json
import yaml
import os
import sys
import subprocess
from shutil import copy
BUILDTEST_VERSION = "0.7.6"
BUILDTEST_ROOT = os.getenv("BUILDTEST_ROOT")
# test scripts that need to be run locally
BUILDTEST_BUILD_LOGFILE = os.path.join(os.getenv("BUILDTEST_ROOT"), "var", "build.json")
BUILDTEST_SYSTEM = os.pa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 10 16:44:44 2015
@author: tsz
"""
from __future__ import division
import os
import numpy as np
import math
import xlrd
from pycity_base.functions import change_resolution as chres
# Sources:
# [1] BDEW/VKU/GEODE-Leitfaden. Abwicklung von Standard... |
# -*- coding: utf-8 -*-
# @author: edgardeng
# @date: 2021-05-25
# @file: 使用PdfMine 提取文字 (pdfminer.six == 20201018)
import base64
import math
import time
import pdfminer
from pdfminer.converter import PDFPageAggregator
from pdfminer.pdfdocument import PDFTextExtractionNotAllowed, PDFDocument
from pdfminer.pdfinterp... |
import random
from itertools import chain
from .genes import NeuronGene, ConnectionGene, GeneticEncoding
from .specs import NumericParamSpec, NominalParamSpec
from .utils import zip_with_probabilities, weighted_random
class all_types_in_spec: pass
class Mutator:
def __init__(self,
net_spec,
in... |
#!
# Description:
#*************
# Python script containing various functions used to calculate the sine and cosine parts of the perturbed
# impurity density. All functions are based on the following paper
# http://aip.scitation.org/doi/abs/10.1063/1.873593
#
# Created by: <NAME> (07-12-2017)
######################... |
# The MIT License (MIT)
# Copyright (c) 2019 by the xcube development team and contributors
#
# 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... |
#!/usr/bin/python
###############################################################################
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License Version 2.0 (the "License... |
"""
Authors: <<NAME>, <NAME>>
Copyright: (C) 2019-2020 <http://www.dei.unipd.it/
Department of Information Engineering> (DEI), <http://www.unipd.it/ University of Padua>, Italy
License: <http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0>
"""
import os
os.environ["CUDA_VI... |
import bpy
from bpy.props import StringProperty, BoolProperty, EnumProperty
from ..rfb_utils import shadergraph_utils
from ..rfb_utils import object_utils
from ..rfb_logger import rfb_log
from .. import rman_bl_nodes
from ..rman_constants import RMAN_STYLIZED_FILTERS, RMAN_STYLIZED_PATTERNS, RMAN_UTILITY_PATTERN_NAMES ... |
import sys
sys.path.append( '..' )
from queueDbLib import GenericQueueDb
from collections import OrderedDict
BUY_QUEUE_DB = None
class AlreadyBeingServedException( Exception ):
pass
class QueueClosedException( Exception ):
pass
class QueueFullException( Exception ):
pass
class BuyQueue():
... |
import json
from django.utils.decorators import method_decorator
from django.db.models import Q
from django.views.decorators.cache import cache_page
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth import update_session_auth_hash
from rest_framework import permissions, status, views... |
import json
import logging as log
import multiprocessing
import random
import re
import threading
import time
from concurrent.futures import ThreadPoolExecutor, wait, FIRST_COMPLETED
from urllib.parse import urlencode
import requests
from config import config
from constant import constant
from param import covid_req_... |
#MethodID="train-simple-dl-v1-0"
import pandas as pd
import tensorflow as tf
import sys
import numpy as np
import random
#from matplotlib.image import imread
import glob
import os
from PIL import Image
def WriteRecord(image,label,replica):
#read file:
#sample_rate, audio = wavfile.read(os.path.join(WAV_DIR,... |
'''
valohai/ulid2: ULID (Universally Unique Lexicographically Sortable Identifier) encoding and decoding for Python.
https://github.com/valohai/ulid2
The MIT License (MIT)
Copyright (c) 2016 Valohai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated document... |
# Created By: <NAME>
# Created On: 2006/03/03
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_... |
#########
# Copyright (c) 2013 GigaSpaces Technologies 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... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
#!/usr/bin/env python
"""
Raft: Streaming processing of STIX data. EXPERIMENTAL - you
probably don't want to use this for anything serious.
"""
import re
from collections import OrderedDict
import ijson
import orjson
import requests
INVERTED_REFS = {
'x_child_of_ref': 'parent_ref',
'x_resolves_to_of_ref': ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
''' Load '''
from __future__ import unicode_literals
import os, sys, zlib, base64, json, time, random, logging
from locale import getdefaultlocale
from tkinter import *
from tkinter import messagebox, filedialog, ttk
name = 'logs/ofuspy_{}_{}.log'.format(time.strftime('%Y-%... |
# ActivitySim
# See full license in LICENSE.txt.
import logging
import sys
import pandas as pd
from collections import OrderedDict
from activitysim.core import pipeline
from activitysim.core import inject
from activitysim.core import config
from activitysim.core.config import setting
logger = logging.getLogger(__na... |
import os
import pygame as pg
from python.src.core.test_4.spritesheet import SpriteSheet
pg.init()
#
clock = pg.time.Clock()
# Window in which the game will be displayed in
window = pg.display.set_mode((500, 500))
# Background representing space in window's background
bg = pg.image.load(os.path.join("../sprites",... |
# Example usage:
# python3 zkchannel_pytezos_mgr.py --contract=zkchannel_contract.tz --cust=tz1iKxZpa5x1grZyN2Uw9gERXJJPMyG22Sqp.json --merch=tz1bXwRiFvijKnZYUj9J53oYE3fFkMTWXqNx.json --custclose=cust_close.json --merchclose=merch_close.json
import argparse
from pprint import pprint
from pytezos import pytezos
from p... |
class EMA():
def __init__(self, beta):
super().__init__()
self.beta = beta
def update_model_average(self, ma_model, current_model):
for current_params, ma_params in zip(current_model.parameters(), ma_model.parameters()):
old_weight, up_weight = ma_params.data, current_param... |
from util import *
from KA import NedeterminističkiKonačniAutomat as NKA
class RegularniIzraz(types.SimpleNamespace, abc.ABC):
"""Svaki RegularniIzraz predstavlja neki regularni jezik,
dobiven pomoću operacija unije, konkatenacije te Kleenejevih operatora
iz inicijalnih jezika (∅, ε, te elementarnih jezik... |
# -*- coding: utf-8 -*-
from typing import Union
import numpy as np
def Q_star_H(
HRR: float,
height: float
):
# Calcualtes non-dimensional HRR. HRR must be in [W] and height in [m]
q_star = HRR / (1.11e06 * height ** (5 / 2))
return q_star
def Q_star_D(
HRR: float,
diam... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""
Defines types of reserve target and components that contribute to reserves,
and enforces the reserve targets.
"""
import os
from pyomo.environ import *
# TODO: use standard reserves module for this
def define_arguments(argparser):
argparser.add_argument('--reserves-from-storage', action='store_true', default=... |
import trimesh
import numpy as np
import quaternion
# original obj operations by Zhengqin
def loadMesh(name ):
vertices = []
faces = []
with open(name, 'r') as meshIn:
lines = meshIn.readlines()
lines = [x.strip() for x in lines if len(x.strip() ) > 2 ]
for l in lines:
if l[0:2] == ... |
"""
Author: Darren
Date: 23/12/2021
Solving https://adventofcode.com/2021/day/23
Need to rearrange amphipods from:
############# to #############
#...........# #...........#
###A#D#B#C### ###A#B#C#D###
#B#C#D#A# #A#B#C#D#
######### #########
Different movement costs for different types o... |
import sys
sys.path.append("..")
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
from metrics import calculate_kl as KL_DIV
# from ..misc import ModuleWrapper
import dgl.function as fn
class GraphModuleWrapper(nn.Module):
"""Wrapper for nn.Module with... |
import torch
import time
import numpy as np
import io
import base64
from PIL import Image
import scipy
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = ... |
import math
from necrobot.race import racedb
from necrobot.util import console, racetime
from necrobot.util.category import Category
from necrobot.util.singleton import Singleton
class CategoryStats(object):
def __init__(self, category):
self.category = category
self.number_of_races = 0
s... |
# (c) 2010, 2013 <NAME>; see https://github.com/mar10/tabfix
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
Helpers to implement a recursive file processing command line script.
Verbosity:
Verbose modes (default: 3)
0: quiet
1: errors only
2: errors and su... |
"""Learner component for DrQV2."""
from functools import partial
import time
from typing import Iterator, NamedTuple, Optional
from acme import core
from acme import types as acme_types
from acme.jax import networks as networks_lib
from acme.jax import types as jax_types
from acme.jax import utils
from acme.utils impo... |
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from random import randint, random
from math import atan2, sin, cos
counter = 0
from time import time
# Line class for simple lines created using opengl lines.
class SimpleLine:
def __init__(self, x, y, thickness, zoom, z=... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# Global Variables
# %%
import os
import sys
import unittest
import urllib.error
import urllib.parse
import urllib.request
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sn... |
#!/usr/bin/env python
__author__ = '<NAME>'
__copyright__ = 'Copyright 2013, Matrix Mariner Inc.'
__license__ = 'BSD'
__email__ = '<EMAIL>'
__status__ = 'Development' # 'Prototype', 'Development', or 'Production'
'''This is a database of sorts for nautical chart regions, their providing hydro-graphic offices
and ... |
#!/usr/bin/env python
#
# Copyright (C) 2017 DL
#
from __future__ import print_function, with_statement
import os
import math
import argparse
import hashlib
import operator
from PIL import Image
from functools import reduce
_cv2_imported = False
_sift_supported = False
try:
import cv2
_cv2_imported = True
... |
# meow.validators
#
# Copyright (c) 2020-present <NAME> (<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 restriction, including without limitation the rights
# to use, copy... |
"""
KY040 Code form <NAME> and <NAME>
stuffaboutcode.com
Additional code added by <NAME> (University of Applied Science)
"""
'''
Please enter the IP address of the server here. Change the transfer rate if desired.
'''
ipAdress = '192.168.178.20'
# value in seconds
TRANSFERRATE = 0.2
import RPi.GPIO as GPIO
import s... |
from sha3 import keccak_256
from .ecdsa import SigningKey
from .ecdsa import SECP256k1
from .ecdsa.ellipticcurve import Point
secp256k1n = 115792089237316195423570985008687907852837564279074904382605163141518161494337
def _tonelli_shanks(n, p):
'''
A generic algorithm for computng modular square roots.
'''
... |
from pathlib import Path
# Note: re was looked at, but deemed overkill when just regular
# wildcard expressions are good enough for all expected uses.
#import re
from fnmatch import fnmatch
from Framework import Utility_Wrapper, File_Manager, Cat_Hash_Exception, Print
@Utility_Wrapper(uses_paths_from_settings = Fal... |
#!/usr/bin/env python3
import sys
if (sys.version_info < (3, 0)):#NO MORE PYTHON 2!!! https://pythonclock.org/
print(" ################# ERROR ################")
print(" ========================================")
print(" Invalid python version detected: "+str(sys.version_info[0])+"."+str(sys.version_info[... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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... |
# Author: <NAME>
# License: BSD-2-Clause
import numpy as np
from abc import ABCMeta
from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin
from sklearn.base import TransformerMixin
from sklearn.utils.extmath import safe_sparse_dot, softmax
from sklearn.preprocessing import LabelBinarizer
from sklearn.... |
"""
Load Open Graph Benchmark data as GraphTensors and TensorFlow Datasets.
GraphTensors are created by sampling the neighbourhoods of each classification
node using NetworkX. Each node to be classified is stored as a separate
GraphTensor comprising of it and its n neighbourhoods. The number of neighbourhoods
to sampl... |
# -*- coding: utf-8 -*-
"""Upload DataFrames from various sources."""
from typing import Dict, Optional
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
from django.conf import settings
from django.utils.translation import ugettext as _
import pandas as pd
from pyathena import connect
import smart_o... |
# -*- coding: utf-8 -*-
"""
sphinxcontrib.plantuml
~~~~~~~~~~~~~~~~~~~~~~
Embed PlantUML diagrams on your documentation.
:copyright: Copyright 2010 by <NAME> <<EMAIL>>.
:license: BSD, see LICENSE for details.
"""
import codecs
import errno
import hashlib
import os
import re
import shlex
import su... |
import time
import textwrap
import subprocess
import sqlalchemy as sa
from .core import DBSession, RefDBSession, Base
from .status import status
from .env import DependencyError, output
from .secrets import get_secret
from distutils.version import LooseVersion as Version
__all__ = ['drop_tables', 'create_tables', 'c... |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
import functools
import logging
import os
import subprocess
import sys
import tempfile
import urllib.parse
from di... |
import numpy as np
import copy
from src.h3DQN_FR1.Agent import H_DDQNAgent, H_DDQNAgentParams
from src.h3DQN_FR1.PPO_Agent import PPOAgent, PPOAgentParams
from src.h3DQN_FR1.Agent_HL import HL_DDQNAgent, HL_DDQNAgentParams
from src.h3DQN_FR1.Agent_LL import LL_DDQNAgent, LL_DDQNAgentParams
from src.h3DQN_FR1.Trainer im... |
import random
from abc import ABC, abstractmethod, abstractproperty
from itertools import product
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generator,
Iterable,
List,
Mapping,
Optional,
Set,
Type,
)
from experitur.core import trial as _trial
from experitur.helpers.merge_dic... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import Misc
class VolumeEncoderBlock(nn.Module):
"""
Basic Volume Residual Encoder Block
(convolution + normalization + activation) -> (convolution + normalization + activation) -> (downsampling)
"""
def __init__(self, input_chan... |
"""
Module for 'planes': classes that perform convolution/subsampling,
that serve as base classes for corresponding feature map classes.
"""
# Standard library imports
from itertools import izip
# NumPy/SciPy imports
import numpy as np
from numpy import random
from scipy import ndimage
# Local imports
from convolup... |
from tkinter import *
from tkinter import messagebox
import os
f=open("database_proj",'a+')
root = Tk()
root.title("Simple Pharmacy Managment System")
root.configure(width=1500,height=600,bg='BLACK')
var=-1
def additem():
global var
num_lines = 0
with open("database_proj", 'r') as f10:
for line in ... |
import json
from django.test import mock, TestCase
from django.contrib.contenttypes.models import ContentType
from django.forms import Select
from django.db.models import BLANK_CHOICE_DASH
from django.contrib.admin.widgets import AdminFileWidget
from django.core.files.uploadedfile import InMemoryUploadedFile
from .. ... |
#!/usr/bin/env python
import custom_fit
import h5py
import json
import losses
import modelzoo
import numpy as np
import os
import sys
import tensorflow as tf
import time
import utils
import wandb
import yaml
import sys
from wandb.keras import WandbCallback
def fit_robust(model_name_str, loss_type_str, window_size, bin... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 17 19:56:27 2020
@author: dhk13
"""
import requests
import time
import json
"""
with open('champion.json',encoding='UTF8') as json_file:
champion_parser = json.load(json_file)['data']
champion={}
for name, data in champion_parser.items():
champion[str(data['key']... |
#!/usr/bin/env python
import os
import glob
import time
from . import logger
def checkdir(outfile):
outdir = os.path.dirname(outfile)
if outdir == '':
outdir = os.getcwd()
if not os.path.isdir(outdir):
print('\nThe directory {} doesn\'t exist...'.format(outdir)
+ 'creating i... |
import re
import textwrap
try:
import sublime
import sublime_plugin
except:
class sublime_plugin():
TextCommand = object
INDENT = ' '
SEP = '-' * 40
def split_parens(text):
istart = [] # stack of indices of opening parentheses
j = 0
for i, c in enumerate(text):
if c == '(':
... |
"""ranking_measures.measures: a rank-ordering evaluation package for Python
=========================================================================
ranking_eval is a set of common ranking algorithms such as:
*dcg
*ndcg
*precision
*precision_k
*average_precision
*rankdcg
rankdcg is a new measure and it is described ... |
# Copyright 2019 Astronomer Inc
#
# 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 writin... |
import io
import os
import sys
import re
import numpy as np
import torch
import networkx as nx
import logging
import gensim.downloader as api
from gensim.models import KeyedVectors
from textworld import Game
from textworld.logic import State, Rule, Proposition, Variable
from functools import lru_cache
from pathlib impo... |
"""
Week 1 activity: driving car
---------
AUTHOR: <NAME>
"""
# Import from the graphics library
from cs1lib import *
from math import *
# Constants
ROAD_WIDTH = 50
CAR_WIDTH = 15
CAR_HEIGHT = 25
WIDTH = 600
HEIGHT = 600
BLOCK_HEIGHT = HEIGHT / 4
LINE_HEIGHT = 10
LINE_WIDTH = 3
ANIMATION_LENGTH = 60
PARKING_LOT_HEIGH... |
import json
import os
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from skilletlib import SkilletLoader
from cnc.models import RepositoryDetails
from cnc.models import Skillet
from pan_cnc.lib import cnc_utils
from pan_cnc.lib.exceptions import DuplicateSkilletException
def... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 7 17:44:42 2017
@author: sbenson
# Demonstrator that model conversion works
"""
import pytest
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
def perform():
from sklearn.externals import joblib
from sklearn.preproc... |
import numpy as np
import torch
def snr(S, N):
'''
Returns the signal to noise ratio for
@param S: the signal
@param N: the noise
'''
temp = 20 * np.log10(1 + np.linalg.norm(np.squeeze(S), axis=(1, 2)) /
np.linalg.norm(np.squeeze(N), axis=(1, 2)))
# filter inf valu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.