text stringlengths 3.07k 12.6k |
|---|
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 18 11:27:13 2019
@author: Brent
"""
import fileManipulation as fm
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.collections as mcoll
import matplotlib.path as mpath
import matplotlib
import os
# change this path or add one
DEBUG_PATH = "fish-tracke... |
#!/usr/bin/env python
import os, sys, re
"""
Usage:
$ python fix_string_idiocy.py path/to/your.dme .dm
NOTE: NOT PERFECT, CREATES code-fixed DIRECTORY.
*** MERGE THIS MANUALLY OR YOU WILL BREAK SHIT. ***
fix_string_idiocy.py - Combines multiple string append operations in DreamMaker code
Copyright 2013 Rob... |
#!/usr/bin/python3
# This script builds a html document from a html template and markdown files with json metadata.
# Call the script with -h to see help/documentation.
import re
import os
import sys
import json
import markdown
import optparse
def openFile(file):
with open(file, 'r') as openedFile:
return opened... |
import cv2
import numpy as np
import tensorflow as tf
class Tracker:
view_a = None
view_b = None
start_pos = np.asarray([0, 0])
dist_thresh = 0
infer = True
def __init__(self, frame, bbox, color):
self.tracker = cv2.TrackerKCF_create()
self.color = color
self.tracker.i... |
from flask_login import UserMixin
from sqlalchemy import Column, Integer, TEXT
from sqlalchemy.ext.declarative import declarative_base
from blaise_mi_extract_api.extensions import db
Base = declarative_base()
class ApiKey(db.Model, UserMixin):
# uncomment the tables args for SQL Server schemas
# __table_arg... |
"""Implementation of PixelSNAIL [1].
PixelSNAIL extends PixelCNN [2] (and its variants) by introducing a causally
masked attention layer. This layer extends the model's receptive field by
allowing each pixel to explicitly depend on all previous pixels. PixelCNN's
receptive field, on the other hand, can only be increa... |
import pandas as pd
from DataHandler.mongoObjects import CollectionManager
from datetime import date
from datetime import datetime as dt
import datedelta
import numpy as np
features = ['Asset Growth', 'Book Value per Share Growth', 'Debt Growth', 'Dividends per Basic Common Share Growth',
'EBIT Growth', 'E... |
import offsetbasedgraph as obg
from collections import defaultdict
from graph_peak_caller.postprocess.reference_based_max_path\
import max_path_func
from offsetbasedgraph.vcfmap import VariantMap, DELMap
from graph_peak_caller.sparsediffs import SparseValues
from graph_peak_caller.peakcollection import Peak
from gr... |
from ghc.utils.hom import nx2homg, tree_list, cycle_list,\
path_list, hom_profile
import homlib as hl
import networkx as nx
import numpy as np
def hom_tree(F, G):
"""Specialized tree homomorphism in Python (serializable).
Add `indexed` parameter to count for each index individually.
... |
import numpy as np
def continue_clamped(x, y, kind='cubic'):
""" continue a clamped spline to +/- infinity
Args:
x (np.array): x values
y (np.array): y values
kind (str, optional): spline kind, default 'cubic'
Return:
function: ycont, y(x) defined over all x
"""
from scipy.interpolate import... |
import json
import imageio
from tqdm.auto import tqdm
import time
from PIL import Image, ImageFont, ImageDraw
import re
import random
from matplotlib import pyplot as plt
import os
import string
from IPython.display import FileLink, HTML, display
def random_string_id(L=6):
"""Random ID."""
char_set = string.as... |
import numpy as np
from util import Saver
class PI2(Saver):
saved_names = ('theta',)
def __init__(self, dmps, n_updates, n_reps, n_dims, n_bfs,
n_times, r_gain, r_normalize):
self.dmps = dmps
self.n_updates = n_updates
self.n_reps = n_reps
self.n_dims = n_dims... |
"""I/O utilities
Not specific to FALCON.
"""
from __future__ import absolute_import
#from builtins import str
from builtins import object
import os
import resource
import shlex
import subprocess as sp
import sys
import traceback
from ..io import deserialize
def write_nothing(*args):
"""
To use,
LOG = n... |
from colors import colored_print_generator as cpg, prettify as pfy
from colors import *
import requests as r
import time
import os
def get_environ(k):
k = k.upper()
if k in os.environ:
return os.environ[k]
else:
return None
# rs = r.Session()
basic_auth = r.auth.HTTPBasicAuth('root','')
... |
from Symtab import ModuleScope
from PyrexTypes import *
from UtilityCode import CythonUtilityCode
from Errors import error
from Scanning import StringSourceDescriptor
class CythonScope(ModuleScope):
is_cython_builtin = 1
def __init__(self):
ModuleScope.__init__(self, u'cython', None, None)
sel... |
import json
import logging
from urllib.parse import urlencode
import tornado.gen
from biothings.web.handlers import BaseAPIHandler
from tornado.auth import AuthError, OAuth2Mixin
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import url_concat
def authenticated_user(func):
"""
Decorator... |
import torch
import socket
import argparse
import json
import glob
import os
import shutil
import pdb
import numpy as np
import scipy.misc
import matplotlib.pyplot as plt
import functools
import torch.nn as nn
from torchvision import datasets, transforms
from torch.autograd import Variable
from data.moving_mnist impo... |
import numpy as np
from nengo.builder.builder import Builder
from nengo.builder.operator import Operator
from nengo.builder.signal import Signal
from nengo.exceptions import BuildError
from nengo.neurons import NeuronType, RatesToSpikesNeuronType
from nengo.utils.numpy import is_array_like
class SimNeurons(Operator)... |
import numpy as np
import pandas as pd
import lightgbm as lgb
import gc
import sklearn.datasets
from common.data import get_embedding_sizes, get_validation_index
from sklearn.model_selection import KFold, StratifiedKFold, train_test_split
from fastai.structured import *
from fastai.metrics import *
from fastai.colum... |
"""
implementation of load cli command
"""
import sys
import gzip
import json
from datetime import datetime
from itertools import chain
import re
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from ckanapi.errors import (NotFound, NotAuthorized, ValidationError,
S... |
# 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, distribute,... |
import numpy as np
import xml.etree.ElementTree as ET
from otp.trajectory import Trajectory
from otp.boundingbox import compute_iou
def get_gt_tracks(fname, scale = 1.):
tree = ET.parse(fname)
root = tree.getroot()
annos = root.findall('./annotation')
gts = dict()
for i, anno in enumerate(annos):
for obj... |
#!/usr/bin/env python
from __future__ import print_function
import tensorflow as tf
import cv2
import sys
sys.path.append("../common")
from common.netconstruct import weight_variable,bias_variable, conv2d,max_pool_2x2
import random
import numpy as np
from collections import deque
OBSERVE_LENGTH = 1000
EX... |
# Copyright (c) 2021. Universidad de Pinar del Rio
# This file is part of SCEIBA (sceiba.cu).
# SCEIBA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
import traceback
from uuid import uuid4
from elasticsearch.exceptions import N... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import os
import pickle
import time
from multiprocessing.pool import Pool
import argparse
import chainer
import gc as gc_m
import numpy as np
import pandas as pd
from scripts.utils import check_path
__doc__ = """
train_cnn_multi - a training, testing and feature extract... |
"""
Functions for calculating statistics and handling uncertainties.
(c) <NAME> : https://github.com/oscarbranson
"""
import numpy as np
import uncertainties.unumpy as un
from scipy.stats import pearsonr
def nan_pearsonr(x, y):
xy = np.vstack([x, y])
xy = xy[:, ~np.any(np.isnan(xy),0)]
n = len(x)
if ... |
import urllib
from socket import (
gaierror,
error as socket_error,
)
from time import time
from urlparse import urlparse
from aplus import Promise
from futile.caching import LRUCache
from geventhttpclient.client import HTTPClient
from geventhttpclient.response import HTTPResponse
from openmtc.exc import (
... |
# -----------------------------------------------------------------------------
# WSDM Cup 2017 Classification and Evaluation
#
# Copyright (c) 2017 <NAME>, <NAME>, <NAME>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... |
'''
AUTHOR : <NAME>
email : <EMAIL>
school : Polytech Sorbonne
DESCRIPTION : Plots the data from the accelerometer and gyrometer in real time
USAGE : python plot_AccGyro.py [mac_adress_of_the_device]
README : If the frame rate is not convenient (the plots don't run smoothly),
try... |
from multiprocessing import cpu_count
from sys import exit
from os import remove
def exiter():
print('INVALID ANSWER...')
exit(1)
return
def intro():
mssg_0 = """
--------------------------------------------------------------------------------------------------------------------
...Hi. Welcome to Peat, the I... |
import numpy as np
import torch
import matplotlib.pyplot as plt
def run_runtime_seg(model, test_set, exp_name, S):
X_test = list(test_set)[0][0].cuda()
model.eval()
#First forward pass, ignore
time_list = []
for _ in range(100 + 1):
end = model.predict_runtime(X_test, S)
time_list.append(end)
time_list = np.... |
#!/usr/bin/env python
from gimpfu import *
from math import pow, sqrt
from gimpcolor import RGB
def euclidean_distance(point_one, point_two):
""" Calculate the euclidean distance.
Args:
point_one (tuple)
point_two (tuple)
Returns:
float: the distance between t... |
import functools
from pycce.utilities import *
from .base import Hamiltonian
from .functions import *
def hamiltonian_wrapper(_func=None, *, projected=False):
"""
Wrapper with the general structure for the cluster Hamiltonian.
Adds several additional arguments to the wrapped function.
**Additional p... |
import cv2
import numpy as np
import math
import joblib
import solution_generator
cap = cv2.VideoCapture(0)
colours = ['orange' , 'red' , 'green' , 'blue' , 'yellow' , 'white']
s_scalar = joblib.load('Scalar1')
model = joblib.load('model_0.04')
colours_array = ['0' , '0' , '0' , '0' , '0' , '0' , '... |
import gzip
import glob
import sys, os
import numpy as np
from shutil import copyfile
class Design(object):
def __init__(self, path):
self.path = path
self.backbone_coords = []
self.score = None
self.get_score()
def read_coords(self, chain=None):
with gzip.open(self.pa... |
import torch
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
from mpl_toolkits.axes_grid1 import ImageGrid
from skimage.exposure import match_histograms
from PIL import Image
from torchvision.transforms.functional import InterpolationMode
from utils import *
def train_st(config, dataload... |
#################################################################################
# Copyright (c) 2018-2021, Texas Instruments Incorporated - http://www.ti.com
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... |
from tomlkit.toml_file import TOMLFile
from git import Repo
import sys
from datetime import datetime
class PyProject:
def __init__(self):
self._file = TOMLFile('pyproject.toml')
def get_version(self):
pyproject_data = self._file.read()
version = pyproject_data['tool']['poetry']['versi... |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from torch.utils.data import Dataset, DataLoader
fr... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.geometry import farthest_point_sampler
'''
Part of the code are adapted from
https://github.com/yanx27/Pointnet_Pointnet2_pytorch
'''
def square_distance(src, dst):
'''
Adapted from https://github.com/yanx27/Pointnet_Point... |
from bs4 import BeautifulSoup
from random import randint
import requests
import time
## attributes / config file for Spider class -- TODO
parsed_file_path = 'parsed.txt'
binance_htmls_path = 'binance_htmls/'
uniswap_htmls_path = 'uniswap_htmls/'
coinbase_htmls_path = 'coinbase_htmls/'
binance_cols = 6
uni... |
"""
Function : pax_cabine_length.py
Title : Pax cabine length
Written by: <NAME>
Date : October/2019
Last edit : August/2020
Language : Python
Aeronautical Institute of Technology - Airbus Brazil
Description:
- This module calculates the pax cabine length
Future implementations:
-
Inputs:
- N... |
"""SFN choice rules.
These rules are used in the 'Choice' state of a state-machine, and
allow for conditional branching in the state-machine. There are two
types of choice rule: comparisons and logical operations.
"""
import datetime
import typing as T
import logging as lg
from .. import _util
_logger = lg.getLogge... |
from datetime import datetime
from decimal import Decimal
import logging, sys, os
from shutil import copyfile
import sqlalchemy
# import sqlalchemy_utils
from logic_bank_utils import util as logic_bank_utils
(did_fix_path, sys_env_info) = \
logic_bank_utils.add_python_path(project_dir="LogicBank", my_file=__file... |
from flask_jwt_extended import get_jwt_claims
from resources.content.common.parser import dict_parser
###################### insert item ##############################
def insert_prepare(cls,data,key):
if cls.find_by_logical_key(data[key]):
return 400, {'message': "Item with id '{}' already exists".format(data[key]... |
from pyquil import Program
from pyquil.api import QuantumComputer
from pyquil.gates import I
from pyquil.api._quantum_computer import Executable
from pyquil.noise import add_decoherence_noise
import numpy as np
import types
from typing import Iterator
from pyquil.quilbase import Gate
__all__ = ['apply_em', 'apply_no... |
#! /usr/bin/env python
from sys import argv
import os
from os import path
import itertools
import numpy as np
import json
from collections import Counter
import torch
from allennlp.data import Vocabulary
from dygie.models.shared import fields_to_batches
from dygie.commands import predict_dygie as pdy
def unwrap(t... |
#Copyright [2020] [Indian Institute of Science, Bangalore]
#SPDX-License-Identifier: Apache-2.0
import numpy as np
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def get_stats(df):
df_means = df.groupby(['timestep']).mean()
df_std = df.groupby(['timestep']).std()
lowe... |
#!/usr/bin/env python3
"""
Copyright 2017 ManerFan
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... |
import copy
import os
from importlib import import_module
from importlib.util import find_spec
# Exports
__all__ = (
"autodiscover",
"find_packages",
"has_callable",
"import_member",
"submodule_exists",
"Module",
)
# Functions
def autodiscover(locations, module_name):
"""Auto discover m... |
import math
import numpy as np
import time
from .geometry import Box, Vec3d, centered_box
from . import utils
class TensorData(object):
"""Read-only tensor data.
The 1st dimension is regarded as channels, and arbitrary access
in this dimension is not allowed. Threfore, every data access should be
ma... |
from pathlib import Path
import numpy as np
import pandas as pd
from sim.family_module import separations, marriage, dating_market, birth, death
from sim.work_module import sim_retired, sim_working, sim_fulltime, sim_hours, sim_earnings, scale_data, make_hh_vars, sim_multi_employment, to_binary, to_category
########... |
#
# Copyright (c) 2015-2021 University of Antwerp, Aloxy NV.
#
# This file is part of pyd7a.
# See https://github.com/Sub-IoT/pyd7a for further info.
#
# 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 Lice... |
# import JetBot environment
from env import JetBotEnv
import torch
import torch.nn as nn
# Import the skrl components to build the RL system
from skrl.models.torch import DeterministicModel, GaussianModel
from skrl.memories.torch import RandomMemory
from skrl.agents.torch.sac import SAC, SAC_DEFAULT_CONFIG
from skrl.... |
import numpy as np
import os
import cv2
from src.config import DATA_DIR, CLASSES, BATCH_SIZE, IMG_SIZE
import matplotlib.pyplot as plt
import matplotlib
import tensorflow as tf
from sklearn.model_selection import train_test_split
matplotlib.use('TkAgg')
IMG_PATH = os.path.join(DATA_DIR,'images')
MASK_PATH = os.pat... |
import copy
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# autoencoder for SVM-base models
class Encoder(nn.Module):
def __init__(self, dim, dataset="Abnormal"):
super(Encoder, self).__init__()
... |
from pathlib import Path
import shutil
import pytest
import yaml
from openpecha.blupdate import Blupdate
@pytest.fixture(params=[{'srcbl': 'abefghijkl', 'dstbl': 'abcdefgkl'}])
def inputs(request):
return request.param
@pytest.fixture(params=[{'expected_result': [(0,2,0), (2,5,2), (8,10,-1)]}])
def compute_... |
"""
Credits:
Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
This source code is licensed under the MIT license found in the LICENSE
file in the root ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# standard modules
import logging
# extra modules
dependencies_missing = False
try:
import socket
import sys
import hashlib
except ImportError:
dependencies_missing = True
from metasploit import module
metadata = {
'name': 'Mikrotik Winbox Arbitrary... |
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, List
from enums import Opcode, Operand, OperandType
if TYPE_CHECKING:
from zmachine import ZMachine
def _btm_4(num: int) -> int:
return num & 0b0000_1111
def _btm_5(num: int) -> int:
return num & 0b00... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import requests
from keepasshttp import AES_256_CBC
# fmt: off
data = {
"associate": b'{"RequestType":"associate","Success":true,"Id":"unittest_tmp","Count":0,"Version":"1.8.4.2",'
b'"Hash":"46e1d15ab37d8a2700b0c175524443351... |
import click
import operator
import os
import time
import yaml
from . import util
from .chute import chute_find_field, chute_resolve_source
from .controller_client import ControllerClient
@click.group('store')
@click.pass_context
def root(ctx):
"""
Publish and install from the public chute store.
By def... |
"""
project = Election scraper
author = <NAME>
"""
from time import time
import requests
from bs4 import BeautifulSoup as BS
import csv
import sys
# training website
INPUT = "https://volby.cz/pls/ps2017nss/ps3?xjazyk=CZ"
def get_districts(web):
"""
Přijímá webovku a vrátí extrahovaný seznam... |
#! /usr/bin/env python3
import os, sys, re
from aifc import Error
class NoArgumentsError(Error):
pass
class TooManyArgumentsError(Error):
pass
def redirect_in(cmd):
pid = os.getpid()
return_code = os.fork()
if return_code < 0:
os.write(2, ("Failed to fork, returning").encode())
sys... |
import importlib
import argparse
import os
from os.path import join, isdir
from itertools import chain
import torch as pt
import torch.nn as nn
from torch.nn import init
from torch.utils.data import DataLoader
import numpy as np
from optimizer import OptimizerCollection
def load_config(file):
"""
initialize... |
import pandas as pd
import os
from datetime import datetime
import copy
import seaborn as sns
from matplotlib import pyplot as plt
import snowav.framework.figures
def inflow(args, logger):
'''
Plot inflow and SWI.
Currently this is only configured for the Tuolumne and San Joaquin, and
requires some m... |
from django.conf import settings
from pathlib import Path
import os
import datetime
import logging
import time
import threading
import re
from django.urls import reverse
import markdown
import subprocess
def mimetype_to_icon(mimetype):
type2icon = {
'image': 'file-picture',
'audio': 'file-music',
... |
import os.path
import os
import csv
from openpyxl import Workbook, load_workbook
from openpyxl.styles import Font, PatternFill
def get_workbook(file_path):
if os.path.isfile(file_path):
return load_workbook(filename=file_path)
else:
wb = Workbook()
wb.remove_sheet(wb.active)
r... |
#from gendatafetcher.sequences import get_sequence_ucsc
from Bio import Seq, SeqIO, SeqRecord
import logging
from pyfaidx import Fasta
import json
import numpy as np
class NonGraphPeak:
def __init__(self, chromosome, start, end, score=None, unique_id=None):
self.chromosome = chromosome
self.start ... |
#!/usr/bin/python3
# *****************************************
# PiTender Control Python script
# *****************************************
#
# Description: This script will dispense beverages.
#
# This script runs as a separate process from the Flask / Gunicorn
# implementation which handles the web interface.... |
from random import choice
import os, gzip
try:
import simplejson as json
except ImportError:
import json
import archetype_builder
from value_setters import set_value
from structures_builder import normalize_keys
from pyehr.utils import decode_dict
from pyehr.ehr.services.dbmanager.dbservices.wrappers import A... |
import threading
import os, time
import json
import traceback
from base.urlop import UrlRequestOp
from core import login, course
from handler.struct.user import UserData
from handler import Pool
from handler.Error import LoginBasicException, UrlOpTimeOutError, PullerBasicException
import gui
import llogger
NOTICE... |
"""
MWA Dipoles
-----------
Tools to download MWA metafits files and finding dead dipoles
"""
import json
import time
from pathlib import Path
import matplotlib as mpl
import numpy as np
import wget
from astropy.io import fits
from matplotlib import pylab as pl
from matplotlib import pyplot as plt
mpl.use("Agg")
... |
# -*- coding: utf-8 -*-
"""ANNtf2_algorithmANN.py
# Requirements:
Python 3 and Tensorflow 2.1+
# License:
MIT License
# Usage:
see ANNtf2.py
# Description
Define fully connected artificial neural network (ANN)
- Author: <NAME> - Copyright (c) 2020-2021 Baxter AI (baxterai.com)
"""
import tensorflow as tf
impor... |
"""helpers to define numeric operators in batch on classes"""
# pragma pylint: disable=unused-import
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import (
bytes,
dict,
int,
list,
object,
range,
str,
ascii,
chr,
hex,
input,
... |
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage
import skimage.morphology
import argparse
# Python Imaging Library imports
import Image
import ImageDraw
import os
'''
This is a command line utility for generating the occupancy grid maps necessary for specifying out-of-bounds states.
'''
pars... |
import json
import os
import pickle
import re
from collections import namedtuple
import numpy as np
import pandas as pd
from django.contrib.auth.models import User
from django.db import transaction
from django.db.models import F
from django.shortcuts import HttpResponse, render
from django.template.loader import rende... |
"""Functions to train SAR image classifier based on MLPH histogram computations.
"""
from __future__ import division
from __future__ import print_function
from sarclf import mlph
from sarclf import mlph_modified
from sarclf import utils
import pickle
import numpy as np
from sklearn.model_selection import GridSearchC... |
from copy import deepcopy
from statistics import median, stdev
from config import default_weight_func
class Block:
def __init__(self, word_list, middle_index, radius):
start = max(0, middle_index - radius)
end = min(len(word_list), middle_index + radius+1)
self.before_wing = word_list[s... |
import tcod as T
from settings import *
from map import *
from mob import *
from item import *
from util import in_map
import ui
KEYS = [
(['y', '7', T.KEY_KP7], ('walk', (-1, -1))),
(['k', '8', T.KEY_KP8, T.KEY_UP], ('walk', (0, -1))),
(['u', '9', T.KEY_KP9], ('walk', (1, -1))),
(['h', '4', T.KEY_KP4... |
from __future__ import division
import json
import os
import copy
import collections
import argparse
import csv
import neuroglancer
import neuroglancer.cli
import numpy as np
class State(object):
def __init__(self, path):
self.path = path
self.body_labels = collections.OrderedDict()
def loa... |
# -*- coding: utf-8 -*-
# @Time : 2020/12/28 21:02
# @Author : Zeqi@@
# @FileName: data_loader.py
# @Software: PyCharm
import sys
sys.path.append('../../Tensorflow_YoloV4_BDD100K')
import os
import numpy as np
from tensorflow.keras.utils import Sequence
from Preprocess.utils import Data_augmentation
from Preproc... |
"""
Support for Eneco's Toon thermostats.
Only the rooted version.
Optimized for Google Assistant.
configuration.yaml
climate:
- platform: toon
name: Toon Thermostat
host: IP_ADDRESS
port: 10080
scan_interval: 10
"""
import logging
import json
import voluptuous as vol
import requests
from homeassis... |
import os
__here__ = os.path.dirname(__file__)
TEST_DATA = '''\
be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
fbegc... |
import platform as arch
from pynotifier import Notification
from urllib.parse import urlparse
from subprocess import Popen, PIPE
import os
import utils.adblock
import utils.bookmark
import utils.mime
import scripts
import confvar
from PyQt5.QtNetwork import QNetworkProxy
from PyQt5.QtCore import (
QUrl,
QObje... |
"""
Created: July 14, 2019
Last Updated: August 3, 2019
Author: Sulles
=== DESCRIPTION ===
This is the main simulator code. From here, users can
TODO: Make shift + right click = plane move?
"""
import os
import sys
import pygame
# noinspection PyUnresolvedReferences
from Classes.Network import Network
# noinspecti... |
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 15:54:20 2018
数据增强 data
@author: 60236
"""
import math
import torch
import random
import numpy as np
from .utils import get_best_begin_point
from PIL import Image, ImageDraw
def resize(img, boxes, size, max_size=1000):
'''Resize the input PIL image to the given siz... |
import argparse
import re
import os
import random
import json
from tqdm import tqdm
import math
import rdkit.Chem as Chem
from template.generate_retro_templates import process_an_example
from template.rdchiral.main import rdchiralRun, rdchiralReaction, rdchiralReactants
import pdb
def smi_tokenizer(smi):
"""
... |
import math
import numpy as np
import tensorflow as tf
from datetime import datetime
from utils.data_prep import train_validation
def optimize(
num_iterations,
train_batch_size,
input_train,
output_train,
session,
x,
y_true,
optimizer,
accuracy,
cost,
prob
):
# Start t... |
# -*- coding: utf-8 -*-
"""
Anaflow subpackage providing the extended GRF Model.
.. currentmodule:: anaflow.flow.ext_grf_model
The following functions are provided
.. autosummary::
ext_grf
ext_grf_steady
"""
# pylint: disable=C0103
import numpy as np
from scipy.integrate import quad as integ
from anaflow.tool... |
# <><><> SETUP IMPORTS <><><>
import os
import pandas as pd
import numpy as np
from rpy2.robjects.packages import importr
import rpy2.robjects.packages as rpackages
from rpy2.robjects.vectors import StrVector
from rpy2.robjects import pandas2ri
# Setup R packages used
pandas2ri.activate()
utils = rpackages.importr... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------------------------------------
# Script to score coocurrences
#
# Usage:
# score_cooccurrences.py [--data_prefix str] [--language str]
# (It reads and makes files in the data directory.)
#
# Example:
# ... |
#!/usr/bin/env python
import argparse
import json
import logging
import os
import time
import sys
from functools import reduce
from pathlib import Path
from typing import Tuple
from urllib import parse
import requests
from requests.adapters import HTTPAdapter, TimeoutSauce
from tqdm import tqdm
from urllib3.util impor... |
import torch
import numpy as np
import torch.nn as nn
class PoswiseFeedForwardNet(nn.Module):
def __init__(self, source_dims, hidden_cnt):
super(PoswiseFeedForwardNet, self).__init__()
self.conv1 = nn.Conv1d(in_channels=source_dims, out_channels=hidden_cnt, kernel_size=1)
self.conv2 = nn.C... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import math
from functools import partial
import torch
import torch.nn as nn
# from modules import torch.nn.Linear
def phase_init(m, bandlimit):
with torch.no_grad():
if hasattr(m, 'weight'):
# num_input = m.weight.size(-1)
# See paper sec. 3.2, final paragraph, and supplement Se... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 <NAME> <<EMAIL>>, Gremlin Inc <<EMAIL>>
import argparse
from argparse import ArgumentParser
import functools
import importlib
import logging
import os
import sys
from gremlinapi.config import GremlinAPIConfig
from gremlinapi.exceptions import GremlinAuthError
from typin... |
from threading import Thread
from time import sleep
import tkinter as tk
from tkinter import *
from tkinter.ttk import *
from gui import Gui
from pathlib import *
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path("./assets")
def relative_to_assets(path: str) -> Path:
"""
Creates a file p... |
#!/usr/bin/python
import rospy
import numpy as np
import math
import tf
from ackermann_msgs.msg import AckermannDriveStamped
from geometry_msgs.msg import PoseArray, Pose, PoseStamped
from std_msgs.msg import Bool
from nav_msgs.msg import Path
def distFromLine(x,y,x1,y1,x2,y2):
numerator= abs(x*(y2-y1) - (y*(x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.