text stringlengths 3.07k 12.6k |
|---|
# this is a modified combination of code from
# https://stackoverflow.com/questions/2957116/make-2-functions-run-at-the-same-time
# https://www.instructables.com/Raspberry-Pi-LED-Blink/
# https://wiki.python.org/moin/UdpCommunication
# https://raspberrypi.stackexchange.com/questions/53778/how-to-detect-state-of-gpio-p... |
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
from . import lib, VPNStateChange, GetDataError, GetMultipleDataError, GetPtrString
from ctypes import *
from enum import Enum
from typing import Callable, Optional, Tuple
class StateType(Enum):
Enter = 1
Leave = 2
class EventHandler(object):
def __init__(self):
self.handlers = {}
def on(se... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from PIL import Image
import os
from sklearn.model_selection import train_test_split
import cv2
import sys
import re
import pickle
import time
from os import listdir
from copy import deepcopy
from math import *
sys.path.insert(0, 'DARK... |
"""
# 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
# License, Version 2.0 (the "License"); you may not... |
from bucket_elimination import BucketElimination
from bucket import Bucket
def constraint_partitioning(bucket_elimination, variable_order, soft_constraints, hard_constraints):
"""
Generate the bucket with the corresponding constraints in the correct order (inverse of the given), and add all the buckets to... |
import gzip
import os
import struct
import h5py
import numpy
from fuel.converters.base import fill_hdf5_file, check_exists
MNIST_IMAGE_MAGIC = 2051
MNIST_LABEL_MAGIC = 2049
TRAIN_IMAGES = 'train-images-idx3-ubyte.gz'
TRAIN_LABELS = 'train-labels-idx1-ubyte.gz'
TEST_IMAGES = 't10k-images-idx3-ubyte.gz'
TEST_LABELS =... |
from scene import *
from random import randint, choice
from math import cos, sin
screen_size = Size(768, 1024)
score = 0
def update_score(n=1):
global score
if n == 'reset':
score = 0
else:
score += n
class Field(object):
def __init__(self):
size = screen_size
self.lines = [(0, 0, 0, size.h), (size.w, 0... |
import pytest
import os
import pdb
import subprocess
import re
from igsr_archive.config import CONFIG
@pytest.fixture(scope="function")
def modify_settings(request):
"""
Fixture to modify the settings.ini
and generate a modified version that will be used
in this file
"""
abs_dir = os.path.abs... |
# coding=utf-8
import logging
import os
from babelfish import Language
from subliminal.exceptions import ConfigurationError
from subliminal.providers.opensubtitles import OpenSubtitlesProvider, checked, get_version, __version__, \
OpenSubtitlesSubtitle, Episode, ServerProxy
from mixins import ProviderRetryMixin
f... |
import sys
import win32gui
import socket
import time
from qt_material import apply_stylesheet
from PySide6.QtCore import Slot, QObject, Signal, QEvent
from PySide6.QtWidgets import QMainWindow, QApplication, QListWidgetItem, QDialog, QWidget
from PySide6.QtNetwork import QTcpSocket
from PySide6.QtGui import Qt, QKeyEv... |
# !/usr/bin/python3
__author__ = "<NAME>"
# Try to import any new configuration parameters into user config if missing there
import re
try:
with open("config.py", "r") as config_file:
custConfig = config_file.readlines()
config_dist_file = open("config_dist.py", "r")
missingConfig = []
for con... |
from common.numpy_fast import interp
#from common.kalman.simple_kalman import KF1D
#from opendbc.can.can_define import CANDefine
from selfdrive.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, SPEED_FACTOR, HONDA_BOSCH
from self... |
import re
import string
import nltk
import os
from urllib.parse import urljoin, urlparse
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup
from nltk.stem import PorterStemmer
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter i... |
import logging
import random
from fastapi import APIRouter, HTTPException
import pandas as pd
from pydantic import BaseModel, Field, validator
import psycopg2
import os
from dotenv import load_dotenv
import pandas as pd
import datetime
from sodapy import Socrata
from datetime import timedelta
import warnings
from j... |
import sys
import os
import numpy as np
import h5py
import scipy.signal
import itertools
import pdb
sys.path.append('/packages/msutil')
import util_stimuli
from dataset_util import initialize_hdf5_file, write_example_to_hdf5
def complex_tone_in_TENoise(f0,
fs,
... |
import os
import json
import torch
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
# from nlp import load_dataset
from tqdm import tqdm
import numpy as np
import string
def load_data():
puncs = list(set(list(string.punctuation)) - set([',', '.', '-', '?', '!', '\'']))
puncs = [punc + ' ' for punc... |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from pyro.distributions import (Delta, NegativeBinomial, Normal, Poisson, ZeroInflatedDistribution,
ZeroInflatedNegativeBinomial, ZeroInflatedPoisson)
from pyro.distributi... |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import re
import matplotlib.pyplot as plt
import numpy as np
import subprocess
import sys
__author__ = "<NAME>" #: @2018
def main():
title_it = "Performance Profile on CUTEr set (iterations)"
title_cpu = "Perform... |
#!/usr/bin/env python3
import argparse
import os
import sys
import datetime
import dateutil
import dateutil.parser
import json
import ffmpeg
import cv2
import colorparse
import rgbadraw
import argutil
args = None
def parse_timedelta(time_str):
h, m, s = map(float, time_str.split(":"))
return datetime.timede... |
import os
import json
import unittest
import tempfile
from airflow import DAG
from xylose.scielodocument import Issue
from sync_isis_to_kernel import (
mount_journals_issues_link,
issue_data_to_link,
create_journal_issn_index
)
from .test_kernel_changes import load_json_fixture
FIXTURES_PATH = os.path.jo... |
import numpy as np
from matplotlib import pyplot as plt
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2D
from keras.m... |
import numpy as np
import torch
from typing import Tuple, List, Dict
from src.utils import load_obj_from_file
from src.utils.data import OmniDataset
from src.utils.data import data_utils
from src.utils.data import iterators
def classify_pad_bath(
ids: List[List[int]],
sizes: List[int],
pad: i... |
# -*- coding: utf-8 -*-
# @File : postmoduleauto.py
# @Date : 2021/4/30
# @Desc :
import importlib
import json
import uuid
import requests
from Lib.api import data_return, is_json
from Lib.configs import CODE_MSG_ZH, CODE_MSG_EN, ProxyHttpScan_MSG_ZH, \
ProxyHttpScan_MSG_EN
from Lib.log import logger
from Lib.... |
import itertools
import math
import random
import discord
import requests
from discord.ext import commands
from ansura import AnsuraBot, AnsuraContext
class Fun(commands.Cog):
def __init__(self, bot: AnsuraBot):
self.bot = bot
@commands.command()
async def ship(self, ctx: AnsuraContext, user1: ... |
# -*- coding: utf-8 -*-
import os
from flask import Flask, request, render_template, send_from_directory
from .settings import SITE_NAME, DefaultConfig
# from .extensions import toolbar
# from .extensions import babel, cache, db, mail
# from .extensions import login_manager
from .frontend.docs import docs
from .api.er... |
"""Generators allow you to declare a function that behaves like an iterator - a lazy iterator."""
import random
# generators are for creating large lists that don't require large amount of memory like a list see PEP255
print("\nusing a generator function and yield...") # generators behave like iterators but are im... |
#
# TP-Link Wi-Fi Smart Plug Protocol Client
# For use with TP-Link HS-100 or HS-110
#
# by <NAME>
# Copyright 2016 softScheck GmbH
#
# 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
#
# ht... |
# @Time : 2019/3/14 10:07
# @Author : sonny.zhang
# @FileName : views.py
# @github : @sonny-zhang
from flask.views import MethodView
from flask import render_template, redirect, request, url_for, flash
from flask_login import login_user, login_required, logout_user, current_user
from app import db
from . import... |
import csv
import io
import json
from sqlalchemy import Column, Integer, String, MetaData, inspect
from sqlalchemy.ext.declarative import declarative_base
from api.core import create_response, serialize_list, logger
from api.models import db, Event, Sheet
from api.functions.call_google_sheets import read_google_sheet... |
import logging
from copy import copy, deepcopy
from typing import Dict, Iterable, Mapping, Optional, Tuple
import torch
import torch.nn as nn
from typing_extensions import Protocol
from qsparse.util import nn_module
class BNFuser(Protocol):
"""Type signature of the handers used in fuse_bn."""
def __call__(... |
import tensorflow as tf
import numpy as np
import time, os
def pick_top_n(preds, num_classes, top_n=5):
p = np.squeeze(preds)
c = np.random.choice(num_classes, 1, p=p)[0]
return c
class charRNN:
def __init__(self, num_classes, batch_size=64, seq_len=50, train=True):
self.num_classes ... |
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
# -*- coding: utf-8 -*-
import glob
import logging
import os
from os.path import basename
from os.path import dirname
from os.path import isfile
from subprocess import PIPE
from subprocess import Popen
from threading import RLock
import typing
import magic
from preview_generator.exception import BuilderDependencyNot... |
import unittest
import torch
from predtuner.model_zoo import CIFAR, VGG16Cifar10
from predtuner import TorchApp, accuracy, config_pylogger, get_knobs_from_file
from torch.nn import Conv2d, Linear
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.dataset import Subset
msg_logger = config_pylogge... |
#Inspired by https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3%20-%20Neural%20Networks/recurrent_network.py
import tensorflow as tf
from tensorflow.contrib import rnn
import numpy as np
import os
from random import shuffle
# configuration
# O * W + b -> 10 labels for each image, O[? 28]... |
from tkinter import *
from tkinter import ttk
# color #
cor1 = "#123c80"
cor2 = "#edf0f2"
cor3 = "#4f0087"
cor4 = "#0af5d5"
cor5 = "#00e03c"
window = Tk()
window.title("Calculadora")
window.geometry("235x310")
window.config(bg=cor1)
## frame ##
frame_screen = Frame(window, width=235, height=50, bg=... |
import pandas as pd
import numpy as np
import anndata as ad
import scanpy as sc
sc.settings.autoshow = False
import scanpy.external as sce
import palantir
from helper_functions import *
from status.status_functions import *
def downsample_adata(session_ID, adata, pct_cells=100,
pct_counts=100):
... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
# Copyright 2021 Phonetics and Speech Laboratory, Trinity College, Dublin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
#
# (C) 2014-2017 <NAME>
# Licensed under the MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from math import cos, acos, sin, hypot, pi
from itertools import cycle
from chorus.util import iterator
def vector(p1, p2):
""" p1 to p2 vector
Args:
p1, p2: point (x, y)
"""
return p2[0] - p... |
# -*- coding: utf-8 -*-
# moldynplot.__init__.py
#
# Copyright (C) 2015-2017 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license. See the LICENSE file for details.
"""
General functions.
"""
################################### MODULES ##########... |
# -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket 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 la... |
import re
import io
from ..configuration import *
from ..preprocess_data import load_csv_wikipedia_gen, load_csv_dataset, group_count
def load_word2vec_data(filename, vocabulary_size=VOCABULARY_SIZE):
"""
Loads the word2vec data: the dictionary file with the relation of the word with its int id,
the datas... |
#!/usr/bin/env python3
#
# Copyright (c) 2020 Wikimedia Foundation and contributors
#
# 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
#
# Unl... |
import arff
import argparse
import fanova.fanova
import fanova.visualizer
import itertools
import json
import numpy as np
import logging
import openmlcontrib
import openmlpimp
import os
import pandas as pd
import sklearnbot
# to plot: <openml_pimp_root>/examples/plot/plot_fanova_aggregates.py
def read_cmd():
pars... |
from __future__ import absolute_import, division, print_function
import pickle
import yaml
from concept import ConceptEnum
class Ontology:
"""
Ontology
params:
leaf_to_root: Dict[leaf, root], where the root of tree -> None
Example:
leaf2root = {
'object': None, # the roo... |
import boto3
import botocore
import datetime
import os
target_account_id = os.environ['TARGET_ACCOUNT_ID']
target_account_iam_role_arn = os.environ['TARGET_ACCOUNT_IAM_ROLE']
source_account_iam_role_arn = os.environ['SOURCE_ACCOUNT_IAM_ROLE']
target_region = os.environ['TARGET_REGION']
target_account_kms_key_arn = os.... |
# I think newspapers are clustering different issues of the same newspaper due
# to in-text references to nearby locations, and possibly to the title of the
# newspaper itself. Investigating word vectors within a test neural net shows
# that in fact it has learned similarities between locations, e.g.
#
# model.wv.most_... |
import pytest
from mygrid import Grid
def foo_gen(nbre_item):
for i in range(nbre_item):
yield i*10
@pytest.fixture
def grid():
# 0 1 2 3
# 4 5 6 7
# 8 9 10 11
w, h = 4, 3
grid = Grid(w, h)
for j, line in enumerate(grid):
for i, elt in... |
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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... |
# Software: eFiction
import re
import urllib2
import urlparse
from bs4.element import Tag
from ..htmlcleanup import stripHTML
from base_adapter import BaseSiteAdapter, makeDate
from .. import exceptions
def getClass():
return SpikeluverComAdapter
# yields Tag _and_ NavigableString siblings from the given tag.... |
# 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... |
# -*- coding: utf-8 -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2018 The Electrum developers
#
# 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,
# includi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime, time
#import subprocess
from hermes_python.hermes import Hermes
#from hermes_python.ontology.dialogue.intent import IntentMessage, IntentClassifierResult
#from hermes_python.ontology.dialogue.slot import SlotMap
CREATOR = "maremoto:"
INTENT_HELP_ME = ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
import functools
from time import time
from parameterized import parameterized
import torch
from torch.optim import SGD, Adadelta, Adam # typ... |
import os
import warnings
warnings.simplefilter("ignore")
import numpy as np
import pandas as pd
STORAGE_DIR = os.path.dirname(os.path.realpath(__file__))
DATA_FIELDS = ['country code', 'postal_code', 'place_name',
'state_name', 'state_code', 'county_name', 'county_code',
'community_nam... |
"""
help.py - HelpBot Module
Copyright 2013, Dimitri "Tyrope" Molenaars, TyRope.nl
Licensed under the Eiffel Forum License 2.
http://willie.dftba.net/
"""
from __future__ import print_function
from willie.module import rule, event, commands
from collections import deque
helpees = deque()
def configure(config):
"... |
import pygame
from math import *
import numpy as np
import itertools
from shapes import *
WIDTH = 500
HEIGHT = 500
screen = pygame.display.set_mode((WIDTH, HEIGHT))
FOV = 60
clock = pygame.time.Clock()
class Camera4D:
def __init__(self, *pos):
self.pos = np.array(pos)
def get_3d_projection(self,... |
# static analysis: ignore
from .implementation import assert_is_value
from .value import AnySource, AnyValue, KnownValue, MultiValuedValue, TypedValue
from .test_name_check_visitor import TestNameCheckVisitorBase
from .test_node_visitor import assert_passes
from .error_code import ErrorCode
class TestBinOps(TestNameC... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Earthcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet balance RPC methods."""
from decimal import Decimal
from test_framework.test_framework im... |
import tensorflow as tf
import numpy as np
MNIST_DATA_SIZE = 28
DEFAULT_MODEL_DIR = "cnn_models"
LEARNING_RATE = 0.001
NUM_CONV_LAYERS = 2
NUM_FEATURES_PER_CONV_LAYER = 32
# Convolusional neural network model to use
def cnn_model_fn(features, labels, mode):
# Uniform size
current_layer_size = MNIST_DATA_SIZE
... |
from datetime import datetime
from typing import List
import dateparser
import pytz
from pluralkit.bot.commands import *
from pluralkit.member import Member
from pluralkit.utils import display_relative
async def switch_root(ctx: CommandContext):
if not ctx.has_next():
raise CommandError("You must use a ... |
# Author: <NAME>
import json, os
from lark import Lark, Transformer, v_args, exceptions
from kernel.type import TFun, NatType
from kernel.term import Term, Var, Not, And, Or, Implies, Eq, Lambda, true, Nat
from kernel.report import ProofReport
from kernel import theory
from logic import basic
from logic import logic
... |
#!/usr/bin/env python3
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import argparse
import json
import os
import subprocess
from pathlib import Path
from common import banner, die
# NB: We expect the `aws` CLI to already be install... |
#!/usr/bin/env python
import os
import sys
import random
from datetime import date
import django
# 将项目文件夹的绝对路径插入到 sys.path
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE_DIR)
# 设置 DJANGO_SETTINGS_MODULE 环境变量
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'aboutTa.sett... |
from os import makedirs
from os.path import join, basename, splitext, expanduser, abspath, isdir
from glob import glob
from shutil import copyfile
import json
PROJECTS_MAIN_DIR = join(".", "projects")
FULL_AUDIO_BASENAME = 'full-audio.wav'
FULL_VIDEO_BASENAME = 'full-video.mp4'
FULL_TRANSCRIPT_BASENAME = 'full-transc... |
import re
import zipfile
import shutil
import functools
from pathlib import Path
from subprocess import run
import tempfile
from datetime import timedelta
import osxphotos
import click
from slugify import slugify
from foto import config
from foto.utils import creation_datetime, is_corrupted_file
from foto.logger impo... |
from __future__ import print_function
import numpy as np
import tensorflow as tf
import argparse
import time
import os
from six.moves import cPickle
from utils import TextLoader
from model import Model
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type=str, default='data/le... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2017, SLAC National Laboratory / Kisensum Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
... |
import numpy as np
import os
from tqdm import tqdm
import argparse
from sklearn.metrics import confusion_matrix
import yaml
# torch imports
import torch
import torch.utils.data
import lightconvpoint.utils.data_utils as data_utils
import lightconvpoint.utils.metrics as metrics
from npm3d_dataset import DatasetTest as ... |
#!/usr/bin/python3
# Created by <NAME>, April 4th, 2020
# Use this as an example for a basic game.
import pyxel, random
import os.path
from os import path
# Width and height of game, in tiles
WIDTH = 12
HEIGHT = 8
# Entities (should not) be able to walk through structures,
# unless they have "allow" set to True
s... |
"""
Calculate error due to measured activities.
"""
import logging
import numpy as np
import tinydb
from pycalphad import equilibrium, variables as v
from pycalphad.plot.eqplot import _map_coord_to_variable
from scipy.stats import norm
from espei.core_utils import ravel_conditions
def target_chempots_from_activit... |
"""
Copyright (c) 2020 by RiptideIO
All rights reserved.
"""
import json
import click
import shutil
import logging
from prompt_toolkit.shortcuts import clear
from prompt_toolkit.shortcuts.progress_bar import formatters
from prompt_toolkit.styles import Style
from prompt_toolkit import PromptSession, print_formatted_t... |
from collections import defaultdict, deque
from typing import List, Optional, Tuple
class IntcodeComputer:
def __init__(self, data: List[int]) -> None:
self.registers = defaultdict(int)
for i, value in enumerate(data):
self.registers[i] = value
self.current = 0
self.ha... |
'''
Created on Mar 5, 2019
@author: <NAME>
'''
import tkinter as tk
from tkinter import ttk, Menu, scrolledtext, PhotoImage
import sys
from urllib.request import urlopen
from os.path import splitext
from time import sleep # careful - this can freeze the GUI
gui = tk.Tk() ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from collections import deque, OrderedDict
def unflatten(vector, shapes):
i = 0
arrays = []
for shape in shapes:
size = np.prod(shape, dtype=np.int)
array = vecto... |
from keras.models import load_model
from grabscreen import grab_screen
import numpy as np
import keyboard,cv2,time
from tkinter import *
model_1=load_model('AI.h5')
model_2=load_model("AI2.h5")
left_right_model=load_model("LEFT_RIGHT.h5")
forward_reverse_model=load_model("FORWARD_REVERSE.h5")
condition=True
k... |
from typing import Union, List, Tuple, Sequence, Iterable, Callable
from pathlib import Path
import random
import math
from functools import partial
import numpy as np
from PIL import Image
from natsort import humansorted
P = Union[str, Path]
ImageGetter = Tuple[any, Callable[[], Image.Image]]
class Interpolation:
... |
from __future__ import division
from collections import defaultdict
import itertools
import numpy as np
from torchvision.ops import box_iou
def eval_detection_voc(pred_bboxes, pred_labels, pred_scores, gt_bboxes, gt_labels,
gt_difficulties=None, iou_thresh=0.5, use_07_metric=False):
"""Ca... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : tSNE.py
@Time : 2019/10/04 15:00:03
@Author : gajanlee
@Version : 1.0
@Contact : <EMAIL>
@Desc : t-SNE implementation
'''
import numpy as np
from tqdm import tqdm
np.random.seed(1)
sign = np.sign
def pca(X = np.array([]), no_dims = 5... |
#!/usr/bin/python
# Copyright (C) 2013 Google Inc. 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 c... |
import copy
import torch
from transformers import AutoModelWithHeads, AutoTokenizer, TrainingArguments
from transformers.adapters.composition import BatchSplit, Fuse
from transformers.adapters.trainer import AdapterTrainer as Trainer
from transformers.testing_utils import require_torch
def filter_parameters(model, ... |
#!/usr/bin/env python3
# Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
# Copyright 2017 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 t... |
"""
Talos regular event loops. Done as a cog so as to keep clutter out of the main file.
Author: CraftSpider
"""
import os
import pathlib
import httplib2
import logging
import random
import spidertools.common as utils
import spidertools.command_lang as command_lang
import spidertools.discord as dutils
import ... |
# -*- coding: utf-8 -*-
import requests
import csv
import sys
from bs4 import BeautifulSoup
from functools import total_ordering
from datetime import datetime as d
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
from logging import getLogger, config
import os
import yaml
@total_o... |
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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... |
#!/usr/bin/env python
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, based on code from <NAME>
# --------------------------------------------------------
"""
Demo script showing detections in sample i... |
# GUI (Screens)
from Screens.Screen import Screen
# GUI (Components)
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
# Tools
from Tools.LoadPixmap import LoadPixmap
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
cl... |
import pymongo
import pandas as pd
from sklearn import preprocessing
# 一些列名,按照列名对不同变量进行不同的初始化处理。
header_id = [
"store_id", "user_id", "item_id"
]
header_cate = [
"item_brand", "item_name", "user_gender", "store_city"
]
header_cont=[
"item_price", "item_salecount", "item_score", "store_level", "item_times... |
import Tkinter as tk
import ttk
import PIL
from PIL import Image
from PIL import ImageTk
from vlc import Instance
import time
import os
import sys
#import pathlib
import webbrowser
class VLC:# Crea instancia de VLC
def __init__(self):
self.Player = Instance('--loop')#lo genera en modo bucle
def addP... |
#
# Copyright (c) 2021 Seagate Technology LLC and/or its Affiliates
#
# 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 ap... |
"""
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import logging
import os
import re
from ctypes import CD... |
import os
from datetime import datetime
from typing import Union, List, Tuple
from latent_with_splitseqs.base.my_object_base import MyObjectBase
import numpy as np
import torch
from prodict import Prodict
from torch.utils.tensorboard import SummaryWriter
import shutil
from self_supervised.base.writer.plt_creator_base ... |
import inspect
import io
import os
import platform
import numpy
import cupy
try:
import cupy.cuda.thrust as thrust
except ImportError:
thrust = None
try:
import cupy_backends.cuda.libs.cudnn as cudnn
except ImportError:
cudnn = None
try:
import cupy.cuda.nccl as nccl
except ImportError:
ncc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import random
import logging
import time
import threading
import os
from ssshare import app
from ssshare.ascii import birthday_2017, ss_title
from ssshare.ss import crawler
from ssshare import donation
from flask import render_template, send_from_directory, ab... |
from logger import Logger
from protocol import Header,HeaderParser,Protocol
from quiz import Quiz, Question
import requests, json, socket, hashlib, os
class URL(object):
local = 'http://127.0.0.1:5000/api/'
remote = 'http://molly.ovh:5000/api/'
class User(object):
def __init__(self, conn, addr):
... |
import asyncio
import http.cookies
import json
import typing
from collections.abc import Mapping
from starlette.datastructures import URL, Address, FormData, Headers, QueryParams
from starlette.formparsers import FormParser, MultiPartParser
from starlette.types import Message, Receive, Scope
try:
from multipart.m... |
import os, sys
import numpy as np
from scipy.fftpack import fft, ifft
from numpy import hamming
from torch.utils.data import DataLoader, random_split
import torch as t
import torch_optimizer as t_opt
import matplotlib.pyplot as plt
# モデルのネットワーク構造をtxt形式で出力
def export_network(model, out_dir) -> None:
with open(f'{o... |
"""Outfit and outfit member class definitions."""
import logging
from typing import ClassVar, Final, List, Optional, TYPE_CHECKING, Type, Union
from ..base import Cached, Named, NamedT
from .._cache import TLRUCache
from ..census import Query
from ..errors import NotFoundError
from ..models import OutfitData, OutfitM... |
#!/usr/bin/env python
# Copyright (c) 2015 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.
import codecs
import copy
import json
import os
import sys
import unittest
#import test_env # pylint: disable=W0403,W0611
sys.pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.