text stringlengths 3.07k 22.1k |
|---|
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the testkraut package for the
# copyright and license terms.
#
### ### ### ### ... |
#!/usr/bin/python3
########################################
#
# This is a proof of concept. This code is neither good nor commented.
#
########################################
import sys
import signal
import os
import ast
import docker as d
import configparser
import glob
dry_run=False
debug_run=False
info_run=False... |
# -*- coding: utf-8 -*-
"""Module with the Graphviz drawing calls."""
#
# (C) Pywikibot team, 2006-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id: 536e6478c6715c151e3d941b79c452b53496f82e $'
#
import threading
try:
import py... |
import os
import shutil
import logging
import json
import difflib
from tqdm import tqdm
from urllib.parse import urlparse
from documentstore_migracao.utils import files, xml
from documentstore_migracao import config
from documentstore_migracao.export.sps_package import (
SPS_Package,
SourceJson,
NotAllowed... |
#!/usr/bin/env python
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import dash
from dash.dependencies import Input, Output, State
import dash_table
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas... |
#
#
# File: utilities.py
#
#
#
#
import msgpack
from common_tools.redis_support_py3.construct_data_handlers_py3 import Generate_Handlers
from common_tools.file_server_library.file_server_lib_py3 import Construct_RPC_File_Library
from common_tools.system_error_log_py3 import System_Error_Logging
from common_too... |
import numpy as np
import cv2
import sys, datetime
import rospy, rosnode, rostopic, rosmsg
import std_msgs.msg, sensor_msgs.msg, nav_msgs.msg
from sensor_msgs.msg import Range, Image, CompressedImage
from threading import Thread
from geometry_msgs.msg import Pose, Twist
from nav_msgs.msg import Odometry
from tf.transfo... |
# pylint: disable=missing-docstring
import json
from collections import Counter
from typing import List, Tuple
import matplotlib.pyplot as plt
from nltk import pos_tag
from nltk.corpus import stopwords
from nltk.probability import FreqDist
from nltk.tokenize import word_tokenize
from context_args_parse i... |
#!/usr/bin/env python3
import csv
import os
import re
import logging
import numpy as np
from collections import Counter
from logging import debug, info, warning, basicConfig
basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
from scipy.stats import describe, zscore
score_names = "german english math la... |
from django import VERSION
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from django.utils.translation import ugettext_lazy as _t
from django.utils impor... |
import sys
import struct
import win32wnet as win32wnet
from win32.wnet import *
# Constants generated by h2py from nb30.h
NCBNAMSZ = 16
MAX_LANA = 254
NAME_FLAGS_MASK = 0x87
GROUP_NAME = 0x80
UNIQUE_NAME = 0x00
REGISTERING = 0x00
REGISTERED = 0x04
DEREGISTERED = 0x05
DUPLICATE = 0x06
DUPLICATE_DEREG = 0x07
LISTEN_OUT... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
#=======================================================================================
# Imports
#=======================================================================================
from lib.base import *
from lib.capplib import *
from lib.configutils import ConfigS... |
import os
import sys
import signal
import functools
import inspect
import contextlib
import logging
import time
import grpc
from grn.utils.utils import is_server_available, find_gpu_master_address
from grn.utils.gpu_monitors import SingleGPUProcessMonitor
import grn.grpc_resources.master_pb2 as protos
import grn.grpc... |
import numpy as np
import numpy.testing as npt
import unittest
import floatingse.map_mooring as mapMooring
from floatingse.column import ColumnGeometry
from pymap import pyMAP
from commonse import gravity as g
def myisnumber(instr):
try:
float(instr)
except:
return False
return True
myones... |
import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.nn import BatchNorm2d
class PSPModule(nn.Module):
'''
Implementation of pyramid spatial pyramid pooling block at 4 sclaes
Input:
N X C X H X W
Parameters:
sizes : the scales of adaptive averagepooling
Return:
N X C X H X W
... |
import logging
import logging.config
import logging.handlers
from logging import FileHandler, StreamHandler, Formatter
from multiprocessing import Process, Queue, Event, current_process
from time import sleep
import os
from pathlib import Path
import atexit
import shutil
import coloredlogs
from copy import deepcopy
f... |
import sys
import pygame
from .utils import percent_round_int
from ple.games import base
from pygame.constants import K_a, K_d
class Paddle(pygame.sprite.Sprite):
def __init__(self, speed, width, height, SCREEN_WIDTH, SCREEN_HEIGHT):
self.speed = speed
self.width = width
self.SCREEN_WID... |
import datetime
import enum
import logging
import chardet
import tqdm
import subprocess
import re
import sys
import dataclasses
from typing import List, Set, Tuple, Optional, Any
from modification import Modification
from javadoc_analyzer import has_java_javadoc_changed
_commit_line = re.compile(r'^commit ([0-9a-f]{... |
'''
/************************************************************************
MIT License
Copyright (c) 2021 AI4CE Lab@NYU, MediaBrain Group@SJTU
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 Softwar... |
# -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: trygve <<EMAIL>>
# :copyright: (c) 2014, trygve
# (c) 2014-2015, The Tor Project, Inc.
# (c) 2014-2015, <NAME>... |
# fourFn.py
#
# Demonstration of the pyparsing module, implementing a simple 4-function expression parser,
# with support for scientific notation, and symbols for e and pi.
# Extended to add exponentiation and simple built-in functions.
# Extended test cases, simplified pushFirst method.
# Removed unnecessary exp... |
# Copyright 2014 Rackspace
# Copyright 2016 Blue Box, an IBM Company
#
# 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
#
# ... |
import pytest
@pytest.fixture(scope='module')
def view():
from model import Model
from config import DATA_FILES, DATA_MERGE_KEYS
from view import View
try:
view = View( Model( DATA_FILES['companies'], DATA_FILES['users'], DATA_MERGE_KEYS['companies'], DATA_MERGE_KEYS['users'] ) )
return... |
"""
Python job scheduling for humans.
An in-process scheduler for periodic jobs that uses the builder pattern
for configuration. Schedule lets you run Python functions (or any other
callable) periodically at pre-determined intervals using a simple,
human-friendly syntax.
Inspired by <NAME>' article "Rethinking Cron" ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2016, the Pyzo development team
#
# Pyzo is distributed under the terms of the 2-Clause BSD License.
# The full license can be found in 'license.txt'.
import urllib.request, urllib.parse
from pyzo.util.qt import QtCore, QtWidgets
imported_qtwebkit = True
try:
... |
from unittest import TestCase
import tempfile
import os
from wifi import Cell
from wifi.scheme import extract_schemes, Scheme
from wifi.exceptions import ConnectionError
NETWORK_INTERFACES_FILE = """
# This file describes the network interfaces available on your system
# and how to activate them. For more informatio... |
# -*- coding: utf-8 -*-
# Copyright 2017 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 ... |
###########################################################################
#
# 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/l... |
from asm import (
AC,
C,
X,
Xpp,
Y,
adda,
beq,
bgt,
ble,
blt,
bne,
bra,
hi,
jmp,
label,
ld,
lo,
nop,
pc,
st,
suba,
)
from ._utilities import REENTER, add_cost_of_reenter, cost_of_reenter
from .variables import (
IP_hi,
IP_lo,
... |
import pytest
import os, shutil
import numpy as np
from flare.utils.element_coder import _Z_to_mass, _Z_to_element, _element_to_Z
from flare.ase.atoms import FLARE_Atoms
from ase.calculators.lammpsrun import LAMMPS
from ase.io import read, write
from .get_sgp import get_sgp_calc, get_random_atoms
n_species_list = [1,... |
import operator
import random
import sys
import typing
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from datetime import datetime
from functools import reduce
from bees import count_gaps
from domino_puzzle import (Board, BoardGraph, GraphLimitExceeded, DiceSet,
ArrowSet... |
from django.db import models, IntegrityError
from django.db import connection
from django.db.models import Avg, Count, Sum
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.utils.translation import ugettext... |
import tkinter as tk
import tkinter.ttk as ttk
from tkinter import font
import datetime
import os
import requests
import webbrowser
from urllib.parse import urlparse
#-------------------------------------------------------------------------
#global variables
version = '1.021'
release_date = '17-Jun-2020'... |
"""
Copyright (c) 2016 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Apache License,
Version 2.0 (the "License").
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
The code, technical concepts, and all information containe... |
#!/usr/bin/env python3
# coding=utf-8
import datetime as dt
import logging
import arrow
import pandas as pd
import requests
from bs4 import BeautifulSoup
TIMEZONE = 'America/Costa_Rica'
DATE_FORMAT = 'DD/MM/YYYY'
MONTH_FORMAT = 'MM/YYYY'
POWER_PLANTS = {
u'Aeroenergía': 'wind',
u'Altamira': 'wind',
u'Ang... |
print("\n\n|...DataRecorder gestartet")
import time
import _thread
# import GUI
from appJar import gui
#imports Kamera
print("|...suche Kamera")
import cv2
from imutils.video import WebcamVideoStream
import imutils
Kamera = WebcamVideoStream(src="/dev/video1").start()
frameCounter=0
import os
# Suche na... |
# Copyright (c) 2018 Intel, 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 ... |
import argparse
import os
import shutil
import time
import numpy as np
import pickle
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.datasets as datas... |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
import AppKit
import unittest
import os
import sys
import glob
import traceback
import warnings
from testSupport import StdOutCollector, randomSeed, testRootDir, tempTestDataDir, testDataDir, readData
drawBotScriptDir ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 18 22:58:58 2019
@author: zhang64
"""
import torch
import numpy as np
import torch.nn.parallel
from KDEpy import FFTKDE
def mirror_1d(d, xmin=None, xmax=None):
"""If necessary apply reflecting boundary conditions."""
if xmin is not None... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that
# the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this list of cond... |
from os import path, listdir
from sys import platform
import click
from EzAudioMeta.utilities.optional_string_matchers import\
OptionalStringMatchers
from EzAudioMeta.audio import base_audio
str_tags = ["album", "albumartist", "comment", "composer", "genre",
"lyrics", "tracktitle", "isrc", "artist"]
... |
import json
import pkg_resources
import re
import string
import sys
import misc
from unicode_decoder import decode_unicode
phone_num_sets = misc.phone_num_lists()
# read ethnicities into memory for parser to use
with open('dataFiles/ethnicity_replacements.json', 'rU') as df:
eth_subs = json.load(df)
# Helper me... |
# # %% md
#
# # Visual Transformer with Linformer
#
# Training
# Visual
# Transformer
# on * Dogs
# vs
# Cats
# Data *
#
# *Dogs
# vs.Cats
# Redux: Kernels
# Edition - https: // www.kaggle.com / c / dogs - vs - cats - redux - kernels - edition
# *Base
# Code - https: // www.kaggle.com / reukki / pytorch - cnn - tutoria... |
# -*- coding: utf-8 -*-
#
# python-json-patch-ext - An implementation of the JSON Patch format
# https://github.com/RangelReale/python-json-patch-ext
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provid... |
import unittest
from collections import OrderedDict
from pypika import (
Array,
Field,
JSON,
QueryException,
Table,
)
from pypika.dialects import PostgreSQLQuery
class InsertTests(unittest.TestCase):
table_abc = Table("abc")
def test_array_keyword(self):
q = PostgreSQLQuery.into(... |
from textwrap import dedent
from typing import Dict, Optional
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender, Substitution
from pandas.core.window.common import WindowGroupByMixin, _doc_template, _shared_docs
from pandas.core.window.rolling import _Rolling_and_Expanding
... |
import sys
assert sys.version_info >= (3, 2)
import sys
import os.path
import logging
import http.server
import html
import modem
from config import now, TIME_FORMAT, WEB_TIME_FORMAT
from schedule import Scheduler
from translator import *
from urllib.parse import urlparse, parse_qs
logging.getLogger(__name__).propa... |
import numpy as np
import pandas as pd
import re, pickle
from collections import Counter
score_tabl = pd.read_csv('/static/words/score_tabl_simplified.csv', index_col='Unnamed: 0', keep_default_na=False) # prevent string 'nan' interpreted as NaN
score_tabl2_3 = pd.read_csv('/static/words/score_tabl2_3.csv', index_col... |
#!/usr/bin/python
# Copyright (c) 2017 Alibaba Group Holding Limited. <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General... |
"""XJPATH simplifies access to the python data structures using relatively
simple path syntax. It doesn't not only lookup value, it also can
validate found data type as well as create value if a target structure is a
dictionary.
The typical scenarios are:
- you need to lookup an element from nested dicts.
- you nee... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import datetime
import hashlib
import logging
import time
import json
from gettext import gettext as _
from social_sqlalchemy.storage import JSONType, SQLAlchemyMixin
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.ext.declar... |
import os
import pandas as pd
from convert_to_excel import *
import matplotlib.pyplot as plt
import matplotlib.patches as mp
# df = pd.read_excel(file, engine='') #, columns=['Time (sec)','Airway Pressure (cmH2O)'])
def plot_waveforms(df, title, subtitle):
fig = plt.figure()
plt.plot(df['Time (sec)'], df['Air... |
from __future__ import division, print_function, unicode_literals
import sys
import cv2
import numpy as np
from scipy.signal import argrelextrema
from matplotlib import pyplot as plt
import model_handler
from localization_cnn.constants import (
HEIGHT,
WIDTH,
TRAINED_MODELS,
MODEL)
HEAT_MAP_THRESH = 125
SLIDE = 8... |
import json
import logging
import os
import re
from collections import OrderedDict
from auth.authorization import ANY_USER
from model import parameter_config
from model.model_helper import is_empty, fill_parameter_values, read_bool_from_config, InvalidValueException, \
read_str_from_config
from model.parameter_con... |
#!/usr/bin/env python
VERSION = "2019.6.29"
# custom version
# The query generated by this script will be less efficient than
# the one by https://hsc-gitlab.mtk.nao.ac.jp/snippets/12
# but this one can deal with a catalog with >1000 records.
import numpy
pyfits = None # imported on demand
import collections
import... |
from builtins import object
import collections
from openpathsampling.tests.test_helpers import (
make_1d_traj, assert_items_equal, CalvinistDynamics)
import pytest
from openpathsampling.shooting import *
from openpathsampling.pathmover import ForwardShootMover, BackwardShootMover
from openpathsampling.ensemble imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 2 19:55:38 2018
@author: saschajecklin
"""
import sys
import os
sys.path.append("..")
#from scores.score_logger import ScoreLogger
from connect4game import Connect4
import random
import numpy as np
from collections import deque
import tensorflow a... |
# -*- coding: utf-8 -*-
#
from __future__ import print_function
import warnings
from dolfin import (
FunctionSpace,
errornorm,
UnitSquareMesh,
Measure,
MeshFunction,
triangle,
Expression,
MPI,
mpi_comm_world,
dot,
TestFunction,
TrialFunction,
grad,
pi,
Funct... |
r"""Tools for Hankel transformations."""
import numpy as np
from mpmath import fp as mpm
from scipy.special import gamma, j0, j1, jn
from scipy.special import jn_zeros as _jn_zeros
from scipy.special import jv, yv
SRPI2 = np.sqrt(np.pi / 2.0)
def psi(t):
"""Compute the variable transform from Ogata 2005."""
... |
# Copyright 2018 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 applica... |
from copy import copy
import clingo
import networkx as nx
from clingo import ast
from typing import List, Dict, Tuple
from vizlo.types import ASTRuleSet, ASTProgram, Program, RuleSet
from vizlo.util import log
def make_signature(function: clingo.ast.Function) -> Tuple[str, int]:
return function.name, len(functi... |
from django.contrib.admin.util import lookup_field, display_for_field, quote, label_for_field
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE, SEARCH_VAR, ORDER_VAR
from django.core.exceptions import ObjectDoesNotExist
from django.utils import simplejson as json
from django.core.urlresolvers import r... |
#!/usr/bin/env python
#
# Copyright 2019 GoPro Inc.
#
# Licensed to the Apache Software Foundation (ASF) 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... |
import torch
import torch.nn.functional as F
#import torchvision
import argparse
import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
class_N = 10
img_height, img_width = 28, 28
channel = 1
GPU = False
device = torch.device("cuda" if GPU else "cpu")
torch.manual_seed(0)
Z_dim = 2
d... |
"""Global optimizers as implemented in Scipy.
Scientific Machine Learning Benchmark:
A benchmark of regression models in chem- and materials informatics.
2019-2020, Citrine Informatics.
"""
from typing import Optional, Sequence, Tuple
from abc import abstractmethod
from scipy.optimize import dual_annealing, differen... |
from numpy import sqrt
from pandas import DataFrame
from sklearn.datasets import make_friedman1
from sklearn.feature_selection import SelectFromModel, RFE
from sklearn.linear_model import LinearRegression, Lasso, Ridge
from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error
from sklearn.model_sele... |
import csv
import time
import numpy as np
import torch
from torch import nn
from common.eval_test import evaluate
def arch_search_valid(model, train_data, test_data, corrupt_func, optimizer, lr_scheduler, clip_value=1., batchsize=16,
lam=2, valid_rate=0.5, gpu_id=0, period=None, out_model='out_... |
import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
from tqdm import tqdm
import scipy.optimize as opt
import math
def optimize_qparams(layer, cached_inps, cached_outs, test_inp, test_out, batch_size=100):
print("\nOptimize quantization params")
w_range_orig = layer.quantize_w... |
import argparse
import csv
import json
import logging
import os
from datetime import datetime
import torch
from data_utils.log_wrapper import create_logger
from data_utils.metrics import compute_acc, compute_cross_entropy
from data_utils.utils import set_environment
from mt_dnn.gobbli_batcher import GobbliBatchGen
fro... |
"""
Description : This file implements the LogSig algorithm for log parsing
Author : LogPAI team
License : MIT
"""
from datetime import datetime
import random
import math
import time
import operator
import re
import os
import pandas as pd
import hashlib
class Para:
def __init__(self, p... |
def kv_wrap_persister_cls(persister_cls, name=None):
"""Make a class that wraps a persister into a py2store.base.Store,
Args:
persister_cls: The persister class to wrap
Returns: A Store wrapping the persister (see py2store.base)
>>> A = kv_wrap_persister_cls(dict)
>>> a = A()
>>> a['o... |
import unittest
from multimethods import (MultiMethod, Default, type_dispatch, DispatchException, Anything,
multimethod, is_a)
from collections import Iterable
identity = lambda x: x
class Basic(unittest.TestCase):
def test_basics(self):
speaksum = MultiMethod('speaksum', lambda ... |
#!/usr/bin/env python3
#
# Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
... |
'''
Copyright 2021 Avnet 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, software
dis... |
import numpy as np
import cv2
import math
import socket
import time
UDP_IP = "127.0.0.1"
UDP_PORT = 5065
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def detectHand(img, kernel_dim = (5,5)):
# Apply Gaussian blur
blur = cv2.GaussianBlur(img, (3,3), 0)
# Change color-space from BGR -> HSV... |
"""SQLite trace backend
Store and retrieve sampling values in SQLite database file.
Database format
---------------
For each variable, a table is created with the following format:
recid (INT), draw (INT), chain (INT), v0 (FLOAT), v1 (FLOAT), v2 (FLOAT) ...
The variable column names are extended to reflect additi... |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import os
import torch
import numpy as np
from torch.utils.data import Dataset
import torchvision
from torchvision import transforms
from PIL import Image
from pycocotools.coco import COCO
import nltk
from .build_vocab import Vocabulary
import pickle
import json
import argparse
from collections import defa... |
import tensorflow as tf
import tensorflow.contrib.layers as layers
import numpy as np
import chess
from chess_env import FULL_CHESS_INPUT_SHAPE
# A convolutional block as described in AlphaGo Zero
def conv_block(tensor, specs):
tensor = layers.convolution2d(tensor,
num_outputs=... |
"""Collection of detection algorithms."""
import math
import pathlib
import dlib
import numpy as np
import matplotlib.pyplot as plt
from skimage.util import img_as_ubyte
from pywarping.base import CACHE_FOLDER
from pywarping.data import get_pretrained_68
LANDMARK_NAMES = {
"UPPER_TEMPLE_L": 0,
... |
from __future__ import unicode_literals
import errno
import importlib
import json
import numbers
import os
import shutil
from builtins import bytes, object, str
from collections import Mapping, OrderedDict, namedtuple
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from tem... |
from __future__ import absolute_import, division, print_function
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from numbers import Number
from typing import List, Union
import numpy as np
import tensorflow as tf
from six import add_metaclass
from tensorflow.python.keras.callbacks import ... |
#!/usr/bin/python
from cbapi.six import iteritems
from cbapi.six.moves.configparser import RawConfigParser
from cbapi.protection import Connector, Notification, PendingAnalysis
from cbapi.example_helpers import get_cb_protection_object, build_cli_parser
import requests
import tempfile
import shutil
import datetime
imp... |
'''
May 2017
Example from: https://wiki.wxpython.org/GLCanvas%20update
@author: <NAME>
'''
# Dragging the mouse rotates the view of the 3D cube or cone.
import wx
import sys
from wx import glcanvas
from OpenGL.GL import *
from OpenGL.GLUT import *
#--------------------------------------------------------------------... |
"""Abstract policy class and some concrete implementations."""
from gym.spaces import Box
import numpy as np
from stable_baselines.common.tf_layers import ortho_init
from stable_baselines.common.tf_util import seq_to_batch
from stable_baselines.common.distributions import DiagGaussianProbabilityDistribution
from stabl... |
#!/usr/bin/python
###
# Copyright (c) 2016 <NAME>.
#
# 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 ... |
# last
import numpy as np
from . import phi
class _etdrk:
def __init__(self, *, G, dt):
self.G = G
self.dt = dt
class etdrk1(_etdrk):
def __init__(self, *, L, G, dt, dps=100):
super().__init__(G=G, dt=dt)
hL = dt*L.reshape(-1)
self.phi = np.array([phi.phin(n, hL, dps=d... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from . import BaseModel, register_model
@register_model('HGNN_AC')
class HGNN_AC(BaseModel):
r"""
Desctiption
-----------
HGNN_AC was introduced in `HGNN_AC <https://dl.acm.org/doi/10.1145/3442381.3449914>`... |
from pyteal import *
def approval_program():
seller_key = Bytes("seller")
nft_id_key = Bytes("nft_id")
start_time_key = Bytes("start")
end_time_key = Bytes("end")
reserve_amount_key = Bytes("reserve_amount")
min_bid_increment_key = Bytes("min_bid_inc")
num_bids_key = Bytes("num_bids")
... |
import unittest
import os
import sys
import pytest
# Note: ant.jar and junit.jar must be in the PYTHONPATH (see jython_test_deps)
IS_JYTHON = False
if sys.platform.find('java') != -1:
IS_JYTHON = True
from _pydev_bundle._pydev_jy_imports_tipper import ismethod
from _pydev_bundle._pydev_jy_imports_tipper i... |
import asyncio
import datetime
import helo
db = helo.G()
class Person(helo.Model):
id = helo.BigAuto()
name = helo.VarChar(length=45, null=False)
class Employee(Person):
department = helo.Smallint()
salary = helo.Float(default=0)
class User(Person):
email = helo.Email(default='')
passwo... |
"""
rAthena ASPD Calculator
"""
from math import sqrt
from re import findall
from os import path, system
from sys import platform
class JobDB:
def __init__(self):
self.jobs = dict()
self.template = [
['JobID', 0],
['Weight', 0],
['HPFactor', 0],
['H... |
import operator
import random
import string
import time
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from itertools import product
import matplotlib.axes
import matplotlib.figure
import matplotlib.pyplot as plt
import numpy as np
from pandas import DataFrame, read_pickle
def is_sorted... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import os.path
import tensorflow as tf
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'labsheets', 'CIFAR10'))
import cifar10 as cf
FLAGS = tf.app.flags.FLAGS
tf.app.fla... |
import torch.optim
import torch.utils.data
import numpy as np
import torch
import torch.optim
import torch.utils.data
import torch.distributions
from utils.audio.pitch.utils import norm_interp_f0, denorm_f0
from utils.commons.dataset_utils import BaseDataset, collate_1d_or_2d
from utils.commons.indexed_datasets import ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 17 10:34:50 2019
@author: GAllison
Location_cleanup updates for version 15:
- Use shapefiles to confirm that reported lat/lon data are in the reported
geographical entities. Flag when they are not.
- bgLat and bgLon will all be converted and stored in WGS8... |
from __future__ import absolute_import, division, print_function
import numbers
import logging
import operator
import numpy as np
from glue.external.six import add_metaclass
from glue.core.contracts import contract, ContractsMeta
from glue.core.subset import InequalitySubsetState
from glue.core.util import join_comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.