text stringlengths 3.07k 22.1k |
|---|
'''
From input short- and long- reads, run the whole partitioning pipeline and get the final partitioned read list.
'''
import argparse
from argparse import RawTextHelpFormatter
import subprocess
from subprocess import PIPE
import os, sys, time
import logging
import re
from . import filterGraph
def checkStatus(args):
... |
'''Files required for PNA implementation.
Code taken from https://github.com/lukecavabarrett/pna/
'''
from typing import Optional, List, Dict
from torch_geometric.typing import Adj, OptTensor
import torch
from torch import Tensor
from torch.nn import ModuleList, Sequential, Linear, ReLU
from torch_geometric.nn.conv ... |
'''
Created on Nov 1, 2013
@author: holtjma
'''
import argparse as ap
import logging
import os
import sys
import MSBWTGen
import util
from MUSCython import CompressToRLE
from MUSCython import GenericMerge
from MUSCython import MSBWTCompGenCython
from MUSCython import MSBWTGenCython
from MUSCython import MultimergeC... |
# Copyright (c) 2022 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/licenses/LICENSE-2.0
#
# Unless required by appli... |
import torch
from fairseq.models.bart import BARTModel
import argparse
from pprint import pprint
from tqdm import tqdm
import os
from os.path import join
import shutil
import time
import re
import logging
import numpy as np
import json
import random
import string
import shutil
import files2rouge
import time
def test_... |
import datetime
import os
import time
import pytest
from xxhash import xxh3_128
from ocdskingfisherarchive.crawl import Crawl
from ocdskingfisherarchive.exceptions import FutureDataVersionError, SourceMismatchError
from tests import crawl_fixture, create_crawl_directory, path
with open(path('data.json'), 'rb') as f:... |
# flake8: noqa
from typing import Any, Callable, Dict, List, Optional
import os
import torch
from torch.utils.data import Dataset
from catalyst.contrib.datasets.functional import (
download_and_extract_archive,
read_image_file,
read_label_file,
)
from catalyst.data.dataset.metric_learning import (
Met... |
# Copyright 2009 Google 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, ... |
from enum import IntEnum
import dataclasses
from typing import Optional
class InstructionClass(IntEnum):
LD = 0x00
LDX = 0x01
ST = 0x02
STX = 0x03
ALU = 0x04
JMP = 0x05
JMP32 = 0x06
ALU64 = 0x07
@dataclasses.dataclass
class NormalOpcodeEncoding:
opcode: IntEnum
inst_class: I... |
"""
network.py
~~~~~~~~~~
A module to implement the stochastic gradient descent learning
algorithm for a feedforward neural network. Gradients are calculated
using backpropagation. Note that I have focused on making the code
simple, easily readable, and easily modifiable. It is not optimized,
and omits many desirab... |
from tensorflow import pad
from tensorflow.keras.layers import Layer, GlobalAveragePooling2D, Reshape, Conv2D, Multiply, Conv3D
from ..utils.helpers import ensure_multiplicity, get_nd_gaussian_kernel
from tensorflow.python.keras.engine.input_spec import InputSpec
import tensorflow as tf
import numpy as np
class Reflec... |
import logging
import traceback
import uuid
from collections import defaultdict
import pymongo
import six
from blitzdb.backends.base import Backend as BaseBackend
from blitzdb.backends.base import NotInTransaction
from blitzdb.backends.mongo.queryset import QuerySet
from blitzdb.document import Document
from blitzdb.... |
import itertools
import pytest
from opentrons.broker import publish
from opentrons.api import Session
from opentrons.api.session import _accumulate, _get_labware, _dedupe
from tests.opentrons.conftest import state
from functools import partial
state = partial(state, 'session')
@pytest.fixture
def labware_setup():
... |
# -*- coding: utf-8 -*-
import numpy as np
from .utils_complexity_attractor import _attractor_lorenz
def complexity_simulate(
duration=10, sampling_rate=1000, method="ornstein", hurst_exponent=0.5, **kwargs
):
"""**Simulate chaotic time series**
This function generates a chaotic signal using different a... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import divis... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
from universal import tools
import seaborn as sns
from statsmodels.api import OLS
from matplotlib.colors import ListedColormap
class PickleMixin(object):
def save(self, filename):
""" Save object as a pickle """
... |
import discord
from discord.ext import commands
from discord.ext.commands import has_permissions, BucketType, cooldown
from datetime import datetime, timedelta
import asyncio
import json
import pymongo
class Moderation(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['m'])
@comm... |
#! /bin/bash
"source" "find_python.sh" "--local"
"exec" "$PYTHON" "$0" "$@"
import os
import sys
import shutil
import threading
import logging
import time
from collections import OrderedDict
from argparse import *
from glob import glob
import signal
from functools import partial
sys.path.append(os.path.join('automati... |
#
# test_util.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ... |
"""
Implementation of 'Nth Farthest' task
as defined in Santoro, Faulkner and Raposo et. al., 2018
(Relational recurrent neural networks, https://arxiv.org/abs/1806.01822)
Note: The training data is re-generated each epoch as in the
Sonnet implementation. This avoids overfitting but means that the
experiments may take... |
"""
Synthesize Partitura Part or Note array to wav using additive synthesis
"""
import numpy as np
import os
from soundfile import SoundFile
from scipy.interpolate import interp1d
import partitura
TWO_PI = 2 * np.pi
SAMPLE_RATE = 44100
A4 = 440
DTYPE = float
def midinote2freq(midi_pitch, a4=A4):
return (a4 / ... |
"""Go through a BAM file made from alignments on a FASTQ and do the following:
1. BADBAM: Create a bam file containing only the misaligned reads. The read (CHROM, POS, CIGAR) are set to be the correct alignment
and the original alignment (CHROM, POS, CIGAR) is encoded in extended tags (see below).
The reason for setti... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import random
import os
from scipy.misc import imsave
from data_manager import *
from utils import *
from metric_MIG import *
from shutil import copyfile
import glob... |
#!/usr/bin/python
# Copyright (c) 2017, 2020 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# *********************************************************************************
# REopt, Copyright (c) 2019-2020, 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 a... |
"""
validataclass
Copyright (c) 2021, binary butterfly GmbH and contributors
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
"""
from datetime import datetime, tzinfo
from enum import Enum
import re
from typing import Any, Optional
from .string_validator import Strin... |
# -*- coding: utf-8 -*-
### Import required python modules
import logging
from gevent import monkey; monkey.patch_all()
import platform
import os
from os import listdir, stat, makedirs, mkdir, walk, remove, pardir
from os.path import isdir, isfile, join, splitext, getmtime, basename, normpath, exists, expanduser, spl... |
import pandas as pd
from pathlib import Path
import sys
import numpy as np
import re
# negotiation units
nego_units = ('<sep>', '<end>', '<greet>', '<agree>', '<disagree>', '<inquire>', '<propose>', '<inform>', '<unk>')
# converter
index_to_phrases = {index : unit for index, unit in enumerate(nego_units)}
def con... |
#
# Copyright 2020 by 0x7c2, <NAME>.
# All rights reserved.
# This file is part of the Report/Analytic Tool - CPme,
# and is released under the "Apache License 2.0". Please see the LICENSE
# file that should have been included as part of this package.
#
from templates import diag
import os, time
import func
class dia... |
# coding=utf-8
# Copyright 2021 TF.Text 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 ag... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""""Airtest图像识别专用."""
import os
import sys
import time
import types
from airtest import aircv
from airtest.aircv import cv2
from airtest.core.error import TargetNotFoundError
from airtest.core.helper import G, logwrap, log_in_func
from airtest.core.settings import Settings... |
#
# Collective Knowledge
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: <NAME>
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temporal data)
ck=None # Will be updated by CK (initialized CK kernel)
# Local ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import re
import socket
import time
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
from datetime import datetime
from importlib import import_module
from inspect import getmembers
import requests
logging.basicConfig... |
import os
import numpy as np
import cv2
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from utils import read_list_from_file
from transforms import ResizeWithIntrinsic, RandomHorizontalFlipWithIntrinsic, CenterCropWithIntrinsic, EqualizeHist
from torchvision.transforms import ToTenso... |
#!/usr/bin/env python
from __future__ import division
import time
import Adafruit_PCA9685
import RPi.GPIO as GPIO
from Adafruit_GPIO import I2C
import rospy
from geometry_msgs.msg import Twist
# sudo apt install RPi.GPIO
# pip install adafruit-pca9685
# pip install adafruit-gpio
class SunFounder:
# STEERING
... |
# Copyright (c) 2012 OpenStack Foundation.
# 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... |
import socket
from time import sleep
import sys
import pickle
from threading import Thread
from manualreview import rawscriptsmenu
import hashlib
from manualreview import videoscriptcore
import datetime
from manualreview import publishmenu
from manualreview import settings
from PyQt5 import QtWidgets
impo... |
import click
import shutil
import os
import re
import subprocess
from collections import defaultdict
from typing import List, Dict, FrozenSet
import networkx as nx
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
from networkx.algorithms.simple_paths import all_simple_paths
class... |
"""
This file gives methods to create features for the tracker
"""
import numpy as np
import torch
EPS = 0.00001
"""
API functions to access all existing features
"""
def calculate_edge_features(nodes, edges, feature_list, sequence_info):
""" Selects one of feature calculation methods and calculates the featu... |
# -*- coding: UTF-8 -*-
# 当前脚本只能在 Windows 下运行
# 可以使用 Python 3 的语法,Windows 下大家约定用 Python 3.7 以上
import os
import shutil
import subprocess
import sys
import hashlib
import socket
import time
import build_linux_yaml_template as template
NOW_TEXT = time.strftime("%Y-%m-%d_%H_%M_%S%z", time.localtime())
# 要保证有 2 位数来表示子游戏类... |
#!/usr/bin/env python3
import glob
import re
import sys
import os
import btstack_parser as parser
meta_events = [
'A2DP',
'ANCS',
'AVDTP',
'AVRCP',
'GATTSERVICE',
'GOEP',
'HFP',
'HID',
'HIDS',
'HSP',
'LE',
'MAP',
'MESH',
'PBAP',
]
supported_event_groups = meta... |
#!/usr/bin/env python
# Get a permission denied error when running the script in the shell? chmod 755 the script .py file
import sys
import os
import subprocess
import shutil
import http.client, urllib
# COMIC_TAGGER_PATH = 'COMIC_TAGGER_PATH/Applications/ComicTagger.app/Contents/MacOS/ComicTagger'
COMIC_TAGGER_PAT... |
import base64
import json
import pytest
from pytest import fixture
from chalice import app
from chalice import NotFoundError
def create_event(uri, method, path, content_type='application/json'):
return {
'context': {
'http-method': method,
'resource-path': uri,
},
... |
# Copyright (c) 2019 <NAME>
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
import os
import random
import time
import json
import uuid
import logging
import traceback
from base64 import b64encode
from mutagen.mp3 import MP3
from t... |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Any, ClassVar, Iterable, cast
from pants.base.build_enviro... |
import torch
from torch.optim.lr_scheduler import LambdaLR, _LRScheduler
import torchvision.utils as vutils
import torch.distributed as dist
import errno
import os
import re
import sys
import numpy as np
from bisect import bisect_right
num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
is_... |
from __future__ import absolute_import, division, print_function
import json
import os
import sys
import shutil
import requests
import logging
import tempfile
import zipfile
from subprocess import Popen, PIPE
import warnings
from .exceptions import CondaException
from .utils import shell_out
mini_file = "Miniconda-l... |
"""modify charge categories
Revision ID: 441441c32014
Revises: <KEY>
Create Date: 2018-06-07 10:16:12.182839
"""
# revision identifiers, used by Alembic.
revision = '441441c32014'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
# Categories to be removed in upgrade
LISTED_BUILDING_CPC = 'Li... |
# -*- coding:utf-8 -*-
"""
WPTools Wikidata module
~~~~~~~~~~~~~~~~~~~~~~~
Support for getting Wikidata.
https://www.wikidata.org/wiki/Wikidata:Data_access
"""
import collections
import re
from . import core
from . import utils
class WPToolsWikidata(core.WPTools):
"""
WPToolsWikidata class
"""
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" write_results.py - Methods for writing prospector ingredients and outputs
to HDF5 files as well as to pickles.
"""
import os, time, warnings
import pickle, json, base64
import numpy as np
try:
import h5py
_has_h5py_ = True
except(ImportError):
_has_h5py_ =... |
import REESMath.vector3 as V3
import REESMath.quaternion as Q
import REESMath.coordsys as C
import REESMath.matrix3 as M3
import numpy as np
class MaterialBehaviour:
def __init__(self):
self.mu = V3.ones() # Coefficients of Friction
self.epsilon = 0.0 # Coefficient of restitution
class Mate... |
#!/usr/bin/env python
# Purpose:
#
# Script to take the existing model_metadata.json file or a directory and scans for
# model_metadata.json files and retrain, save them to DC 2.3 models.
#
# usage: model_retrain.py [-h] -i INPUT [-o OUTPUT]
#
# optional arguments:
# -h, --help show this help message ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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/LICEN... |
from cogs.Permissions import command_channels, dm_commands
from discord.ext import commands
from typing import Dict, List
import discord
import random
import os
hangman_embed = discord.Embed(
title="Reaction Hangman",
color=discord.Color.red()
).set_footer(text='Tip: search "regional" in the reaction menu')
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import chain
from operator import methodcaller
import regex as re
from six.moves import zip_longest
from dateparser.utils import normalize_unicode
PARSER_HARDCODED_TOKENS = [":", ".", " ", "-", "/"]
PARSER_KNOWN_TOKENS = ["am", "pm", "UTC... |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/rl_config.py
__version__=''' $Id: rl_config.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__='''Configuration file. You may edit this if you wish.... |
from contextlib import contextmanager
import itertools
import sys
PY3 = (sys.version_info[0] >= 3)
def constant(cls):
"""
Pickleable singleton generator.
Usage:
>>> @constant
... class MyConstant(object):
... pass
...
>>> MyConstant
MyConstant
"""
cls.__repr__ = cls... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Sets up umbrella windows for OpenMM AMOEBA FF simulation.
This script prepares windows for umbrella sampling simulations of an ion passing
through an ion channel protein. The user needs to provide a PDB and OpenMM XML
state file file containing a pre-equilibrated simu... |
from collections import defaultdict
from typing import Dict, Generic, List, TypeVar, Tuple
import torch
from allennlp.common.registrable import Registrable
from allennlp_semparse.state_machines import util
from allennlp_semparse.state_machines.states import State
from allennlp_semparse.state_machines.transition_func... |
"""
Script to reproduce the few-shot view reconstruction results in:
"Meta-Learning Probabilistic Inference For Prediction"
https://arxiv.org/pdf/1805.09921.pdf
The following command lines will reproduce the published results within error-bars:
python train_view_reconstruction.py
python evaluate_view_reconstruction.p... |
from PIL import Image
from difflib import SequenceMatcher
import hashlib, os, imagehash, argparse
# Setup arguments
parser = argparse.ArgumentParser(description="Image deduplicator")
parser.add_argument('-m', '--mode', help="Deduplicator operation mode (rename, move, organize, similar, all)", required=True)
parser.add... |
import torch
import torch.nn as nn
import skimage
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
def conv_block(in_channels, out_channels):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.BatchNorm2d(num_features=out_channels),
... |
"""
Sleep staging on the Sleep Physionet dataset
============================================
This tutorial shows how to train and test a sleep staging neural network with
Braindecode. We adapt the time distributed approach of [1]_ to learn on
sequences of EEG windows using the openly accessible Sleep Physionet datase... |
"""Merge data produced in different shards of extraction.
Namely:
1. Trajectories
2. Scene cuts
Output: single merged files trajectories.jsonl and scene_changes.json
"""
from typing import Set
import argparse
import os
import json
import glob
from utils.utils import load_images_map
def is_trajectory_valid(t... |
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torchlibrosa as tl
import numpy as np
import matplotlib.pyplot as plt
import config
from fracdiff.torch import fdiff
def move_data... |
"""Run the program"""
import pygame
import logging
import copy
import time
import sys
from board import SudokuBoard
from tile import TileText
DEFAULT_BG_COL = (255, 255, 255)
MAX_BACKUP_LENGTH = 100
class Button(object):
DEFAULT_COL = (0, 0, 0)
DEFAULT_TEXTCOL = (0, 0, 0)
def __init__(self, text):
... |
"""The application data"""
import os
from configparser import ConfigParser
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Dict, Tuple
from ast import literal_eval as make_tuple
import appdirs
import cobra
import pkg_resources
from qtpy.QtCore import Qt
from qtpy.QtGui import QColor
c... |
from datetime import datetime
from typing import Callable, List, Optional, Union
import pandas as pd
import pyarrow
import pytz
from pydantic.typing import Literal
from feast import FileSource, OnDemandFeatureView
from feast.data_source import DataSource
from feast.errors import FeastJoinKeysDuringMaterialization
fro... |
import os
import sys
import datetime
import multiprocessing
import shutil
import sqlite3
import sys
import tempfile
import typing
import time
import urllib
import logging
import subprocess
import click
from pathlib import Path
#from pyvirtualdisplay import Display
import attr
import bs4
import dateutil.parser
import f... |
from manpy.simulation.imports import (
Machine,
Queue,
NonStarvingEntry,
Exit,
Part,
EventGenerator,
ExcelHandler,
Part,
)
from manpy.simulation.Globals import runSimulation, G
import random
from random import Random
Rnd = Random(2)
import time
start = time.time()
# simulation time
ma... |
# License: BSD 3-Clause
import json
import xmltodict
import pandas as pd
import numpy as np
from typing import Union, List, Optional, Dict
import collections
import openml.utils
import openml._api_calls
from ..evaluations import OpenMLEvaluation
import openml
def list_evaluations(
function: str,
offset: Opt... |
#!/usr/bin/env python
# -- encoding: utf-8 --
#
# Copyright 2015-2016 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of... |
""" Example or something
"""
import pandas as pd
from alpha_vantage.timeseries import TimeSeries
import config_terminal as cfg
import res_menu as rm
from discovery import disc_menu as dm
from due_diligence import dd_menu as ddm
from fundamental_analysis import fa_menu as fam
from helper_funcs import *
from prediction... |
# This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# 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... |
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
## -*- coding: utf-8 -*-
##
## Copyright (c) 2021, <NAME> <gpiemont at sdf.org>
## 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file : neural_layer.py
@author: zijun
@contact : <EMAIL>
@date : 2019/12/13 16:52
@version: 1.0
@desc : Implementation of fundamental layer of deep neural network
"""
import math
import numpy as np
import torch
from torch.nn import init
np.random.seed(4)
# to c... |
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
import google.api_core.exceptions as grpc_exceptions
from google.cloud.spanner_v1 import param_types
from .exceptions import... |
# coding=utf-8
import tensorflow as tf
from tensorflow.contrib import slim
from builders import frontend_builder
import numpy as np
import os, sys
# define a initializer
initializer = slim.variance_scaling_initializer(factor=2.0, mode='FAN_IN', uniform=False)
# Use bilinear interpolation to adjust images to a fixed s... |
# Copyright 2017 Google Inc. 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 applicable law or ag... |
import pygame
import math
import numpy as np
from pygame.locals import *
class Wheel():
def __init__(self, window, colour, pos, size):
self.window = window
self.colour = colour
self.size = size
self.pos = np.array(pos)
self.ang = 0.0
self.mat = np.array([[math.cos(... |
"""The tests for the Open Peer Power HTTP component."""
from ipaddress import ip_network
import logging
import unittest
from unittest.mock import patch
import openpeerpower.components.http as http
from openpeerpower.setup import async_setup_component
from openpeerpower.util.ssl import server_context_intermediate, serv... |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2010 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... |
import logging
import pprint
import time
from copy import deepcopy
import numpy as np
import torch
import scipy.stats as st
from lib.dknn import DKNNL2, KNNModel
from lib.dknn_attack_v2 import DKNNAttackV2
from lib.loaders import initialize_data
from lib.utils.utils import get_logger
def print_ci(mean, sem, num_tri... |
#!/bin/python3
# https://github.com/SimonLammer/testpythonscript
"""
This can be used to test other python scripts.
Other scripts will be imported and tested in a new subprocess each.
"""
import argparse
from contextlib import contextmanager
from datetime import datetime, timedelta
from functools import wraps
from imp... |
""" Instruction selector.
This part of the compiler takes in a DAG (directed
acyclic graph) of instructions and selects the proper target instructions.
Selecting instructions from a DAG is a NP-complete problem. The simplest
strategy is to split the DAG into a forest of trees and match these
trees.
Another solution ... |
import tensorflow as tf
from detext.layers.embedding_layer import create_embedding_layer
from detext.utils.layer_utils import get_sorted_dict
from detext.utils.parsing_utils import InputFtrType, InternalFtrType
class LstmLayer(tf.keras.layers.Layer):
def __init__(self, bidirectional, rnn_dropout, num_layers, for... |
"""
Provider implementation based on google-api-python-client library
for GCP.
"""
import json
import logging
import os
import re
import time
from string import Template
import google.auth
import google_auth_httplib2
import googleapiclient
from googleapiclient import discovery
import httplib2
from google.auth.crede... |
"""High-level synthesis routine for whole implementations.
This module exports one important function:
- improve_implementation
"""
from collections import OrderedDict
import datetime
import itertools
from typing import Callable, Any
import sys
import os
import pickle
from queue import Empty
from multiprocessing imp... |
#!/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 mephisto.data_model.assignment import (
Assignment,
InitializationData,
AssignmentState,
)
from mephis... |
import pulp as lpp
import numpy as np
# Predefined weights, choice same as the one taken in the paper
# "Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths"
# First derivative weight
w1 = 10
# Second derivative weight
w2 = 1
# Third derivative weight
w3 = 100
# Dimension of 2D motion model consider... |
# Copyright 2014 IBM Corp.
# 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 app... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# ----------------------------------------------------------------------------
"""Repor... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
"""A collection of classes, metaclasses and functions for Plugins
As a plugin developer: Subclass from one of the JB_Plugin classes and implement the abstract functions.
The plugin managers load and hold plugins.
"""
import abc
import inspect
import os
import sys
import traceback
from collections import OrderedDict
f... |
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this list
# of conditions and the following disclaimer.... |
import sys
from collections import OrderedDict
import numpy as np
from holoviews.core.data import Interface, DictInterface, MultiInterface
from holoviews.core.data.interface import DataError
from holoviews.core.data.spatialpandas import to_geom_dict
from holoviews.core.dimension import OrderedDict as cyODict, dimensio... |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 EPAM Systems
"""
Yocto builder module
"""
import os.path
import shlex
from typing import List, Tuple, cast
from moulin.utils import create_stamp_name
from yaml.nodes import MappingNode, SequenceNode
from moulin import yaml_helpers as yh
from moulin import ninja_sy... |
import sys
import os
import os.path as osp
import time
import logging
import numpy as np
import argparse
from copy import deepcopy
from tqdm import tqdm
import torch
assert torch.__version__ == '0.4.0'
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.opt... |
import os
import sys
import glob
import h5py
import numpy as np
from PIL import Image
from scipy import misc
sys.path.append('..')
import lib
from lib.config import (config_output_collected_dir,
config_output_processed_dir,
config_mesh_dir, project_dir)
from lib import v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.