text stringlengths 3.07k 12.6k |
|---|
import sys
from timeit import timeit
import matplotlib.pyplot as plt
import numpy as np
# from numba import jit, njit
# from numba.typed import List
from statistics import mean
import ray
from multiprocessing import Pool
# Silences Numba warnings about a Python list being passed into a numba function
import warnings
... |
#!/usr/bin/env python
from __future__ import print_function
import glob
import hashlib
import httplib2
import os
import re
from dateutil.parser import parse
from apiclient import discovery
from jinja2 import Template
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storag... |
#Copyright 2021 <NAME>, <NAME> Institute for Biomedical Research
#
#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 la... |
#!/usr/bin/env python
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
#
# This python script creates a version string in a C++ file.
import hashlib
import... |
#!/usr/bin/env python
""" python """
#
# Copyright (c) <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice,... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 <NAME> <<EMAIL>>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, thi... |
#!/usr/bin/python3
''' Summary: Script to process images and update the database '''
import datetime
import os
import sqlite3
from pathlib import Path
from sqlite3 import Error
import cv2
import numpy as np
from numpy import array
from shapely.geometry import Polygon, asPoint
import mrcnn.config
from mrcnn.model impo... |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import numpy as np
from scipy.stats import gamma
from statsmodels.nonparametric import bandwidths
__all__ = ['get_kernel_width', 'get_gram_matrix', 'hsic_teststat', 'hsic_test_gamma']
def get_... |
'''
MIT License
Copyright 2019 Oak Ridge National Laboratory
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, mer... |
import os
import time
import cv2
import matplotlib.pyplot as plt
import numpy as np
import png
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
from colormap.colors import Color, hex2rgb
from sklearn.metrics import average_precision_score as ap_score
from torch.utils.data import DataLo... |
# Standard Library
import os
import re
from abc import ABC, abstractmethod
# Local
from .logger import get_logger
from .utils import get_immediate_subdirectories
logger = get_logger()
class TensorLocation:
def __init__(self, tname, mode, mode_step, event_file_name, start_idx, length, worker):
self.tenso... |
import xlrd
import functools
from django import forms
from django.core.exceptions import ValidationError
from django.template.loader import render_to_string
from .base import (BasePriceList, hourly_rates_only_validator,
min_price_validator)
from .spreadsheet_utils import generate_column_index_map, ... |
import logging
import os
from os.path import isfile, join
import numpy as np
from data_io import file_reading
from data_io import x_y_spliting
#import matplotlib.pyplot as plt
def data_plot(data_file, class_column=0, delimiter=' '):
x_matrix, attr_num = file_reading(data_file, delimiter, True)
x_matrix, y_vect... |
#!/usr/bin/env python
"""
arith_parse.py - Parse shell arithmetic, which is based on C.
"""
from core import tdop
from core import util
from osh.meta import Id
from core import word
from osh.meta import ast
p_die = util.p_die
def NullIncDec(p, w, bp):
""" ++x or ++x[1] """
right = p.ParseUntil(bp)
child = tdo... |
import socket
import threading
import os
################################################################
class Room: # Room class
def __init__(self):
self.chatUsers = [] # 채팅방 접속 유저 리스트 (채팅방)
self.waitUsers = [] # 재접속을 기다리는 유저 리스트 (대기열)
def add_chatUser(self, c): # 채팅방에 유저 추가
self.ch... |
#!/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 typing import List, Optional
import torch
from botorch.models.multitask import MultiTaskGP
from gpytorch.constrai... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def calculate_effect_of_credit_drop(model, X, credit_factors):
probs = model.predict_proba(X)[:, 1]
all_probs_changes = {}
all_credit_amount_changes = {}
all_expected_costs_in_credit = {}
for factor in credit_factors:
probs... |
#!/usr/bin/env python
"""Module for manipulating binary files, especially those with
Fortran formatted records.
"""
import struct
from collections import Iterable
from warnings import warn
from pyne.utils import QAWarning
warn(__name__ + " is not yet QA compliant.", QAWarning)
class _FortranRecord(object):
"""A... |
import boto.exception as exception
import v1.utils.log as log
from .json_ops import JBucket
from v1.lib.io_info import AddIOInfo
class Bucket(object):
def __init__(self, connection):
log.debug('class: %s' % self.__class__.__name__)
self.connection = connection
self.add_io_info = AddIOInfo... |
import os.path
import time
import typing
import numpy # type: ignore
from d3m import container, exceptions, utils
from d3m.metadata import base as metadata_base, hyperparams
from d3m.primitive_interfaces import base, transformer
from . import __author__, __version__, null
__all__ = ('PrimitiveSumPrimitive',)
Inpu... |
###############################################
##<NAME>, 2021##
##Topo-Seq data analysis##
# Classify TCSs by localization in IGRs or if in TU than by strand orientation which is cleaved.
###############################################
#######
#Packages to be imported.
#######
import random as rd
import matplotlib... |
import argparse
import functools
import time
import wave
import paddle.fluid as fluid
import pyaudio
from data_utils.data import DataGenerator
from model_utils.model import DeepSpeech2Model
from utils.utility import add_arguments, print_arguments
parser = argparse.ArgumentParser(description=__doc__)
add_arg = functoo... |
from matplotlib import pyplot as plt
from optimism.JaxConfig import *
from optimism import EquationSolver as EqSolver
from optimism import Mesh
from optimism import Mechanics
from optimism import FunctionSpace
from optimism.Mesh import EssentialBC
from optimism.Mesh import DofManager
from optimism import Objective
fr... |
import pandas as pd
import os
from PIL import Image
import numpy as np
from keras.callbacks import ModelCheckpoint, LearningRateScheduler, EarlyStopping, ReduceLROnPlateau, TensorBoard
from keras import optimizers, losses, activations, models
from keras.layers import Convolution2D, Dense, Input, Flatten, Dropout, MaxPo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from django.db import models
from seaserv import seafile_api
from seahub.utils.timeutils import timestamp_to_isoformat_timestr, datetime_to_isoformat_timestr
from seahub.base.templatetags.seahub_tags import email2nickname
class WorkspacesM... |
import pytest
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from catboost import CatBoostClassifier
from pydrift import DataDriftChecker, ModelDriftChecker, DriftCheckerEstimator
from pydrift.exceptions import (ColumnsNotMatchException,
... |
"""Common functions for accessing the HTS Workflow REST API
"""
from __future__ import unicode_literals
import base64
import six
from six.moves import configparser
import random
import requests
import logging
import os
from six.moves import urllib
LOGGER = logging.getLogger(__name__)
def add_auth_options(parser):
... |
# Once for All: Train One Network and Specialize it for Efficient Deployment
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# International Conference on Learning Representations (ICLR), 2020.
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_divisible(v, divi... |
# coding=utf-8
class NodeType:
select = 'SELECT'
insert = 'INSERT'
delete = 'DELETE'
update = 'UPDATE'
train = 'TRAIN'
register = 'REGISTER'
load = 'LOAD'
save = 'SAVE'
connect = 'CONNECT'
set = 'SET'
alert = 'ALERT'
create_table = 'CREATETABLE'
drop_table = 'DROPTA... |
import binascii
import re
legacy_syntax_names = {
('\t', 'simple'): 'TSV (Rainbow)',
(',', 'quoted'): 'CSV (Rainbow)'
}
filename_policy_map = {'simple': 'Simple', 'quoted': 'Standard', 'quoted_rfc': 'quoted_rfc'}
def encode_delim(delim):
return binascii.hexlify(delim.encode('utf-8')).decode('ascii')
... |
import os
import numpy as np
import torch
import torch.nn.functional as F
import torch.distributed as dist
class DistDataError(Exception):
"""Defines an empty exception to throw when some other rank hit a real exception."""
pass
class DistData(object):
def __init__(self, backend='gloo'):
assert b... |
# Authors : <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License : BSD 3-clause
import os.path as op
import warnings
from nose.tools import assert_true, assert_equal
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_allclose
from scipy import fftpack
from mne import read_events, Ep... |
#!/usr/bin/env python
import pandas as pd
from argparse import ArgumentParser
import statsmodels.formula.api as smf
import math
# Function to compute effect sizes
# Based on method in Nakagawa, S. and <NAME>. (2007). Biol. Rev. 82. pp. 591-605.
def cohensd(t, df, n1, n2):
d = ( t * (n1+n2) ) / (math.sqrt(n1*n... |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
from __future__ import print_function
import chainer
import chainer.functions as F
from chainer import Variable
import numpy as np
import cupy as cp
def loss_dcgan_dis(dis_fake, dis_real):
L1 = F.mean(F.softplus(-dis_real))
L2 = F.mean(F.softplus(dis_fake))
... |
import sys
import re #Regular Expressions!
#Source: https://github.com/msbanik/drawtree
#Licence: MIT
class AsciiNode(object):
left = None
right = None
# length of the edge from this node to its children
edge_length = 0
height = 0
lablen = 0
# -1 = left, 0 = root, 1 = right
parent_di... |
from enum import Enum
from typing import Optional
import requests
import typer
class ListType(str, Enum):
blacklist = "blacklist"
whitelist = "whitelist"
class ListAction(str, Enum):
add = "add"
clear = "clear"
class BlacklistSource(str, Enum):
firebog_ticked = "firebog_ticked"
firebog_no... |
import pyconll
import urllib
import numpy as np
from pathlib import Path
from keras.preprocessing.sequence import pad_sequences
'''
Universal Dependencies Treebank Dataset
https://universaldependencies.org
'''
def read_conllu(path):
data = pyconll.load_from_file(path)
tagged_sentences = list()
t = 0
... |
import os
import shutil
from textops import cut, grep, echo
from anadroid.Types import TESTING_FRAMEWORK
from anadroid.application.AbstractApplication import AbstractApplication
from anadroid.build.versionUpgrader import DefaultSemanticVersion
from anadroid.instrument.Types import INSTRUMENTATION_TYPE
from anadroid.u... |
import csv
import os
import time
from SignalModel import TrainingModel
from SignalModel import SignalsClassifier
import re
import pandas as pd
import SymSpell
from utils.utils import read_glove_vecs
from Spec import Specification
#0019_DTC, 0027_NET, 0054_HBA, 0057_HRB, 0058_HFC, 0061_HHC, 0062_AVH, 0068_AEB, 0069_CDP... |
import numpy as np
class BinomialModel(object):
def __init__(self, *args):
# black == False. args: S0, u, d, R
# or
# black == True. args: S0, u, d, R, q
self.S0 = args[0]
self.u = args[1]
self.d = args[2]
self.R = args[3]
self.euro = args[5]
... |
# -*- coding: utf-8 -*-#
'''
# Name: LSTMCell_1_1
# Description: Implement the basic functions of lstm cell and linear cell
# Can't support batch input
# Author: super
# Date: 2020/6/18
'''
import sys
import math
import numpy as np
from MiniFramework.Layer import *
from MiniFramewo... |
# Copyright (c) AIRBUS 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 __future__ import annotations
import numpy as np
import gym
from typing import Callable
from collections.abc import Iterable
from skde... |
import socket
from django.conf import settings
from djutils.dashboard.provider import PanelProvider
from djutils.dashboard.registry import registry
try:
import psycopg2
except ImportError:
psycopg2 = None
def get_db_setting(key):
try:
return settings.DATABASES['default'][key]
except KeyError... |
import os
import numpy as np
from src.base_class.vocoder.htk_io import HTK_Parm_IO
from util import file_util, log_util
log = log_util.get_logger("acoustic tool")
def interpolate_f0(data):
'''
interpolate F0, if F0 has already been interpolated, nothing will be changed after passing this function
:... |
"""
Constants and functions necessary for converting between
the various units.
@author: tgwoodcock
"""
MU_0 = 4 * 3.14159 * 1e-7 # permeability of free space in Vs/Am
MU_B = 9.274015e-24 # Bohr magneton in Am^2
convmag = {"T_G" : "1e4",
"T_Oe" : "1e4",
"A/m_T" : "MU_0",
"A/m_G" : "1... |
import torch
import torch.nn.functional as F
import torchvision.transforms as transforms
from random import randint
import numpy as np
import cv2
from PIL import Image
import random
###################################################################
# random mask generation
############################################... |
#!/usr/bin/env python
import os, sys, json, warnings
from functools import wraps
import numpy as np
from PyQt5.QtGui import QColor
from qgis.core import (
Qgis,
QgsApplication,
QgsMeshLayer,
QgsMeshDatasetIndex,
QgsMeshUtils,
QgsProject,
QgsRasterLayer,
QgsRasterFileWriter,
QgsRaste... |
import logging
import os
from re import findall
import youtube_dl
from flask import Blueprint, render_template, request, jsonify
from urllib.parse import unquote_plus
from googleapiclient.discovery import build
from config import SONGS_DIR, API_KEY, SEARCH_RESULT_LIMIT, DEFAULT_SONG
from HomeTuner.util import file_ha... |
# ----------------------------------------------------------------------------
# fos.lib.pyglet
# Copyright (c) 2006-2008 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistri... |
#!/usr/bin/env python
# Coincappy: Simple Python wrapper around CoinMarketCap free endpoints.
import time
from random import randint
import requests
class RateLimitExceededError(Exception):
"""
Exception for exceeding API key's rate limit.
"""
pass
class CoinMarketCap():
def __init__(self, key=... |
# -*- coding: utf-8 -*-
"""
Unit Test Template
"""
from __future__ import absolute_import, division, print_function
import sys
import unittest
import os
import datetime
from ioflo.aid.sixing import *
from ioflo.aid.odicting import odict
from ioflo.test import testing
from ioflo.aid.consoling import getConsole
consol... |
"""
This module provides an input processor for information extracted using the
Geneways software suite, converting extraction data in Geneways format into
INDRA statements.
See publication:
Rzhetsky, Andrey, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> et al. "GeneWays: a system for extracting,
analyzing, visualizi... |
#! /usr/bin/env python
"""Usage: %(program)s [-D|-d] [options]
Where:
-h
show usage and exit
-d FILE
use the DBM store. A DBM file is larger than the pickle and
creating it is slower, but loading it is much faster,
especially for large word databases. Recommended for use with... |
import numpy as np
from skimage.morphology import label
from scipy.sparse import csr_matrix
from scipy.spatial import cKDTree as KDTree
import pandas as pd
import itertools
from tqdm import tqdm
def compute_M(data):
cols = np.arange(data.size)
return csr_matrix((cols, (data.ravel(), cols)),
... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
from math import exp
from collections import namedtuple
class LossNetwork(torch.nn.Module):
'''
This has to receive a tensor between 0 and 1, normalized by Image mean and SD
'''
def __init__(se... |
import text_display
import pygame
from config import DISPLAY_HEIGHT, DISPLAY_WIDTH, default_font_size
from typing import Tuple
class Player_Car_Info:
""" A class containing the information and text surfaces for the player
car. Such information includes position, velocity, acceleration, angle,
and... |
"""
Collection of helper methods which can be used as to interface metrics.
"""
import multiprocessing as mp
from typing import Any, Callable, List, Mapping, Optional, Tuple, Type, Union
import pandas as pd
from .. import utils
from .correlation import cramers_v, kruskal_wallis, pearson
from .distance import Binomia... |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import os
import hmac
import base64
import hashlib
from datetime import datetime
from urllib import urlencode, quote_plus
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
from tornado.ioloop import PeriodicCallback
import logging
log = logging.getLogger(__name__)
# you can publish up to 20 data points in ... |
import argparse
import os
import sys
from collocator import CollocationFinder, DependencyBasedCollocationFinder, SentenceLevelCollocationFinder, SyntacticCollocationFinder
def load_lexicon(filename):
lexicon = set()
with open(filename, encoding='utf-8') as f:
for line in f:
word = line.strip()
word = word.... |
from tgbot import plugintest, pluginbase
from tgbot.botapi import Message
from sample_plugin import TestPlugin
import threading
import time
class IssuesTest(plugintest.PluginTestCase):
def setUp(self):
self.plugin = TestPlugin()
self.bot = self.fake_bot('', plugins=[self.plugin])
def test_us... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2022 <NAME>
This software is released under the MIT License.
See the LICENSE file in the project root for more information.
"""
from dataclasses import field
from functools import partial
from typing import Any, Callable, Sequence
import ja... |
# View3D, Copyright (c) 2018 Alliance for Sustainable Energy, LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this... |
# -*- coding: utf-8 -*-
from app.modules.ia_config_reader import IaConfig
# note that these tests rely on the IA.zebra.json file, which if changed, might invalidate tests.
TEST_CONFIG_NAME = 'zebra'
def test_ia_config_creation(flask_app_client):
config_name = TEST_CONFIG_NAME
ia_config_reader = IaConfig(TES... |
import json
import logging
from dataclasses import dataclass
from typing import Dict, Iterable, Optional, Union
import pyorient
from pyorient import OrientRecord
from datahub.configuration.common import ConfigModel
from datahub.ingestion.api.common import PipelineContext
from datahub.ingestion.api.source import Sourc... |
import pygame, random, time
from pygame.locals import *
# cores para serem usadas durante o jogo
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
# tamanho da tela
WIDTH = 640
HEIGHT = 480
# velocidade do jogador no eixo x
speed_player =... |
import time
import os
import pickle
import argparse
import multiprocessing as mp
from multiprocessing import Pool
import numpy as np
from single_peaked_bandits.solvers import OptimalSolver
from single_peaked_bandits.helpers import (
get_reward_for_policy,
)
from single_peaked_bandits.constants import RESULTS_FOLD... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
""" generic classes defining structure of the filesystem API
"""
import os
import glob
import types
import itertools
import autofile
class DataDir():
""" a class implementing common data directory methods """
def __init__(self, name_, nargs=0, depth=1,
creation_side_effect_=(lambda _1, _2: N... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Gothon.
Gothon runs GO Code from Python using IPC RPC JSON (non-HTTP) & subprocess."""
import json
import os
import signal
import socket
import subprocess
import sys
from glob import iglob
from itertools import count
from pathlib import Path
from shutil import whi... |
import uuid
from firebase_admin import firestore
from lib.simple_logger import Logger
BATCH_SIZE = 500
_UUID_KEY_NAME = "uuid"
log = None
class FirestoreUuidTable(object):
"""
Mapping table between a string and a random UUID backed by Firestore
"""
def __init__(self, firebase_client, table_name, u... |
import sampling_methods
import numpy as np
__all__ = ['Supervised', 'ActiveLearning']
class _Trainer():
def __init__(self, name, epoch, batch_size):
self.name = name
self.epoch = epoch
self.batch_size = batch_size
assert (type(epoch) is int and epoch > 0)
... |
#! /usr/bin/env python3
# Import modules
import sys, os, time
from awsPseudoCi import *
import argparse, subprocess, shlex, json, hashlib
from datetime import datetime
h = "[AWS Pseudo CI] : "
def get_ami_from_ci_json():
"""
Get the ami from /tmp/awsCiInfo.json
"""
try:
with open("/tmp/a... |
############################################
# Copyright (c) 2016 Microsoft Corporation
#
# Basic core and correction set enumeration.
#
# Author: <NAME> (nbjorner)
############################################
"""
Enumeration of Minimal Unsatisfiable Cores and Maximal Satisfying Subsets
This tutorial illustrates how ... |
import os
import smtplib
import mimetypes
import logging as log
from email.message import EmailMessage
from enum import Enum
from pyautomailer.importer import Importer
from pyautomailer.body import *
from pyautomailer.subject import Subject
from pyautomailer.attachment import Attachment
class PyAutoMailerMode(Enum):
... |
# coding=utf-8
# Copyright 2019 The Google Research 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 applicab... |
'''
<NAME> 10/2/2017
<EMAIL>
Switches the MMGIS environment to release or development
Switching to release sets up the default test mission
and can limit access to tools
Usage Examples:
prepare.py d # switch to Dev env
prepare.py r # switch to Release env ... |
from django.shortcuts import render
from django.template import loader
from django.http import HttpResponse
from django.http import Http404
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate
from django.conf import settings
from django.shortcuts import redirect
from d... |
import time
import os
import torch
from utils.utils import NanError
def depth2class(depth, depth_start, depth_interval, depth_num, inv=False):
if not inv:
return (depth - depth_start) / (depth_interval + 1e-9)
else:
depth_end = depth_start + (depth_num-1) * depth_interval
inv_interv =... |
from torch.nn.functional import fractional_max_pool2d
from similar_words import similar
from visualize import display_pca_scatterplot
from PIL import Image
from gensim.models import KeyedVectors
import numpy as np
import moviepy.editor as mpe
import os
import cv2
import glob
def add_audio(path, theme, m... |
import os
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
from S2TruckDetect.src.S2TD.array_utils.points import rasterize
from OSMPythonTools.overpass import Overpass
from OSMPythonTools.overpass import overpassQueryBuilder
def buffer_bbox(bbox_osm):
"""
Buffe... |
from collections import defaultdict
from contextlib import closing
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional
import numpy as np # type: ignore
import pandas as pd # type: ignore
from tables import Filters # type: ignore
from tables import open_file
from pullfram... |
#!/usr/bin/python3
"""Platform for light integration."""
import logging
# Import the device class from the component that you want to support
from datetime import timedelta
from typing import Any, List
import homeassistant.util.color as color_util
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
... |
import numpy as np
#import pickle
#A = np.loadtxt("Rock_Paper_Scissors_Raw.txt", dtype = list, comments = '#', delimiter = ',', usecols = (0,1,2,3))
#A = np.loadtxt("Rock_Paper_Scissors_Raw.txt", dtype = int, comments = '#', delimiter = ',', usecols = (2), ndmin = 1)
#B = np.loadtxt("Rock_Paper_Scissors_Raw.txt", dtyp... |
#!/usr/bin/env python3
# test_conv2d.py
#
# Copyright (c) 2010-2018 Wave Computing, Inc. and its applicable licensors.
# All rights reserved; provided, that any files identified as open source shall
# be governed by the specific open source license(s) applicable to such files.
#
# For any files associated with d... |
import bisect
import json
import os
import re
import subprocess
from datetime import datetime, timedelta, timezone
from typing import List, Optional
import pytz
from .location_history import Location
from .log import log
from .timezone import gps_coords_to_utc_offset
def read_exif(root: str) -> List[dict]:
log.... |
import copy
import itertools
import os
import uuid
from typing import Callable, List, Tuple
import numpy as np
import ray
from gym import Env
from gym.spaces import Box
from interact.environments.vector_env import VectorEnv
from interact.experience.episode_batch import EpisodeBatch
from interact.experience.sample_bat... |
import os
import json
from string import Template
from functools import total_ordering
import argparse
from os import path
def generate(sitedir, siteBaseUrl, codeBaseUrl, logoPath):
versions = loadVersions(sitedir)
print(versions.asList())
generateVersions(sitedir, versions)
generateIndex(sitedir, siteBaseUrl, ver... |
#!/usr/bin/env python3
import argparse
import matplotlib.pyplot as plt
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
import numpy as np
from torchdiffeq import... |
from django import conf, http, shortcuts, views as dj_views
from django.contrib import messages
from django.contrib.auth import models as auth_models, views as auth_views
from django.core import mail, signing
from . import forms as acc_forms, signer
class UserSigninView(auth_views.LoginView):
template_name = 'ac... |
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## ICA model for TE data
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% import required packages
import numpy as np
from sklearn.preprocessing import StandardScaler
from ... |
"""
This module contains functions that operate on Argo filenames.
These filenames follow specific conventions that can be hard
to remember. This is built-in to the interactive module. The
``path`` argument for all functions in this module can be a string
file path, an iterable of file paths, a ``pandas.Series`` or
a `... |
import re, time
############ Functions ############
# Set player list from text file
def get_players():
file_name = input("Your .txt file name: ")
if ".txt" in file_name:
pass
else:
file_name+=".txt"
params = []
min_avg_min = int(input("Minimum average minutes to include: "))
... |
## TODO: define the convolutional neural network architecture
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
# can use the below import should you choose to initialize the weights of your Net
# import torch.nn.init as I
from torch.nn import init
class MyNetwork... |
import json
import os
import ccxt
import pandas as pd
import requests
import file_utils
from dm_utils import *
from file_utils import alogger
@alogger
def update_ticker_binance(directory, timeframe, pairs, initial_candles, zeitpunkt=None, postfix=""):
return _update_ticker_binance(directory, timeframe, pairs, i... |
#!/usr/bin/env python
"""
This script extracts btsnooz content from bugreports and generates
a valid btsnoop log file which can be viewed using standard tools
like Wireshark.
btsnooz is a custom format designed to be included in bugreports.
It can be described as:
base64 {
file_header
deflate {
repeated {
... |
import cv2
import numpy as np
import random
import matplotlib.pyplot as plt
def similarity_transform(image, center, dim, angle=0.0, scale=1.0, clip=True):
#similarity transform includes rotation+translation+scaling
#it retains parallel and angles
M = cv2.getRotationMatrix2D(center, angle, scale)
(w,h,... |
from typing import Sequence
from eth_typing import BLSSignature
from eth_utils import ValidationError
from eth2._utils.bls import bls
from eth2._utils.hash import hash_eth2
from eth2.beacon.attestation_helpers import (
validate_indexed_attestation_aggregate_signature,
)
from eth2.beacon.committee_helpers import g... |
# -*- coding: utf-8 -*-
"""
@file polygon.py
@author <NAME>
@date 2011-03-16
@version $Id: polygon.py 15031 2013-11-05 19:52:41Z behrisch $
Python implementation of the TraCI interface.
SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
Copyright (C) 2011-2013 DLR (http://www.dlr.de/) and contributor... |
# -*- coding: utf-8 -*-
'''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.