text stringlengths 3.07k 12.6k |
|---|
import PIL.Image as Image, requests, urllib
import argparse, json, PIL.Image, reports, os
from requests.exceptions import ConnectionError, ReadTimeout, TooManyRedirects, MissingSchema, InvalidURL
import numpy as np
from pycocotools.coco import COCO
parser = argparse.ArgumentParser(description ='HW04 Coco Downloa... |
__all__ = (
'Tetromino',
'draw_block',
)
from __future__ import generators
from random import shuffle
from pyboom.colors import BLACK, WHITE
from pyboom.types import SingletonType
from pyboom.utils import enumerate, any, all, debug
from bloom.config import BLOCK_SIZE, BLOCKS_Y, BLOCKS_X, OFF_Y, OFF_X
from blo... |
from waflib import Task, Errors
from waflib.TaskGen import feature, extension, before_method
import os
import sys
try:
import cPickle as pickle
except ImportError:
import pickle
template_kernel = """
_BE_PLUGIN_EXPORT void _%(kernelname)s%(static_variant)s(const u32 index, const u32 total,
const minitl... |
# An implementation of the SecureNN protocols from Wagh et al.
from syft.spdz.spdz import Q_BITS, field
import syft
import torch
L = field
p = field
def decompose(tensor):
"""decompose a tensor into its binary representation."""
powers = torch.arange(Q_BITS)
if hasattr(tensor.child, "pointer_tensor_dict... |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Weather report from OpenWeatherMap async plugin """
import copy
import asyncio
import http.client
import json
import logging
from threading import Thread
from aiohttp import web
from foglamp.common import logger
from fog... |
# coding: utf-8
from mlhiphy.calculus import dx, dy, dz
from mlhiphy.calculus import Constant
from mlhiphy.calculus import Unknown
from mlhiphy.calculus import _partial_derivatives
from mlhiphy.calculus import find_partial_derivatives
from mlhiphy.calculus import sort_partial_derivatives
from sympy import preorder_tr... |
from flask import (Flask, render_template, session,
request, flash, redirect, url_for, abort)
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
from slugify import slugify
# Configurations
SECRET_KEY = 'sample key'
USERNAME = 'user'
PASSWORD = '<PASSWORD>'
DEBUG = True
SQLALCHE... |
# Message Sender
import os
from socket import *
import socketserver
# import terminalv2 as tml
import logging
import json
from threading import local
from art import *
from tqdm import tqdm, trange
from time import sleep
from colorama import Fore, Back, Style,init
from termcolor import colored
import os
# import clien... |
# Copyright 2019 The Pigweed 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 in ... |
import click
import os
import shutil
from typing import Tuple, List
from pathlib import Path
from chia.types.blockchain_format.program import Program
from clvm_tools.clvmc import compile_clvm
from clvm_tools.binutils import disassemble, assemble
from cdv.cmds.util import parse_program, append_include
@click.group... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# python/wrong_weights.py Author "<NAME> <<EMAIL>>" Date 04.03.2019
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
tf.enable_eager_execution()
from scipy.optimize import m... |
# This file is part of the DMComm project by BladeSabre. License: MIT.
import array
import pulseio
from dmcomm import CommandError, ReceiveError
from . import WAIT_REPLY
from . import misc
class ModulatedCommunicator:
def __init__(self, ir_output, ir_input_modulated):
self._pin_output = ir_output.pin_output
sel... |
import numpy
import random
#GENETIC ALGORITHM OPERATORS
#Mating function
def mating_pool(pop_inputs, objective, num_parents):
objective = numpy.asarray(objective)
parents = [[None,None,None, None, None, None, None, None, None]]* num_parents
for parent_num in range(num_parents):
bes... |
import hypothesis.strategies as st
import numpy as np
import rasterio
from hypothesis import given, settings
from hypothesis.extra.numpy import arrays
from rasterio.transform import from_origin
from satsense.bands import BANDS
from satsense.generators import FullGenerator
from satsense.image import Image
from .strate... |
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Set
from ..cfg_parser.coercing_reads import read_bool, read_float, read_int, read_str
from ..cfg_parser.typedefs import CfgKey, ParsedCfgFile
@dataclass
class KerbalToken:
type_name: str
content: Dict[str, Any] # field values
... |
import random
import os
import geojson
import quest
from past.builtins import basestring # for python 2 compatibility
from shapely.geometry.base import BaseGeometry
from tethys_gizmos.gizmo_options import TableView
from .app import Quest as app
ISO_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
# global variable to ... |
""" Main function, which trains our model and makes predictions with it. """
import argparse as ap
import logging
from sklearn.metrics import classification_report
from data import load
from models import FeedForward, BiLSTM, LogisticRegression, MajorityVote, SVM, Bert
from utils import train_pytorch, test_pytorch, get... |
# pyOCD debugger
# Copyright (c) 2006-2013 Arm Limited
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0... |
#!/usr/bin/python
'''
(C) Copyright 2019 Intel Corporation.
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 ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is a part of EM Media Handler Testing Module
# Copyright (c) 2014-2021 <NAME>
#
# 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... |
#!/usr/bin/env python
"""
Test flight condition functionality.
Author: <NAME>
Email: <EMAIL>
:copyright: 2021 <NAME>
:license: MIT License, see LICENSE for more details.
"""
# flake8: noqa E203
import pytest
import re
from shlex import split
from subprocess import run
from numpy import array
from flightcondition... |
import asyncio
import json
import random
import subprocess
import discord
import discord.ext
import requests
from discord.ext import commands
import os
from botlibrary.utils import get_variable
from botlibrary import constants
# Wichs Codierung
# ä=ü
# ö=ö
# assign constant variables
constants.assignVariables()
V... |
import random
import secrets
from collections import deque
from typing import Deque, Dict, Optional
from config.constants import (CALLBACK_ACTIVE_NO, CALLBACK_ACTIVE_YES,
CALLBACK_CAMPUS_KAZAN, CALLBACK_CAMPUS_MOSCOW,
USER_DATA_V1_AUTHORIZED,
... |
import re
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import importlib
import torch
import torch.autograd
from torch.utils.data import dataset
import torch.utils.data.dataloader
import ignite.utils
import ignite.handlers.early_stopping
import ignite.engine
import ... |
import os
import subprocess
import sys
import torch
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CUDA_HOME
# ninja build does not work unless include_dirs are abs path
this_dir = os.path.dirname(os.path.abspath(__file__))
def get_cuda_bare_metal_ve... |
'''
A module to wrap pacman calls, since Arch is the best
(https://wiki.archlinux.org/index.php/Arch_is_the_best)
'''
# Import python libs
import logging
log = logging.getLogger(__name__)
def __virtual__():
'''
Set the virtual pkg module if the os is Arch
'''
return 'pkg' if __grains__['os'] == 'Arc... |
"""Copyright 2019 <NAME> and The Netherlands Organisation for
Applied Scientific Research TNO.
Licensed under the MIT license.
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,... |
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import torch
import torch.nn as nn
from gym.wrappers import TimeLimit
import d4rl
import d4rl_atari
from salina import Agent, ... |
import numpy as np
import numba
from summer.compute import ComputedValueProcessor, find_sum
from autumn.models.covid_19.constants import (
Compartment, INFECTIOUS_COMPARTMENTS, Clinical, CLINICAL_STRATA, NOTIFICATION_CLINICAL_STRATA
)
def get_tracing_param(assumed_trace_prop: float, assumed_prev: float, floor: ... |
from django.core.files.storage import default_storage
import os
from django.core.files.base import ContentFile
import traceback
from feewaiver.main_models import TemporaryDocument, EmailUser
from django.conf import settings
from feewaiver.models import FeeWaiverUserAction
from django.contrib import auth
def process_... |
import numpy as np
import matplotlib.pyplot as plt
def moving_average(a, n=3) :
ret = np.cumsum(a, dtype=float)
ret[n:] = ret[n:] - ret[:-n]
return ret[n - 1:] / n
def moving_rms(a, n=3) :
i = 0
j = n
rms = []
while j <= len(a):
a_i = a[i:j]
rms.append(np.std(a_i))
... |
import pygame, sys
from pygame.locals import *
import random as rnd
import matplotlib as plt
from configuration import CharacterDefaults, Settings, CharacterRole, GameSettings, Colors
from Character import Character, Predator, Prey
FRAME_WIDTH = Settings.FRAME_WIDTH.value
FRAME_HEIGHT = Settings.FRAME_HEIGHT.value
F... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# get_ipython().system('pip install skorch')
# In[2]:
import os
import numpy as np
import pandas as pd
from torch import nn
import torch.nn.functional as F
import torch
from skorch import NeuralNetClassifier
from torch.utils.data import Dataset, DataLoader
from PIL ... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
import os
import logging
try:
from PyQt5 import QtCore
from PyQt5.QtWidgets import *
except:
from PyQt4 import QtCore
from PyQt4.QtGui import *
import vqt.cli as vq_cli
import vqt.main as vq_main
import vqt.saveable as vq_save
import vqt.hotkeys as vq_hotkeys
import vqt.menubuilder as vq_menu
from vqt... |
from django.contrib import admin
from django.contrib.admin.filters import SimpleListFilter
from django.db.models import Count
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from member.models import Profile
from shop import models
fr... |
import numpy as np
import cv2
# import sys
from . import kcftracker
# import multiprocessing as mp
class KCF(object):
def __init__(self, q=None):
self.q = q
self.selectingObject = False
self.initTracking = False
self.onTracking = False
self.ix, self.iy, self.... |
import sys
from collections import deque
from time import time
from shutil import get_terminal_size
from ..compat import is_win32
PROGRESS_FORMATS = (
"[download][{prefix}] Written {written} ({elapsed} @ {speed}/s)",
"[download] Written {written} ({elapsed} @ {speed}/s)",
"[download] {written} ({elapsed}... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, ESS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
from frappe import _
class LabTestTemplate(Document... |
import time
start_all=time.time()
from math import sqrt
from pandas import read_csv
from pandas import concat
from pandas import DataFrame
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
import numpy as np
from numpy ... |
import pandas as pd
from utilities import (extract_image_from_pdf, extract_xml_from_digital_pdf,
create_directory, read_directory_files, get_subdirectories,
get_string_xmltree, get_xmltree, get_specific_tags, get_page_texts_ordered,
get_page_text_e... |
from builtins import object, str
from past.builtins import cmp
import os
import re
import xml.etree.ElementTree as ET
from xml.dom import minidom #beautify
tr_re = re.compile(r'\W(qsTr|qsTranslate|tr|QT_TR_NOOP|QT_TRANSLATE_NOOP)\s*\(\s*(.*?)\s*\)')
q1_re = re.compile(r'"(.*(?<!\\))"')
q2_re = re.compile(r'\'(.*(?<!\... |
import json
import yaml
import os
from container_transform.compose import ComposeTransformer
from container_transform.ecs import ECSTransformer
def generateConfig(envName='dev', path='.', logger=None, secretEnv=None, keyEnv=None, mode='aws'):
if mode == 'aws':
return generateConfigAWS(
envName=... |
import random
import math
class NNTNode:
def __init__(self, point):
self.point = point
self.index = -1
self.right = None
self.left = None
self.is_terminal = False
self.parent = None
class NNT:
def __init__(self, min, max, dimensions, alpha = 0.01, size = 8):
self.terminals = []
self.ro... |
from functools import partial
from malaya.function import check_file, load_graph, generate_session
from malaya.text.bpe import (
sentencepiece_tokenizer_bert,
sentencepiece_tokenizer_xlnet,
)
from malaya.path import PATH_TOXIC, S3_PATH_TOXIC
from malaya.model.ml import MULTILABEL_BAYES
from malaya.model.bert im... |
from django.db import migrations
def forwards_func(apps, schema_editor):
Country = apps.get_model("django_base_shop", "Country")
db_alias = schema_editor.connection.alias
Country.objects.using(db_alias).bulk_create(
[
Country(name="Afghanistan"),
Country(name="Albania"),
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.embedding import Embedding
class DeRF(nn.Module):
def __init__(self,
D=6, W=128,
freqs_xyz=10,
deformation_dim=0,
out_channels=3,
skips=[4]):
... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 <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 law or a... |
# MIT License
# Copyright (c) 2020 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... |
# ===============================================================================
# Copyright 2018 dgketchum
#
# 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... |
import os
import textattack
from textattack.commands.attack.attack_args import ATTACK_RECIPE_NAMES
from textattack.commands.attack.attack_args_helpers import ARGS_SPLIT_TOKEN
from textattack.commands.augment import AUGMENTATION_RECIPE_NAMES
logger = textattack.shared.logger
def prepare_dataset_for_training(nlp_data... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from data.mnist_dataset import MnistDataset
from data.data_affine import RandomAffineTransform
from models.mnist_pixelcnn import *
from models.components.shared import *
from train_utils import *
def quantisize(image... |
import socket
import select
import multiprocessing
import subprocess
from utils import *
from scapy.layers.dns import *
from scapy.fields import *
A = 1
AAAA = 28
addr_dict = {
'www.google.com.': {'A': '127.0.0.1', 'AAAA': '::1'},
'www.baidu.com.': {'A': '127.0.0.1', 'AAAA': '::1'},
... |
from copy import copy
#00 01 10 11
sign_table_ = [
[0,0,0,1], #|
[0,1,1,1], #&
[1,1,0,0], #-
[1,0,0,1] #^
]
op_table_ = [
[lambda a,b: a&b, lambda a,b: b-a, lambda a,b: a-b, lambda a,b: a|b,], #|
[lambda a,b: a|b, lambda a,b: a-b, lambda a,b: b-a, lambda a,b: a&b,], #&
[lamb... |
import argparse
import logging
import os
import re
import shutil
import sys
from act.ldmx import aCTDBLDMX
from act.common.aCTConfig import aCTConfigAPP
logger = logging.getLogger()
logger.setLevel(logging.INFO)
hdlr = logging.StreamHandler()
logger.addHandler(hdlr)
def submit(args):
try:
with open(args... |
import requests
from bs4 import BeautifulSoup
from collections import OrderedDict
import time
from .constants import JOURNAL_TITLE,ABBREV_TITLE,ISSN,EMAIL,DEPOSITOR_NAME,DOI_PREFIX
from .constants import DOI_DEPOSIT_URL,DOI_BATCH_START,DOI_BATCH_END,VALIDATE_XML_URL
# Internal methods
def _parse_contributors(authors... |
"""
"""
from threading import *
import traceback
import wx
from autoresize_listctrl import AutoresizeListCtrl
DEFAULT_BORDER = 5
# Define notification event for thread completion
EVT_RESULT_ID = wx.NewId()
def EVT_RESULT(win, func):
"""Define Result Event."""
win.Connect(-1, -1, EVT_RESULT_ID, func)
c... |
import os
import signal
import time
import renderdoc as rd
from . import util
from .logging import log
# Keep running until we get a capture
def run_until_capture(control):
"""Exits when the first capture is made"""
return len(control.captures()) == 0
class TargetControl():
def __init__(self, ident: int... |
"""
Functions related to file paths
"""
import abc
import stat
from datetime import datetime
from hashlib import md5
from io import BufferedReader, DEFAULT_BUFFER_SIZE
from pathlib import Path, PurePath
from typing import *
from flo.hashing import file_hash
from flo.it2 import It, from_
from flo.lamb import as_fcn, Fu... |
import tensorflow as tf
try:
from tensorflow.python.ops import ctc_ops as ctc
except ImportError:
import tensorflow.contrib.ctc as ctc
import keras.backend as K
py_all = all
def _preprocess_conv2d_input(x, data_format):
"""Transpose and cast the input before the conv2d.
# Arguments
x: input... |
#!/usr/bin/env python3
# Copyright (c). All rights reserved.
"""
This module provides the Image class which holds (x, y, color) triples
and a background color to provide a kind of sparse-array representation of
an image. A method to export the image in XPM format is also provided.
>>> import os
>>> import tempfile
>>... |
import sys
from pathlib import Path
import linecache
import os
import inspect
from line_profiler import LineProfiler as _LineProfiler
from line_profiler.line_profiler import is_ipython_kernel_cell
from .timer import (
format_time,
)
def show_func(filename, start_lineno, func_name, timings, unit,
output_unit... |
import os
import re
import ruamel.yaml as yaml
from distroinfo import info
from distroinfo import query
from rdopkg.utils import git
from rdopkg import helpers
local_info = os.environ['HOME'] + '/rdoinfo'
if not os.path.exists(local_info):
os.makedirs(local_info)
def get_projects(info_files='rdo.yml', local_di... |
import numpy as np
import scipy.optimize as opt
from matplotlib import pyplot as plt
import gs2_plotting as gplot
import pickle
import gs2_plotting as gplot
def my_task_single(ifile, run, myin, myout):
# User parameters
dump_at_start = 0.3 # fraction of initial time to dump when fitting
ikx_list = [-1] # ... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... |
import logging
from math import ceil
import datetime
import flask
from flask_restless import APIManager
from putiosync.dbmodel import DownloadRecord
from flask import render_template
from putiosync.webif.transmissionrpc import TransmissionRPCServer
from sqlalchemy import desc, func
class Pagination(object):
# NOT... |
# -*- coding: utf-8 -*-
"""
Gluon
"""
from gluonts.trainer import Trainer
from gluonts.model.deepar import DeepAREstimator
from mlmodels.model_gluon.util import *
import os
########################################################################################################################
#### Model defintion
... |
""" Interpreter for CLIQ key tester robot"""
###############################################################################
# #
# INTERPRETER #
# ... |
# Copyright 2016 <NAME> and The Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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
# Unle... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Contains all units that can work on blocks a fixed length. Note that block cipher
algorithms can be found in `refinery.units.crypto.cipher`.
"""
import abc
import itertools
import operator
from refinery.units import Arg, Unit
from refinery.lib.argformats import numseq... |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
import json
import os
import random
from dataclasses import dataclass
from typing import Optional
import av
import hydra
import pandas as pd
import torch
import torchvision.transforms as T
from ego4d.features.config import FeatureExtractConfig,... |
"""
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related doc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>)
# @Date: 2018-08-27
# @Filename: status.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
from __future__ import annotations
from typing import Dict, List, Tuple
from jaeger.commands import Command, CommandID
from... |
import torch
from mvt.cores.bbox import bbox2roi, bbox_mapping
from mvt.utils.bbox_util import merge_aug_bboxes, merge_aug_masks
from mvt.cores.ops import multiclass_nms
from mvt.utils.log_util import get_root_logger
logger = get_root_logger
class BBoxTestMixin(object):
def simple_test_bboxes(self, x, img_metas... |
import asyncio
import dataclasses
import logging
from typing import Any, Callable, Dict, Optional, Tuple, Type
import orjson
from jsondaora import (
DeserializationError,
asdataclass,
dataclass_asjson,
typed_dict_asjson,
)
from .events.handler import EventsHandler
from .exceptions import (
Channel... |
"""
(c) December 2016 by <NAME>
This implements the two room domain, as described in the experiment of:
Principled Option Learning in Markov Decision Processes
<NAME>*, <NAME>*, <NAME>, EWRL 2016
I'm trying to get it similar to the OpenAI gym interface, with a 'step' function
that returns similar stuff. Also... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 31 10:44:05 2019
@author: WT
"""
import os
import networkx as nx
import numpy as np
import pandas as pd
import torch
from .preprocessing_funcs import load_pickle, save_as_pickle, generate_text_graph
import logging
logging.basicConfig(format='%(asctime)s [%(levelname)s]: ... |
# -*- coding: utf-8 -*-
"""
Extract regional temperature statistics (mean, percentile, hot days)
consists of two parts:
- creating a mask for NARR data based on a rasterised region
- computing regional averages of statistics
Requirements:
- daily maximum temperature data (i.e. from NARR)
- rasterised re... |
"""
returns list of tuples showing the possible positions
"""
from copy import deepcopy
def action(state):
actions = []
for col in range(len(state[0])):
row = len(state)-1
while row > 0 and state[row][col] != '':
row -= 1
if row > 0:
actions.append((row, col))
... |
import torch
import torch.nn as nn
from torchvision.models.vgg import vgg16 as _vgg16
import numpy as np
from torchvision.models.inception import inception_v3
import torch.nn.functional as F
class Conv2d(nn.Module):
"""docstring for Conv2d"""
def __init__(self,
in_channels,
... |
# -*- coding: utf-8 -*-
from email.message import Message
from email.mime.multipart import MIMEMultipart
import smtplib
import traceback
import typing
from tracim_backend.config import CFG
from tracim_backend.lib.mail_notifier.utils import SmtpConfiguration
from tracim_backend.lib.utils.logger import logger
from traci... |
"""
Object Property Definition Language
===================================
:Author: <NAME>
This module contains utilities for using OPDL in Python.
"""
import re
import os
from collections import defaultdict
class CompleteExpression:
pass
class SExpression(CompleteExpression):
def __init__(self, args, kw... |
# Copyright 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sub... |
import numpy as np
from sklearn.model_selection import KFold, train_test_split
from tensorflow.keras.utils import Sequence
from deepforge_redshift.utils import get_logger
MAX_REDSHIFT_VALUES = 0.4
MAX_DERED_PETRO_MAG = 17.8
REDSHIFT_KEY = "z"
DEREDENED_PETRO_KEY = "dered_petro_r"
EBV_KEY = "EBV"
class DataSetSample... |
#!/usr/bin/env python3
# Telegram Download Daemon
# Author: <NAME>. <<EMAIL>>
# You need to install telethon (and cryptg to speed up downloads)
from os import getenv, rename
import subprocess
import math
import os
from sessionManager import getSession, saveSession
from telethon import TelegramClient, events
from tel... |
import random
import sys
import pygame
from pygame.locals import *
FPS = 30
SCREENWIDTH = 289
SCREENHEIGHT = 511
SCREEN = pygame.display.set_mode((SCREENWIDTH, SCREENHEIGHT))
GROUNDY = SCREENHEIGHT * 0.8
GAME_SPRITES = {}
GAME_SOUNDS = {}
PLAYER = 'gallery/sprites/bird1.png'
BACKGROUND = 'gallery/sprites/backgrou... |
from typing import List, Tuple, Union
try:
import anndata
except ImportError:
anndata = None
import dask.array
import numpy as np
import pandas as pd
import patsy
import scipy.sparse
from .external import groupwise_solve_lm
def parse_design(
design_matrix: Union[pd.DataFrame, patsy.design_info.Desi... |
# start
# run allcurate
# step 2 check SNPs
import glob
import os
# set up path
import argparse
############################################ Arguments and declarations ##############################################
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
required = parser.... |
do_ap()
try:
import usocket as socket
except:
import socket
import tracker
import oled_display
import esp
import time
esp.osdebug(None)
import gc
gc.collect()
batt_lvl=99
dist_covered=100
bot = tracker.Tracker(14,12,13,25,26,27,32)
robot_state = "Stop"
blade_state = "Off"
speed_val = 50
bot_oled = oled_display.... |
#####################################################################################################################################################################
# xView2 ... |
import math
import time
import multiprocessing
import pyautogui as pag
import numpy as np
from random import randrange as rrange
from pynput import keyboard
# Setup pyautogui constants
pag.MINIMUM_DURATION = 0 # Default: 0.1
pag.MINIMUM_SLEEP = 0.01 # Default: 0.05
pag.PAUSE = 0 # Default: 0.1
def rotate_x(x, y,... |
import six
from collections import defaultdict
import itertools
import json
import re
import os
import struct
import numpy as np
from tqdm import tqdm
from cloudfiles import CloudFiles
from .... import exceptions
from ....lib import yellow, red, toiter
from ....mesh import Mesh
from ..spatial_index import CachedSpa... |
import os
import math
import torch
import random
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.optim as optim
import torch.nn.init as init
import matplotlib.pyplot as plt
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import DataLoader
from tor... |
import pandas as pd
import numpy as np
import spotipy
import spotipy.util as util
import spotipy.oauth2 as oauth2
import os
import json
def authorize_client_oauth():
username = 'reach2sayan'
CLIENT_ID = 'a55d8d9617de463cad7abce998314bb3'
CLIENT_SECRET = '<KEY>'
sp_oauth = oauth2.SpotifyOAuth(client_i... |
# -*- coding: utf-8 -*-
# @Time : 2019/6/27
# @Author : Godder
# @Github : https://github.com/WangGodder
from torch.utils.data import Dataset
from torchvision import transforms
from torchcmh.utils.calc_utils import calc_IF
from PIL import Image
import os
import torch
import numpy as np
__all__ = ['CrossModalT... |
# coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import sys
from os.path import dirname, join, exists
from deepvoice3_pytorch.frontend.en import text_to_sequence, n_vocab
import torch
from torch.autograd import Variable
from torch import nn
import numpy as np
from nose.plugins.... |
import requests
import spacy
from nltk.corpus import stopwords
nlp = spacy.load('es_core_news_sm')
# =========================================
#
# =========================================
def get_conceptNet_synonyms(term, lang):
# Given a term, get the synonyms from ConcetpNet of the same language
# Note t... |
from kivy.clock import Clock
from kivy.uix.widget import Widget
from kivy.properties import BooleanProperty
from kivy.properties import NumericProperty
# Note that this class contains no graphics. We subclass widget here to use kivy Properties.
class TuringSimulator(Widget):
machine_halted = BooleanProperty()
curr_... |
import socket
import os
from os.path import exists
from time import time
from .select_call import SelectCall, SelectError
from .stats import Stats
from .limits import get_limits
from .exc import StartError
from .transport.tcp_connection import TCPConnection, HangUp, ConnectionAbort
from .transport.address import Addre... |
import os
import sys
import math
import time
import json
from compas.geometry import Vector
from compas.geometry import Frame
from compas.geometry import Box
from compas.geometry import Transformation, Translation
from compas_fab.backends import RosClient
from compas_fab.robots import PlanningScene
from compas_fab.robo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.