text stringlengths 3.07k 12.6k |
|---|
import os
import warnings
from typing import Dict, List, Optional, Tuple
import numpy as np
import tensorflow as tf
from imagemodel.category_segmentations.models.model_interface import ModelInterface
from imagemodel.common.utils.function import get_default_args
from imagemodel.common.utils.functional import compose_le... |
from hlt import *
from networking import *
myID, gameMap = getInit()
START_POS = [0,0]
INIT = False
PRODUCTION_FACTOR = 3
GIVE_UP_ON_THAT_LONG_FUNCTION_FACTOR = 2
PRODUCTION_FACTOR_THRESHOLD = [0,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4]
#PRODUCTION_FACTOR_THRESHOLD= [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2... |
# Copyright 2014-2015, The University of Edinburgh.
#
# 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 ... |
import os
import platform
import time
from threading import Thread
import youtube_dl
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import artwork
import metadata
import spotify
import utils
def download_from_yt(url, screen, directory=None):
if... |
import os
from collections import Counter
from functools import lru_cache
from pprint import pprint
import re
from dotenv import load_dotenv
from pandas import DataFrame
from nltk.corpus import stopwords as NLTK_STOPWORDS
from gensim.parsing.preprocessing import STOPWORDS as GENSIM_STOPWORDS
from spacy.lang.en.stop_wo... |
"""This file contains helpers for writing probabilistic programs.
A probabilistic context (ProbCtx) provides the constructs sample() and score().
A simple probabilistic program would look like this
def simple_prog(ctx: ProbCtx) -> float:
# sampling:
sample = ctx.sample(torch.distributions.Normal(... |
"""! @file
# Util Parsing
TODO_DOC
## Dependencies
* logging
* util.config
* datetime
## Functions
* StripLeadingWhitespace
* StripTrailingWhitespace
* IsComment
* StripConsecutiveLineEndings
* ReplaceTodosWithConfig
* MakePostscript
* flatten
[generated by Auto Code Commenter at 2022-03-08 20:17:00. ht... |
import math
from torch import nn as nn
from networks.resnet_ae import conv3x3
def deconv4x4(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.ConvTranspose2d(in_planes, out_planes, kernel_size=4, stride=stride, padding=1, bias=False)
class InvBasicBlock(nn.Module):
expansion ... |
"""
BSD 2-Clause License
Copyright (c) 2020, <NAME> (<EMAIL>)
Social Cognition in Human-Robot Interaction
Istituto Italiano di Tecnologia (IIT)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the ... |
import requests
from bs4 import BeautifulSoup
import pandas as pd
import lxml
def crawl(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/83.0.4103.116 Safari/537.36 '
}
html = requests.get(url, headers=... |
import numpy as np
import discorpy.losa.loadersaver as io
import discorpy.proc.processing as proc
import discorpy.post.postprocessing as post
import scipy.ndimage as ndi
file_path = "C:/data/percy_cam/F_R_hazcam.png"
output_base = "./for_demo_08/"
mat0 = io.load_image(file_path, average=True)
mat0 = mat0 / np.max(mat... |
import math
import random
import json
from models.controller import accelerating_controller
# if I want a car to spawn every 3 ticks i should give 1/3 as an argument
def next_time(rate_parameter):
return -math.log(1.0 - random.random()) / rate_parameter
def create_simulation_file(ticks=100, spawn_rat... |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, The Horizomer Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------... |
'''An example of using SQLTransaction hooks.'''
# Copyright 2018-2019, <NAME>
# This work is released under the ISC license - see LICENSE for details
# SPDX-License-Identifier: ISC
import decimal
import random
import sys
from pyxact import fields, queries, records, transactions
from pyxact import loggingdb
import ex... |
from cgi import test
from json.tool import main
from operator import le
import requests
import pandas as pd
import xgboost as xgb
import numpy as np
import sys
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
# chosen songs
""" song_ids ... |
#!/usr/bin/python3
"""Crypto Currency Portfolio: Assets Selection.
Description:
Crypto Currency Selection using monte Carlo simulation.
"""
# %% Import dependencies ----
# core
import os
import gc
# data science
import pandas as pd
import numpy as np
from scipy.stats import norm
# Cloud integration
from azure... |
###############################################################################
# #
# Copyright 2017 - <NAME> #
# #
# L... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
#import microwave_networks as mw_net
import skmd as md
mpl.rc('axes',labelsize=24)
mpl.rc('font',size=24)
### Define constant
#c = 3e8 # Velocity of light in meters/second
c = md.VELOCITY_OF_LIGHT
epsilon_r = 10 # dielectric constant or ... |
import numpy as np
from pandas import DataFrame
from scipy.ndimage import measurements
from .raw import Raw
from .epochs import Epochs
def align_to_aoi(data, screen, mapping=None):
"""Align eyetracking data to areas of interest.
Parameters
----------
data : Raw | Epochs | array, shape=(n_trials, n... |
#!/usr/bin/env python
'''
Machine tracker client. Connects to server and sends
coordinates
'''
import networking as nt
import socket
import threading
import time
import logging
def get_new_data():
return nt.get_ip_address(nt.interface) + ' time is ' + str(time.time())
def discover_server(client_port, g... |
"""
This script contains code for producing the boids animations using the cv2
library
"""
# ---------------------------------- Imports ----------------------------------
# Allow imports from parent folder
import sys, os
sys.path.insert(0, os.path.abspath('..'))
# Standard library imports
import time
f... |
import fileinput
import logging
import pathlib
from collections import defaultdict
from fnmatch import fnmatch
from typing import Iterable
import isort
from ni_python_styleguide import _acknowledge_existing_errors
from ni_python_styleguide import _format
from ni_python_styleguide import _utils
_module_logger = loggi... |
from torchmd.forcefields.forcefield import _ForceFieldBase
from math import radians
import numpy as np
def load_parmed_parameters(fname):
""" Convenience method for reading parameter files with parmed
Parameters
----------
fname : str
Parameter file name
Returns
-------
prm : Par... |
# python3
"""Visitor that extracts definitions from an AST."""
import collections
import contextlib
from typing import Dict, List, Tuple
from pytype.tools.pyi_checker import definitions
from typed_ast import ast3
# pylint raises lots of false positives for Namespace and the visit_ methods.
# pylint: disable=invalid-n... |
"""
File: london_scraper.py
Project: scrape_london_marathon
Author: <NAME>
"""
import concurrent.futures # to allow multithreading
import re
import requests
from typing import Optional, Union
# from multiprocessing import Pool, cpu_count # to allow multiprocessing
import pandas as pd
from autologging import logged... |
import io
import logging
import numpy as np
import torch
import glob
import os
import cv2
import mstyles.Transformer as StylesTrans
import cartoon.Transformer as CartoonTrans
from torch.autograd import Variable
from ml_serving.utils import helpers
from young.Transformer import Pipe as YoungHook
LOG = logging.getLogge... |
# Copyright 2016 The TensorFlow Authors. 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 appl... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# licensed under CC-Zero: https://creativecommons.org/publicdomain/zero/1.0
import pywikibot
from pywikibot.data import api
from datetime import datetime, timedelta
import re
site = pywikibot.Site('wikidata', 'wikidata')
site.login()
repo = site.data_repository()
def additi... |
import argparse
import datetime
import json
import pytz
import requests
import os
import sys
import time
import traceback
import tqdm
from utils import (
load_config,
log,
Mongo,
radec_str2geojson,
)
""" load config and secrets """
config = load_config(config_file="config.yaml")["kowalski"]
def mon... |
import torch
import torch_sparse as tsparse
import torch_scatter as tscatter
import tqdm
def tri_areas(vertices, faces):
v1 = vertices[faces[:, 0], :]
v2 = vertices[faces[:, 1], :]
v3 = vertices[faces[:, 2], :]
v1 = v1 - v3
v2 = v2 - v3
return torch.norm(torch.cross(v1, v2, dim=1), dim=1) ... |
"""
Copyright (c) 2018 DecisionVis, 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 list of conditions and the followi... |
# -*- coding: utf-8 -*-
"""Utilities and logic for handling inter-toml merges."""
from datetime import date
from datetime import datetime
from datetime import time
from typing import Dict
from typing import List
from typing import Union
from tomlkit.container import Container
from tomlkit.container import OutOfOrderT... |
import torch.utils.data
import torchvision.datasets
import torchvision.transforms
import numpy
import os
from .autoaug import ImageNetPolicy, CIFAR10Policy
def load_dataset(dataset_name, data_dir, crop_size, train, stdaug,
autoaugment=False, random_erasing_prob=0.0, random_erasing_type='... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... |
from sklearn.metrics import confusion_matrix
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from helper_code import twelve_leads, load_header, load_recording, get_labels
fre = 500
idx = 0
s = 0
def get_confusion_value(y_true, y_pred):
# ordering: tn, fp, fn, tp
return confusion_matrix... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
import os
import sys
import zipfile
import random
from lxml import etree
from lxml import html
from pprint import pprint
from yattag import indent
from yattag import Doc
FILETYPES = {
'weblink' : 'imswl_xmlv1p1',
'discussions' : 'imsdt_xmlv1p1',
'aut... |
from datetime import datetime
from collections import namedtuple
class User:
def __init__(self, name):
self.name = name
self._lobby = Comment(self.name)
self._online_status = False
self._last_seen = None
self._class_received = self.__class__.__name__
@property
def get_name(self):
retur... |
# coding: utf-8
from sqlalchemy import (
BigInteger,
Boolean,
Column,
Date,
DateTime,
ForeignKey,
Integer,
String,
Text,
text,
)
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base =... |
from django.conf import settings
from media_manager.models import Course
from media_manager.lti import LTILaunch
import requests
import json
import re
import logging
logger = logging.getLogger(__name__)
class CourseService(object):
def __init__(self, lti_launch):
self.lti_launch = lti_launch
self... |
#!/usr/bin/env python
import sys
import os
import fcntl
import types
import warnings
from nose.plugins.attrib import attr
from nose.tools import assert_equal, assert_true, assert_greater_equal, assert_raises, assert_set_equal, assert_not_equal
from plastid.util.services.decorators import (
notimplemented,
depre... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Wrapper pro O2TV Go
"""
import httplib
import urllib
import json
import requests
__author__ = "<NAME>"
__license__ = "MIT"
__version__ = "1.1.7"
__email__ = "<EMAIL>"
_COMMON_HEADERS = { "X-Nangu-App-Version" : "Android#1.2.9",
"X-Nangu-Device-Na... |
import json
import time
from functools import reduce
import boto3
import cfn_flip
import click
import requests
from botocore.config import Config
from github import Github
from ..utils.encrypt import encrypt
config = Config(
region_name="eu-west-1",
)
def recursive_get(d, *keys):
return reduce(lambda c, k:... |
# Script for generating .xml files containing information about government coalitions. Based on Wikipedia data and far from complete. Needs manual checking after running!!
import re, string,os
from glob import glob as gb
import pandas as pd
from tqdm import tqdm
from collections import Counter
import datetime as dt
im... |
import unittest
from yadis import services, etxrd, xri
import os.path
def sibpath(one, other, make_absolute=True):
if os.path.isabs(other):
return other
p = os.path.join(os.path.dirname(one), other)
if make_absolute:
p = os.path.abspath(p)
return p
XRD_FILE = sibpath(__file__, os.path... |
from bson.objectid import ObjectId
from datetime import datetime
from . import db
class Contact(db.EmbeddedDocument):
"""Sub-document for use in list of citation and data access contacts"""
name = db.StringField(max_length=255)
# TODO make this a mongoengine.fields.EmailField
email = db.StringField(... |
#!/usr/bin/env python
import tf
import math
import rospy
from nav_msgs.msg import Path
from tf import TransformListener
from tf2_msgs.msg import TFMessage
from geometry_msgs.msg import PoseStamped
from tf_velocity_estimator.msg import Velocity
from tf_velocity_estimator.msg import PosesAndVelocities
tf_ = None
path_pu... |
import os
import scanpy as sc
from ._plotting import pair_plot, plot_z_3d, keys_to_colors, plot_x_traj
import numpy as np
from ._mymodel import MyModel
from . import setup_anndata
import scvi
def save_results_txt(
model_path, latent, cell_type, start_idx, end_idx, time_course, init_indices
):
np.savetxt(os.p... |
import numpy as np
from astropy.io import fits, ascii
import matplotlib.pyplot as plt
import warnings
try:
from ..utils import get_baseDir
except ImportError as err1:
warnings.warn("Could not import baseDir. Will save diagnostics to . ")
def get_baseDir():
return "."
import os
import pdb
from copy i... |
import os
import torch
import numpy as np
# import numpy.linalg
# from PIL import Image
# import cv2
# import scipy.io
# from dataset.data_util_dome.data_util import samping_img_set, glob_imgs, load_img
from dataset.data_util_dome.transform import RandomTransform
# from dataset.data_util_densepose.uv_converter import... |
from contextlib import contextmanager
import os
import sys
import tempfile
from typing import Tuple, List, Generator, Optional
from unittest import TestCase, main
import mypy.api
from mypy.build import _get_site_packages_dirs, FileSystemCache
from mypy.test.config import package_path
from mypy.test.helpers import run_... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 20:25:16 2017
@author: memo
demonstrates inference with frozen graph def
same as sample.py, but:
- instead of loading model + checkpoint, loads frozen graph
- instead of calling model.sample() function, uses own sample() function with named ops
"""
import argparse
i... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.... |
import pytest
from bioimageio.core import export_resource_package
# test models for various frameworks
torch_models = ["unet2d_fixed_shape", "unet2d_multi_tensor", "unet2d_nuclei_broad_model"]
torchscript_models = ["unet2d_multi_tensor", "unet2d_nuclei_broad_model"]
onnx_models = ["unet2d_multi_tensor", "unet2d_nuclei... |
import json
import logging
import os
from argparse import Namespace
import apiclient.discovery
import httplib2
from oauth2client import tools
from oauth2client.client import HttpAccessTokenRefreshError, flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.service_account import ServiceAccoun... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import glob
from tqdm import tqdm
from multiprocessing import Pool
def converter(file_mp4):
file_avi = file_mp4.replace('.mp4', '.avi')
# file_new = file_name.replace('.3gp', '.mp4')
comm = 'ffmpeg -i {0} -strict -2 {1}'.format(file_mp4, file_avi)
os... |
"""
Road Trip Planner written in Python!
Uses a database of geographical locations to plan a trip between two cities,
perhaps not very efficiently, but surely more interestingly than Google Maps!
Authors:
<NAME> (<EMAIL>)
"""
import argparse
import collections
import csv
import logging
import math
import pathlib
... |
from pygame import *
import random
from time import time as t
font.init()
font=font.SysFont('Arial', 40)
window = display.set_mode((700,500))
display.set_caption("pygame window")
background =transform.scale(image.load("galaxy.jpg"), (700,500))
rocket=transform.scale(image.load("rocket.png"), (100,100))
bullet =transf... |
# -*- coding: utf-8 -*-
from six.moves import range
import cmath
import netCDF4
import numpy
import copy
import glob, os, re
def take_fermi_parser(file): # calc_node_pk = node_conv_wfl.outputs.last_calculation
for line in file:
if '[X]Fermi Level' in line:
print('The Fermi level is {}'.forma... |
"""
TODO: This.
"""
import re
import signal
import traceback
from abc import ABC
from multiprocessing import Event, Process, Queue
from queue import Empty
from threading import Thread
from time import monotonic
from traceback import print_last
from typing import Any, Callable, NamedTuple, List, Union, Type, Optional
f... |
import re
from functools import partial, wraps
from random import shuffle
import ConfigSpace
import numpy as np
import torch
from torch.utils.data import Dataset
from nasbench301.surrogate_models.bananas.bananas_src.darts.arch import Arch
from nasbench301.surrogate_models.bananas.darts_src.genotypes import Genotype
... |
from cStringIO import StringIO
from email import Generator as G, MIMEMultipart as MMP, MIMEText as MT, MIMEImage as MI
from zope.interface import implements
from twisted.python.reflect import qual
from epsilon.extime import Time
from axiom import store
from axiom.item import Item
from axiom.attributes import integ... |
# Copyright (c) 2017 Microsoft Corporation.
#
# 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, publis... |
from __future__ import print_function
import signal
from time import sleep
from os import system
from sys import stdout
from uldaq import (get_daq_device_inventory, DaqDevice, AInScanFlag, ScanStatus,
ScanOption, create_float_buffer, InterfaceType, AiInputMode)
done = False
def sigint_handler(sig, ... |
import cv2
import math
import numpy as np
from PIL import Image
from PIL import ImageDraw
import pyblur
import random
from random import randint
from raindrop.config import cfg
"""
This module contains a description of Raindrop class
"""
def make_bezier(xys):
# xys should be a sequence of 2-tuples (Bezier control... |
"""Utility, creates projects and nodes. Deletes existing nodes of input type by default."""
import os
from glob import glob
import json
import sys
from datetime import datetime
from gen3_etl.utils.ioutils import reader
from gen3_etl.utils.cli import default_argument_parser
from gen3_etl.utils.gen3 import create_node,... |
#! /usr/bin/env python3
#
# JTAG programmer using Arduino (computer script)
# <NAME>, 2019
#
# Version 1.0
#
# Based on https://github.com/mattdibi/Programmatore-JTAG-per-Xilinx/blob/master/JTAG/JTAG.ino
# by <NAME>
# by <NAME>
# by <NAME>
#
# Extended command set:
# *! -> tms bit
# ., ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'JosePh.XRays'
__DateTime__ = '2018-03-11 12:18:26'
import os
import sys
import texttable
import re
from optparse import OptionParser, OptionGroup
from termcolor import colored
import ProxyBase
from ProxyBase import KuaiProxy, XiciProxy
from proxyChecker imp... |
#AI for the car
# Importing libraries
import numpy as np #Working with arrays
import random #taking random samples
import os #load and save the model
import torch #only lib that can handle dynamic graphs
import torch.nn as nn#neural network
import torch.nn.functional as F #functions for nn
import torch.optim as optim... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016--, <NAME>.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------------------------------------------------------------... |
import json
import os
import random
import sys
from collections import Counter
from typing import cast
import math
import numpy as np
from injector import inject, Injector
from decai.simulation.contract.classification.classifier import Classifier
from decai.simulation.contract.classification.decision_tree import Deci... |
from flask import Flask, request, render_template, jsonify
from clusterapp.core import statistics
from clusterapp.utils import build_library
CLUSTERING_ALGORITHMS = [
('hdbscan', 'HDBSCAN'),
('gmm', 'Gaussian Mixture Model'),
('kmeans', 'K-Means'),
('spectral', 'Spectral Clustering'),
('affinity',... |
# Licensed to the Encore Technologies ("Encore") 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 use... |
"""For reading, parsing and writing fixed format text files.
Copyright 2013 University of Auckland.
This file is part of PyTOUGH.
PyTOUGH is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 ... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from datetime import datetime
import re, logging
from django.core.signing import Signer, BadSignature
from django.template.loader import select_template
from django.contrib.sites.shortcuts import get_current_site
from django.utils.translation import get_langua... |
import os
import shutil
import base64
from browser import Browser
import tempfile
import email
from PIL import Image
import pickle
from browser import Browser
from utils import deduplicate_filename, wget, wait
import time
class Cache:
base_filename=("cached-", ".data")
index_filename=("data-", ".pickled")
... |
import os
import json
import logging
import random
from transformers import BertTokenizer, BertForMaskedLM, BertConfig
from transformers import AlbertTokenizer, AlbertForMaskedLM, AlbertConfig
from transformers import RobertaTokenizer, RobertaForMaskedLM, RobertaConfig
from transformers import BartForConditionalGenera... |
# 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.
import logging
from enum import Enum
from typing import List
import torch
import torch.nn as nn
import torchvision.models as models
from torch... |
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.core.exceptions import ValidationError
from django.db import transaction
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.utils.... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import reagent.types as rlt
import torch
import torch.nn.functional as F
from reagent.gym.types import Sampler
class SoftmaxActionSampler(Sampler):
"""
Softmax sampler.
Equation: http://incompleteideas.net/boo... |
import importlib
import inspect
import os
import sys
import torch.nn as nn
PATH = os.path.join(
os.path.abspath(os.path.join(os.path.dirname(__file__), "..")), "libdata"
)
def get_args(func, dictionary):
argspec = inspect.getfullargspec(func)
args = argspec.args
kwargs = 0 if argspec.varkw is None e... |
from django.shortcuts import get_object_or_404
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.utils.encoding import smart_str
from rest_framework import status, generics
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_f... |
# Copyright 2019 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
def common_test(points, my_points, func):
"""
Common test part for KS and Kuiper Test
:param points:
:return:
"""
number_of_bins = 100
values, bins = np.histogram(points, bins=number_of_bins)
my_values = my_... |
"""Support for Homekit device discovery."""
import logging
import homekit
from homekit.model.characteristics import CharacteristicsTypes
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import de... |
import os
import signal
import ssl
import threading
from contextlib import contextmanager
from textwrap import dedent
from mock import Mock
from pip._vendor.contextlib2 import nullcontext
from werkzeug.serving import WSGIRequestHandler
from werkzeug.serving import make_server as _make_server
from pip._internal.utils.... |
"""Handle MySensors OTA FW updates."""
import binascii
import logging
import os
import struct
import crcmod.predefined
from intelhex import IntelHex, IntelHexError
FIRMWARE_BLOCK_SIZE = 16
_LOGGER = logging.getLogger(__name__)
def fw_hex_to_int(hex_str, words):
"""Unpack hex string into integers.
Use littl... |
from typing import List, Callable
import confluent_kafka
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
class KafkaBatchConsume(Task):
"""
Task for consuming a batch of messages from Kafka topics.
Args:
- bootstrap_servers (str, optional): comma separated host a... |
import sys
import logging
import collections
from PIL import Image
import gw2buildutil
from .. import util
logger = logging.getLogger(__name__)
PAGE_ID = 'compositions'
PAGE_TITLE = 'Guild Wars 2 raids compositions'
GAME_MODE = gw2buildutil.build.GameModes.RAIDS
TARGET_BOONS = [ # ordering here determines roles dis... |
# coding=utf-8
# Copyright 2022 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... |
# Copyright 2021 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
'''
* This Software is under the MIT License
* Refer to LICENSE or https://opensource.org/licenses/MIT for more information
* Written by ©<NAME> 2020
'''
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
import cv2
from PIL import Im... |
import asyncio
import logging
import socket
import ssl
from abc import ABC, abstractmethod
from functools import partial
from pathlib import Path
from typing import Any, Optional, Tuple, Union
from ..utils import OptionsType, TimeoutType, awaitable, bind_socket
from .base import SimpleServer
from .tcp import RobustTCP... |
from typing import List, Tuple, Optional, Union, Any
from collections import defaultdict
from collections.abc import Mapping, Sequence
import torch
from torch import Tensor
from torch_sparse import SparseTensor, cat
from torch_geometric.data.data import BaseData
from torch_geometric.data.storage import BaseStorage, ... |
import os
from OpenSSL import crypto
from flask import jsonify, g, current_app
from sqlalchemy import func
from sqlalchemy.exc import IntegrityError
from actor_libs.database.orm import db
from actor_libs.errors import ReferencedError
from actor_libs.utils import get_delete_ids, generate_uuid
from app import auth
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Discretize *adult* data
SYNOPSIS::
SCRIPT [options]
Description
===========
Discretize *adult* data as the procedure written in [DMKD2010]_.
- Integer attributes are divided into 4 bins each of which contains
equal numbers of samples.
- Nominal attribute valu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# Copyright (c) Ostap developers.
# =============================================================================
# @file test_fitting_transform.py
# Test module
# - It tests transform-PDF
#... |
from typing import Tuple, Optional
import numpy as np
import numpy.ma as ma
import scipy.ndimage
from cloudnetpy import utils
class Ceilometer:
"""Base class for all types of ceilometers."""
def __init__(self, full_path: str):
self.file_name = full_path
self.backscatter = np.array([])
... |
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
from postagger.utils.common import timeit
from time import time
import operator
from postagger.utils.features import build_y_x_matrix, build_feature_matrix_, init_callable_features
from postagger.utils.params import Params
from postagger.utils.common import vi... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) 2021 PaddlePaddle Authors. 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/l... |
import base64
import asyncio
import urllib.parse
import json
import typing
from dataclasses import dataclass
from mangum.lifespan import Lifespan
from mangum.utils import get_logger, make_response
from mangum.types import ASGIApp
from mangum.protocols.http import ASGIHTTPCycle
from mangum.protocols.websockets import A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.