text stringlengths 3.07k 12.6k |
|---|
'''
test_Connectable.py
Tests the functionality of connectable
Copyright (C) 2015 <NAME>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>, <NAME>, Aranuvir
**Copyright(c):** MakeHuman Team 2001-2019
**Licen... |
# -*- coding: utf-8 -*-
"""
Dictionary-based Thai Word Segmentation
using maximal matching algorithm and Thai Character Cluster (TCC).
The code is based on the notebooks created by <NAME>.
:See Also:
* \
https://colab.research.google.com/notebook#fileId=1V1Z657_5eSWPo8rLfVRwA0A5E4vkg7SI
* \
ht... |
# -*- test-case-name: vumi.tests.test_testutils -*-
import re
from datetime import datetime, timedelta
import warnings
from functools import wraps
import pytz
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.internet.defer import DeferredQueue, inlineCallbacks
from twisted.p... |
#!/usr/bin/python3
"""
Best-practices tracker for Tor source code.
Go through the various .c files and collect metrics about them. If the metrics
violate some of our best practices and they are not found in the optional
exceptions file, then log a problem about them.
We currently do metrics about file size, function... |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""2013-2017 format"""
# https://git.sr.ht/~leite/cso2-bsp-converter/tree/master/item/src/bsptypes.hpp
import collections
import enum
import io
import struct
import zipfile
from . import vindictus
FILE_MAGIC = b"VBSP"
BSP_VERSION = 100 # 1.00?
GAME_PATHS = {"Counter-Strike: Online 2": "CSO2"}
GAME_VERSIONS = {GA... |
"""Clean Wikipedia dumps for use as a training corpus."""
import re
import argparse
import html
import bz2
import logging
from .utensils import log_timer
from multiprocessing import cpu_count
logging.basicConfig(format='[{levelname}] {message}', style='{', level=logging.INFO)
cores = int(cpu_count() / 2)
@log_timer
d... |
try:
import ctypes
HAS_CTYPES = True
except ImportError:
HAS_CTYPES = False
import traceback
import weakref
try:
from pydevd_comm import GetGlobalDebugger, CMD_SET_BREAK
except ImportError:
pass
import framewrapper
try:
import pydevd
except ImportError:
pass
import sims4.log
import enum
logg... |
"""
Fast Marching Trees (FMT*)
@author: <NAME>
"""
import os
import sys
import math
import random
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
"/../../")
from Sampling_based_Planning.rrt_2D import ... |
#!/usr/bin/env python3
import csv
import subprocess
import sys
import numpy
from matplotlib import pyplot
from matplotlib import cm
bin_dir = sys.argv[1]
output_dir = sys.argv[2]
trials = 5
containers = ["segmented_tree_seq", "btree_seq", "bpt_sequence", "avl_array",
"deque", "vector"]
single_8_label... |
from flask import Flask, render_template, request, redirect
from flask_pymongo import PyMongo
import wikipedia
import nltk
import re
import pymongo
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
import math
app = Flask(__name__)
# app.config['MONGO_DBNAME'] = 'wittyhacks'
# a... |
# Author: <NAME>
# Public Domain
# Ce script n'est PAS un modèle de bonnes pratiques pythoniennes.
# Mieux vaut se focaliser sur les autres scripts qui sont bien mieux écrits.
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
tfin = 15e-3 # inst... |
GRAPHVIZ_COLORS = ['coral2', 'cadetblue3', 'gold', 'coral1', 'aquamarine4', 'darkslategrey',
'cyan2', 'antiquewhite3', 'coral', 'azure4', 'darkkhaki', 'deeppink',
'antiquewhite4', 'beige', 'firebrick3', 'firebrick1', 'brown1', 'darkgreen',
'cornsilk1', 'darkgold... |
# -*- coding: utf-8 -*-
from .api import get_data, get_sprite
from .common import api_url_build, sprite_url_build
def _make_obj(obj):
"""Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/do... |
"""
This is fabfile for deploying autopublisher
on debian stretch on custom preinstalled pyenv python
"""
import os
import sys
from fabric.state import env
from fabric.api import cd, run, sudo, settings
from fabric.contrib.files import exists, upload_template
from secrets import DEPLOY_HOST, DEPLOY_USER
from ... |
import asyncio
import time
from typing import Any, Awaitable, Callable, List
import multiaddr
from multiaddr import Multiaddr
from p2pclient import Client
import pytest
from libp2p.peer.id import ID
from libp2p.peer.peerinfo import PeerInfo, info_from_p2p_addr
from .constants import LOCALHOST_IP
from .envs import GO... |
import abc
import json
import logging
import sys
import typing
import sh
from kubeyard.commands.devel import BaseDevelCommand
logger = logging.getLogger(__name__)
class TestCommand(BaseDevelCommand):
"""
Runs tests in docker image built by build command. Can be overridden in <project_dir>/sripts/test.
... |
"""
Data Models | Cannlytics
Author: <NAME> <<EMAIL>>
Created: 5/8/2021
Updated: 6/5/2021
Data schema of the Cannlytics platform.
"""
# Standard imports
from dataclasses import dataclass
# from dataclasses import field
from datetime import datetime, timedelta
from typing import Optional
# from typing import Any, List... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from operations import *
from torch.autograd import Variable
from genotypes import PRIMITIVES
import numpy as np
from thop import profile
from matplotlib import pyplot as plt
from thop import profile
from analyti... |
# Adapted from https://github.com/anki/vector-python-sdk/blob/master/examples/apps/remote_control/remote_control.py
import argparse
import sys
import anki_vector
import pyglet
from pyglet.window import key
import vector_utils as utils
class RemoteControlVector:
def __init__(self, robot):
self.vector = r... |
import numpy as np
import torch
import torch.nn as nn
import torch.optim
import torch.nn.functional as F
import os
import models
from datasets import ISIC_few_shot, EuroSAT_few_shot, CropDisease_few_shot, Chest_few_shot, miniImageNet_few_shot, tiered_ImageNet_few_shot
from tqdm import tqdm
import pandas as pd
import ... |
"""Configure number in a device through MQTT topic."""
import logging
import voluptuous as vol
from homeassistant.components import number
from homeassistant.components.number import NumberEntity
from homeassistant.const import (
CONF_DEVICE,
CONF_ICON,
CONF_NAME,
CONF_OPTIMISTIC,
CONF_UNIQUE_ID,
... |
# -*- coding:utf-8 -*-
# &Author AnFany
from Heart_Data import model_data as H_Data
import numpy as np
#计算混淆矩阵
from prettytable import PrettyTable
def confusion(realy, outy):
mix = PrettyTable()
type = sorted(list(set(realy.T[0])), reverse=True)
mix.field_names = [' '] + ['预测:%d类'%si for si... |
import collections
from pype.modules.ftrack import BaseEvent
class TaskToVersionStatus(BaseEvent):
"""Changes status of task's latest AssetVersions on its status change."""
# Attribute for caching session user id
_cached_user_id = None
# Presets usage
asset_types_of_focus = []
def register(... |
# -*- coding: utf-8 -*-
"""
TensorFlow2.0 kerasapi 分布式训练 Cifar10
训练环境:3个GPU 1080Ti + 2*1070Ti
训练集准确率:98.27%
验证集准确率:84.77%
测试机准确率:84.34%
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import pickle
import tensorflow as tf
from tensorflow import keras
# TensorFlow日志显示等级... |
"""SelfStoreDict for Python.
Author: <NAME> <<EMAIL>>
The module provides a subclassed dictionary that saves itself to a JSON file or redis-key whenever changed or when used
within a context.
"""
import json
from os.path import getmtime
from datetime import datetime, timedelta
from pathlib import Path
def adapt(paren... |
""" Question 2: Cell by cell Parallelization """
import numpy as np
import numba
from numba import cuda
import sys
import time
import math
OUTPUT_TIMING_DATA = False
#define constants
grid_size = 4
eta = 0.0002
rho = 0.5
G = 0.75
num_threads = 8
#cuda kernal that processes one x,y coordinate of the grid's interior
@... |
# encoding: utf-8
import os
import codecs
import webbrowser
from collections import Mapping
from dominate import document, tags
from .resources import (open_document_snippet,
enable_tooltip_snippet,
clickable_popover)
from .path_tools import ensure_path_exists
META_DIV_... |
import numpy as np
from rnn_utils import *
def lstm_cell_forward(xt, a_prev, c_prev, parameters):
"""
Implement a single forward step of the LSTM-cell as described in Figure (4)
Arguments:
xt -- your input data at timestep "t", numpy array of shape (n_x, m).
a_prev -- Hidden state at timestep "t-... |
# Produce a boxplot of the %age of commits during a particular Python.
# Note this doesn't run any front-ends here, it just looks at the repos
# and counts the commits corresponding to Python release dates.
# Violin plot code from here:
#https://matplotlib.org/examples/statistics/customized_violin_demo.html
import ... |
import numpy as np
import cv2
def abs_sobel_thresh(img, orient='x', thresh=(20, 100)):
"""
#---------------------
# This function applies Sobel x or y, and then
# takes an absolute value and applies a threshold.
#
"""
# Take the derivative in x or y given orient = 'x' or 'y'
if orient... |
"""Handle messages."""
from datetime import date, datetime, timedelta
from sqlalchemy import or_
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import ObjectDeletedError, StaleDataError
from sqlalchemy.orm.scoping import scoped_session
from telegram.error import BadRequest, RetryAfter, Unauthorized
from... |
import spacy
from initialize import spacy_nlp
from interfaces.SentenceOperation import SentenceOperation
from interfaces.SentencePairOperation import SentencePairOperation
from tasks.TaskTypes import TaskType
"""
Auxiliary Negation Removal.
Remove auxiliary negations generating a sentence with oposite meaning.
""... |
# -*- coding: utf-8 -*-
# ZX Spectrum Emulator.
# https://github.com/kosarev/zx
#
# Copyright (C) 2017-2019 <NAME>.
# <EMAIL>
#
# Published under the MIT license.
from ._binary import BinaryParser, BinaryWriter
from ._data import Data
from ._data import FileFormat
from ._error import Error
from ._z80snapsh... |
#!/usr/bin/env python
# pylint: disable=no-value-for-parameter
from jumpscale.loader import j
import click
import stellar_sdk
import datetime
from urllib import parse
_ASSET_ISUERS = {
"test": {
"TFT": "GA47YZA3PKFUZMPLQ3B5F2E3CJIB57TGGU7SPCQT2WAEYKN766PWIMB3",
"FreeTFT": "GBLDUINEFYTF7XEE7YNWA3... |
from contextlib import contextmanager
import pytest
from django.contrib.auth.signals import user_logged_in
from disguise.signals import disguise_applied, disguise_removed
@pytest.fixture(autouse=True)
def fix_settings(settings):
settings.DISGUISE['can_disguise'] = ('example_project.stuff.'
... |
import abc
from typing import List
##############
# Models
##############
class HasMetadata(abc.ABC):
'''
An abstract base class that allows the storing of key/value pairs as metadata.
'''
def __init__(self):
self.metadata = dict()
def add_metadata(self, key, value):
self.metada... |
import math
import os
from typing import Tuple, List, Dict
import torch
import sys
import json
import h5py
import numpy as np
import time
def cur_time():
return time.strftime('%Y,%b,%d,%X')
def log_important(message, log_file):
print(message, cur_time())
with open(log_file, 'a') as f:
print(messag... |
# Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from logging import getLogger
from os import remove
from os.path import isdir, isfile, join
from re import match
try:
from setuptools.command.build_py import build_py
from setuptools.command.sdist import sdist
from setu... |
#! /usr/bin/env python
"""Script used to generate a tb file of TWA candidate members.
Using astrometry info from Donaldson 2016, converts into preferred units,
then applies chronostar.traceback.traceback() (?) function.
"""
import chronostar.traceback as tb
import chronostar.retired.groupfitter as gf
import chronosta... |
"""
Provides classes for creating mocked objects.
"""
import io
from collections import MutableMapping, defaultdict
__all__ = ["MockObject", "MockHTTPResponse", "MockOpenTextFile"]
class MockObject(MutableMapping):
"""
Object from which we can construct other "mocked" objects.
Limitations
----------... |
import os
import json
import typing as t
from unittest.mock import patch, MagicMock
import jsonlines
from pyfakefs.fake_filesystem_unittest import TestCase
from starwhale.utils.fs import ensure_dir, ensure_file
from starwhale.consts.env import SWEnv
from starwhale.api._impl.model import _RunConfig, PipelineHandler
fr... |
# Copyright (c) 2010 The Hewlett-Packard Development Company
# 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, this list of... |
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import VGG
from mmcv.runner import BaseModule, Sequential
from ..builder import BACKBONES
@BACKBONES.register_module()
class SSDVGG(VGG, BaseModule):
"""VGG Backbone network for single-shot-detection.
Args:
... |
#System
import numpy as np
import sys
import os
import random
from glob import glob
from skimage import io
from PIL import Image
import random
import SimpleITK as sitk
#Torch
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
import torch.nn.functional as F
... |
"""
@ Author : <NAME>
@ Date : 09/14/2017
@ Description : Input Label - A label that holds data
@ Notes: Copy this file and services.yaml files and place it in your
"Home Assistant Config folder\custom_components\" folder
To use the component, have the foll... |
from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
import simplejson as json
import os
from .due import due, Doi
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.model... |
# 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, ... |
import textwrap
import sys
from datetime import datetime
HEADER = """\
from zic.classes import *
from datetime import *
"""
RAW_FILES = [
'africa', 'antarctica', 'asia', 'australasia',
'europe', 'northamerica', 'southamerica'
]
def lines(input):
"""Remove comments and empty lines"""
for raw_line... |
import pytest
from unittest import TestCase
from pyflamegpu import *
SCALAR_TEST_VALUE = 12
ARRAY_TEST_VALUE = (1,2,3,4)
class MiniSim:
"""
Replaces the mini sim class in C++ but provides a function to return a dynamic agent
function based off the provided type.
"""
def __init__(self):
... |
# ---------- PACKAGE IMPORTATIONS ---------- #
import twitter
import pandas as pd
import numpy as np
import time
import json
import argparse
import logging
logging.basicConfig(filename='app.log', filemode='w', level=logging.INFO, format='%(name)s - %(levelname)s - %(message)s')
# ---------- SINGLETON CLASS FOR TWITT... |
"""File contains functions to generate the multiplier's hardware description."""
import os
import math
def generate_vhdl_tb(pp_list, exp_prime):
"""Top-level function to generate VHDL code."""
file_ptr = open(("vhdl/mod_mul_tb.vhd"), 'w')
cycles = math.ceil(math.log2(len(pp_list)))+3
write_lib(file_pt... |
#!/usr/bin/env python
import collections
import time
import numpy as np
import requests
from astropy.table import Table
from astropy.time import Time
from chandratime import convert_chandra_time
# Globals
# URLs for 6 hour and 7 day JSON files
GOES_URL_ROOT = 'https://services.swpc.noaa.gov/json/goes/primary/'
GOE... |
import numpy as np
import cv2
import pyopengv
import logging
from matplotlib import pyplot as plt
from opensfm import context
from opensfm import multiview
logger = logging.getLogger(__name__)
# pairwise matches
def match_lowe(index, f2, config):
"""Match features and apply Lowe's ratio filter.
Args:
... |
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet.gluon.data import dataset
from mxnet.gluon.data import dataloader
import collections
import os
class ImageWithMaskDataset(dataset.Dataset):
"""
A dataset for loading images (with masks) stored as `xyz.jpg` and `xyz_mask.png`.
Parameter... |
import sys
import numpy as np
import pytest
from neclib.utils import AzElData, ParameterList, ParameterMapping
class TestParameterList:
def test_init(self):
assert ParameterList() == ParameterList([])
assert ParameterList(range(5)) == ParameterList([0, 1, 2, 3, 4])
assert ParameterList([1... |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... |
# Copyright 2018 The Bazel Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
from dataclasses import dataclass
from typing import Optional, Union, Dict, Callable, List, TYPE_CHECKING
from ray.actor import ActorHandle
from ray.air.config import DatasetConfig
if TYPE_CHECKING:
from ray.data import Dataset, DatasetPipeline
from ray.data.preprocessor import Preprocessor
RayDataset = Uni... |
"""
CREDITS: @TheBenGenral
"""
import os
import re
import subprocess
import sys
import traceback
from asyncio import sleep
from html import escape
from io import StringIO
from time import time
from pyrogram import filters
from pyrogram.errors import MessageNotModified
from pyrogram.types import Message, R... |
"""
Functions:
calc_consensus
count_clusters
Classes:
ConsensusScore
"""
import os, sys
class ConsensusScore:
"""
C Matrix of consensus scores.
C_flat List of the scores on the upper diagonal.
score2cdf Dictionary of consensus score -> CDF.
auc Area under the curve.
... |
#!/usr/bin/env python3
import atexit
import logging
import json
import time
import os.path
import sys
from pprint import pprint, pformat
import pypresence
from pypresence import Presence
import psutil
# TODO list
# * Figure out how to use the episode ID to get more useful information about what's playing.
# * Setup ... |
from __future__ import absolute_import
import torch
from torch import nn
# from torch.autograd import Variable
# import numpy as np
import torch.nn.functional as F
import torchvision.models as models
import torchvision.ops as tops
# from roi_align.roi_align import RoIAlign
# def to_varabile(arr, requires_grad=Fals... |
import math
from queue import Queue
from IPython import embed
import torch
import torch.cuda.comm as comm
from torch.nn.modules.batchnorm import _BatchNorm
import torch.nn.functional as F
import syncbn_gpu
class SyncBNFucntion(torch.autograd.Function):
@staticmethod
def forward(ctx, x, gamma, beta, running_... |
import logging
import numpy as np
from pandas.api.types import is_numeric_dtype
from scipy.interpolate import griddata
from scipy.stats import multivariate_normal
# Some useful functions
# Root mean square of a matrix
def RMS(x):
return np.sqrt(np.sum(np.mean(np.square(x), axis=0)))
# Log likelihood of a mat... |
#!/usr/bin/env python
import itertools
import os
import sys
from pathlib import Path
from tkinter import *
import keyboard
import pyautogui
import pytesseract
from PIL import Image
from pystray import Icon, Menu, MenuItem
# ----------------------------------------------------------------------------
# Tesseract-OCR ... |
import bisect
# Split into pairs
def create_pairs (a):
# Create local stores for use
split_array = [];
temp_array = [];
for num, value in enumerate(a, start=1):
temp_length = len(temp_array)
if temp_length == 1:
temp_array.append(value)
split_array.append(temp_array)
temp_array = []... |
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import reframe as rfm
import reframe.utility.sanity as sn
from hpctestlib.apps.amber.nve import Amber_NVE
# FIXME: Use tuple... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
import os
import yaml
from atomic_reactor.constants import (PLUGIN_CHECK_AND_SET_PLATFORMS_KEY, REPO... |
import asyncio
from datetime import datetime as dt
from django.db.models import Q
from django.shortcuts import get_object_or_404
from django.utils import timezone as djangotime
from packaging import version as pyver
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions impo... |
'''Script for testing trained models
'''
import os
from heapq import nlargest
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
from scikitplot.metrics import plot_confusion_matrix
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import transforms, datasets
im... |
import re
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Q
from django.shortcuts import render, redirect, reverse
from django.http import HttpResponse
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib... |
import os
import re
import sys
import tokenize
from string import ascii_lowercase, ascii_uppercase, digits
from .version import version as __version__
NOQA_REGEX = re.compile(r"#[\s]*noqa:[\s]*[\D]+[\d]+")
if sys.version_info >= (3, 7):
from importlib.resources import read_text
else:
from importlib_resources... |
import torch
import matplotlib.pyplot as plt
# Calculate total link length for given sample, it is assumed the base of robot is at (0,0). Input is the position of joints in one timestamp
def base_to_ee_distance(input):
## Turn data to sets of 2 so that we can reach each joint seperately.
different_view = inp... |
import os
import pytest
import json
from contextlib import contextmanager
from geventhttpclient import HTTPClient
from gevent.ssl import SSLError
import gevent.pool
import gevent.server
listener = ('127.0.0.1', 5432)
@contextmanager
def server(handler):
server = gevent.server.StreamServer(
listener,
... |
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import os
from hokusai import CWD
from hokusai.lib.command import command
from hokusai.lib.config import HOKUSAI_CONFIG_DIR, config
from hokusai.lib.common import print_green, shout, returncode
from hokusai.services.ecr import ECR
from hokusai.services.kubectl import Kubectl
from hokusai.services.configmap import Conf... |
# Copyright (c) 2013-2016 <NAME> et al.
#
# 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,
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import model
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import datetime
import tensorflow as tf
from tensorflow.python.platform import gfile
flags = tf.app.fla... |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test Chrome using chromedriver.
If the webdriver API or the chromedriver.exe binary can't be found this
becomes a no-op. This is to allow running locally ... |
# ---------------------------------------------------------------------
# AlarmEscalation model
# ---------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python mo... |
"""Modified from https://github.com/JiahuiYu/slimmable_networks/blob/master/utils/distributed.py"""
from collections import OrderedDict
import os
import functools
import torch
import torch.nn as nn
import torch.distributed as dist
from torch.nn.parallel.scatter_gather import scatter_kwargs
from torch._utils import _f... |
"""
SC101 Baby Names Project
Adapted from <NAME>'s Baby Names assignment by
<NAME>.
YOUR DESCRIPTION HERE
"""
import tkinter as tk
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt', 'data/full/baby-1930.txt',
'data... |
#!/usr/bin/env python3
###########################################################################
#
# Copyright 2019 Dell, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... |
# Functions to create rays for each action
import collections
import funtool.state_measure
import funtool_common_processes.reporters.to_repl
import hashlib
Ray= collections.namedtuple('Ray',['direction','origin','magnitude','piece_history'])
@funtool.state_measure.state_and_parameter_data
def full_rays(state,paramet... |
# Copyright (c) ZenML GmbH 2022. 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:
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
"""Calendar component."""
from imperial_calendar.GregorianDateTime import GregorianDateTime
from imperial_calendar.ImperialDateTime import ImperialDateTime
from imperial_calendar.ImperialYearMonth import ImperialYearMonth
from ui.Api import Api
from ui.utils import current_grdt
import typing as t
__pragma__: t.Any = 0... |
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def ffmpeg_read(bpayload: bytes, sampling_rate: int) -> np.array:
"""
Helper function to read an audio file through ffmpeg.
"""
ar = f"{sampling_rate}"
ac = "1"
format_for_conversion = "f32le"
f... |
# Copyright 2020 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 writi... |
"""
META
Self:
About;
Bot info;
Help;
Source.
"""
import os
import typing as t
from datetime import datetime, timedelta
from inspect import getsourcelines
from os.path import relpath
from platform import python_version
from subprocess import check_output
from sys import platform
from time import time
... |
from sympy.differential_geometry.rn import R2, R2_p, R2_r
from sympy.differential_geometry import (ScalarField, VectorField,
intcurve_series, intcurve_diffequ)
from sympy import (symbols, simplify, sqrt, atan2, Matrix, sin, cos, Function,
Derivative)
# TODO explicit and well ordered imports
# Most of t... |
# Copyright (c) 2020, 2021, Oracle and/or its affiliates.
#
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
# check ip_whitelist
# check state of group
from utils import kutil
from utils import mutil
import json
def check_group(test, icobj, all_pods, user... |
from charm.toolbox.Hash import ChamHash
from charm.toolbox.integergroup import IntegerGroupQ, gcd, randomPrime, isPrime, random
from charm.toolbox.conversion import Conversion
debug = False
class Chamwithemp(ChamHash):
def __init__(self):
global group
group = IntegerGroupQ(0)
# generate pk ... |
from typing import List, Callable, Dict, Any, Tuple, NamedTuple
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as tf_layers
from tensorflow.python.ops import template as template_ops
from tqdm import tqdm
from glow import flow_layers as fl
from glow import tf_ops
from glow import tf_ops a... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Megactivation(nn.Module):
def __init__(self):
super().__init__()
self.sigmoid = lambda x: torch.sigmoid(x)
self.linear = lambda x: x
self.swish = lambda x: torch.sigmoid(x) * x
self.neg = lambda x: -x
... |
"""
Scripts specific to dealing with motion, in particular motion retargeting of mixamo data. Relies on Blender
2.79 API.
"""
import bpy
import logging
import re
LOG = logging.getLogger(__name__)
def detect_bone_prefix(bones):
"""
Mixamo data tends to prefix bone names with character names or other prefixes.... |
from itertools import product
import numpy as np
import pandas as pd
import torch
from trains import Task
from models.detection.SSD.priorbox_optimization import PriorOptimizationInput, ImageSizeTuple
from models.detection.SSD.priorbox_optimization.bbox_clustering import get_box_pairwise_iou
def collect_ground_truth... |
from __future__ import division, print_function, absolute_import
# noinspection PyUnresolvedReferences
from six.moves import range
import numpy as np
from scipy.misc import doccer
from ...stats import nonuniform
from ...auxiliary.array import normalize, nunique, accum
__all__ = ['markov']
_doc_default_callparams =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.