text stringlengths 2 999k |
|---|
from django.shortcuts import render, redirect
#from .models import DoctorReg, predictions, Regdb
from django.contrib import messages
from django.contrib.auth.models import User, auth
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
# Create your ... |
import sys
from Pr0j3ct.server import Server
if __name__=="__main__":
if len(sys.argv) < 3:
print("Please run: main.py <RootDirectory> <Port>")
sys.exit(1)
"""
The first argument is the root directory, the second argument is the port.
"""
root = sys.argv[1]
port = int(sys.argv[... |
from pyopencga.rest_clients._parent_rest_clients import _ParentRestClient
class Alignment(_ParentRestClient):
"""
This class contains methods for the 'Analysis - Alignment' webservices
Client version: 2.0.0
PATH: /{apiVersion}/analysis/alignment
"""
def __init__(self, configuration, token=Non... |
import pygame
import bt.game.action as action
class EventHandler(object):
def __init__(self, location=""):
self.keymap = {}
self.location = location
def enter(self, state):
pass
def exit(self, state):
pass
def add_key_event(self, key, action):
if isinstance(key, ... |
# 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 PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2018 Bitcraze AB
#
# Th... |
import torch
import torch.nn as nn
import torch.nn.intrinsic as nni
import torch.nn.functional as F
from torch.nn import init
from torch.nn.parameter import Parameter
class LinearBn1d(nn.modules.linear.Linear, nni._FusedModule):
r"""
A LinearBn1d module is a module fused from Linear and BatchNorm1d, attached
... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Pelix remote services transports package
:author: Thomas Calmant
:copyright: Copyright 2016, Thomas Calmant
:license: Apache License 2.0
:version: 0.6.4
..
Copyright 2016 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
... |
import asyncio
import datetime
import sys
import urllib.parse
from operator import itemgetter
import queries
import sql_queries
# Learning coefficient for the link strength calculation
ALPHA = 0.9
class SyncDatabase:
def __init__(self, host, dbname, user, password):
connection_uri = 'postgresql://{user... |
import ruamel.yaml as yaml
from validate import check_query_f
import pytest
import os
usefixtures = pytest.mark.usefixtures
use_mutation_fixtures = usefixtures(
'per_class_db_schema_for_mutation_tests',
'per_method_db_data_for_mutation_tests'
)
@usefixtures('per_method_tests_db_state')
class TestMetadata:
... |
#!/usr/bin/env python
import os
import sys
import glob
import shutil
from subprocess import call
# If vtk python module is not available, we can't run track.py so skip this
# test
cwd = os.getcwd()
try:
import vtk
except ImportError:
print('----------------Skipping test-------------')
shutil.copy('results... |
# Copyright (c) 2010-2013 OpenStack Foundation
#
# 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 agree... |
import json
import os
import sys
import torch
from pathlib import Path
import nni.retiarii.evaluator.pytorch.lightning as pl
import nni.retiarii.strategy as strategy
from nni.retiarii import serialize
from nni.retiarii.experiment.pytorch import RetiariiExperiment, RetiariiExeConfig
from torchvision import transforms
f... |
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2018 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : quick_train.py
# Author : YunYang1994
# Created date: 2018-12-07 17:58:58
# Description :
#
#===================... |
"""
caches
From http://blog.seevl.fm/2013/11/22/simple-caching-with-redis/
"""
import cPickle
class RedisCache(object):
"""Redis cache"""
def __init__(self, redis, prefix='cache|', timeout=60*60):
"""Create Redis cache instance using a StrictRedis connection,
with prefix and timeout (or use ... |
#!/usr/bin/env python
# _*_ coding: utf-8_*_
#
# Copyright 2016 planc2c.com
# thomas@time2box.com
#
# 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/LICENS... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nebula, 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
#
#... |
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# header files and constant variables
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from scipy.interpolate import RectBivariateSpline as RS
from multiprocessing import Pool
from functools import partial
from pyswarm import pso
import warnings
warnings.filterwarnings("ignore")
np.printoptions(precision=2)
... |
# encoding=utf-8
import io
from time import time
import pytest
from rich.bar import Bar
from rich.console import Console
from rich.highlighter import NullHighlighter
from rich.progress import (
BarColumn,
FileSizeColumn,
TotalFileSizeColumn,
DownloadColumn,
TransferSpeedColumn,
Progress,
... |
from jinja2 import Environment, FileSystemLoader
import yaml
import os.path
searchpath = os.path.join(os.path.dirname(__file__), 'templates')
loader = FileSystemLoader(searchpath)
env = Environment(loader = loader)
template = env.get_template('property_table.html.t')
macros = yaml.load(stream = file('extracted_data/ma... |
from django.db import models
class Student(models.Model):
first_name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
age = models.IntegerField(default=18)
phone = models.IntegerField(null=True)
def __str__(self):
return f"{self.first_name} {self.last_name},... |
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'QueuedMessage'
db.create_table(u'grapevine_queuedmessage'... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block processing.
This reimplements tests from the iridiumj/FullBlockTestGenerator used
by the pu... |
import os, sys, inspect, ssl, threading
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from PyXTB.api_access import QuerySet, AccessAPI
from PyXTB.data_processing import *
from PyXTB.settings import *
class Te... |
#!/usr/bin/env python
"""This module contains tests for user API handlers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from absl import app
from future.builtins import range
from future.builtins import str
from future.builtins import zip
from grr_... |
# -*- coding: utf-8 -*-
"""
ANSI/IES TM-30-18 Colour Fidelity Index
=======================================
Defines the *ANSI/IES TM-30-18 Colour Fidelity Index* (CFI) computation
objects:
- :class:`colour.quality.ColourQuality_Specification_ANSIIESTM3018`
- :func:`colour.quality.colour_fidelity_index_ANSIIESTM3018`
... |
# -*- encoding: utf-8 -*-
import rsa
import os
import string
import random
import hashlib
import merkletools
import cPickle
import binascii
import base64
import logging
import random
# New cryptographic library
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Hash import SHA256
from C... |
"""This is the set of modules for Bcfg2.Server."""
import lxml.etree
__all__ = ["Admin", "Core", "FileMonitor", "Plugin", "Plugins",
"Hostbase", "Reports", "Snapshots", "XMLParser",
"XI", "XI_NAMESPACE"]
XMLParser = lxml.etree.XMLParser(remove_blank_text=True)
XI = 'http://www.w3.org/2001/XInc... |
#functions: used to wrap code for resuse
def doSomething():
print('Hello Grace')
x=7*8*9
print(x)
uservalidation=input("What's your name?")
if uservalidation==("Grace"):
doSomething()
else: print('Invalid User')
def verify(a,b,c):
print('Hello Grace')
x=a*b*c
print('The answer is', x)
... |
from movies.nested_serializers import FilmSerializerForDisplayInFilmographies
from performers.nested_serializers import PerformerSerializerForDisplayInLists
from rest_framework import serializers
from .models import FilmAward, FilmAwardReceived
# --------------------------------------------##GENERAL AWARDS serializer... |
"""twitterbackend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Clas... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# l... |
import os
from decimal import Decimal
from django.utils import unittest
from django.utils.copycompat import copy
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, MissingForeign... |
from typing import List, Dict
from sqlalchemy.orm import Session
from app.database.models import Event, Invitation, UserEvent
<<<<<<< HEAD
from app.routers.export import event_to_ical
from app.routers.user import does_user_exist, get_users
from app.internal.utils import save
=======
from app.internal.utils import sav... |
from .atss import ATSS
from .base import BaseDetector
from .cascade_rcnn import CascadeRCNN
from .cornernet import CornerNet
from .detr import DETR
from .fast_rcnn import FastRCNN
from .faster_rcnn import FasterRCNN
from .fcos import FCOS
from .fovea import FOVEA
from .fsaf import FSAF
from .gfl import GFL
from .grid_r... |
#!/usr/bin/env python3 -u
# -*- coding: utf-8 -*-
__author__ = ["Markus Löning"]
__all__ = [
"ShapeletTransformClassifier",
"MrSEQLClassifier",
"BOSSEnsemble",
"BOSSIndividual",
"KNeighborsTimeSeriesClassifier",
"TemporalDictionaryEnsemble",
"ProximityStump",
"ProximityTree",
"Proxi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2020 all rights reserved
#
"""
Exercise the gaussian pdf
"""
def test():
# math
from math import pi, sqrt, exp
# access the package
import gsl
# build a random number generator
rng = gsl.rng()
... |
#os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
import argparse, os, math, time, sys
import mxnet as mx
from mxnet import gluon
from mxnet.gluon.data.vision import transforms
from mxnet.contrib.quantization import *
from resnest.gluon import get_model
from PIL import Image
# CLI
def parse_args():
parser = a... |
#
# This file is part of pyasn1-alt-modules software.
#
# Modified by Russ Housley to import from RFC 5280 and RFC 5652
#
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
# Copyright (c) 2021, Vigil Security, LLC
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
#
# X.509 certificate Request Mess... |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: bool
"""
def get(start, end):
if start > end:
return False
mid = (start + end) / 2
# handle dupli... |
import os
import random
import time
from slackclient import SlackClient
from nflh.nfl_highlight_bot import get_highlight_list
from nflh.videos import Video
"""
Base logic taken from https://www.fullstackpython.com/blog/build-first-slack-bot-python.html
"""
BOT_ID = os.environ.get("BOT_ID")
AT_BOT = "<@" + BOT_ID +... |
class VectorAnimation(VectorAnimationBase,ISealable,IAnimatable,IResource):
"""
Animates the value of a System.Windows.Vector property between two target values using linear interpolation over a specified System.Windows.Media.Animation.Timeline.Duration.
VectorAnimation()
VectorAnimation(toValue: Vecto... |
import logging
import sentry_sdk
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from .base import * # noqa
from .base im... |
from future import standard_library
standard_library.install_aliases()
from builtins import next
from os.path import join, splitext
import re
import urllib.parse
import unicodecsv
from openelex.api import elections as elec_api
from openelex.lib.text import election_slug, slugify
from .state import StateBase
MAPPING... |
"""
Copyright 2015 BlazeMeter 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... |
# flake8: noqa
from catalyst.core.callback import *
from catalyst.core.callbacks import *
from .gan import (
GradientPenaltyCallback, WassersteinDistanceCallback,
WeightClampingOptimizerCallback
)
from .inference import InferCallback, InferMaskCallback
from .metrics import (
AccuracyCallback, AUCCallback, ... |
import sys
import numpy as np
from copy import copy, deepcopy
import multiprocessing as mp
from numpy.random import shuffle, random, normal
from math import log, sqrt, exp, pi
import itertools as it
from scipy.stats import gaussian_kde, pearsonr
from scipy.stats import ttest_1samp
from itertools import product
try:
... |
import random
import scrypt
import requests
import re
def average(list):
return sum(list) / float(len(list)) if len(list) else 0
def average_non_zero(list):
list = [x for x in list if x != 0]
return average(list)
def get_slug(s):
s = s.lower()
s = re.sub(r"[\s_+]+", "-", s)
s = re.sub("[^a... |
# Copyright (c) 2021, jb and Contributors
# See license.txt
# import frappe
import unittest
class TestLiner(unittest.TestCase):
pass
|
# 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 ... |
import datetime
from functools import reduce
import gym
import numpy as np
import pandas as pd
from loguru import logger
import us_state_abbrev
import util
import matplotlib.pyplot as plt
import argparse
import seaborn as sns
pd.options.mode.chained_assignment = None
def print_full(x):
pd.set_option('display.max_... |
# compute nim values using negamax and a dictionary
# that holds values already computed RBH 2019
def get_piles():
while True:
raw = input('nim game pile sizes (eg. 3 5 7) ')
try:
dim = tuple( int(x) for x in raw.split() )
if len(dim) > 0 and all(d >= 0 for d in dim):
... |
from direct.distributed.ClockDelta import globalClockDelta
from pandac.PandaModules import Point3
from toontown.toonbase import TTLocalizer
from toontown.parties import PartyGlobals
from DistributedPartyTeamActivity import DistributedPartyTeamActivity
from toontown.parties.PartyCogActivity import PartyCogActivity
clas... |
# Copyright 2008-2009 Canonical Ltd. All rights reserved.
# This file is part of wadllib.
#
# wadllib is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# wadllib is distribut... |
import sys
sys.path.append("..")
import os
import math
import pickle
import argparse
import numpy as np
import pandas as pd
import seaborn as sns
from itertools import groupby
from IPython.display import display, HTML
from trickster.search import a_star_search
from trickster.wfp_helper import (
extract,
loa... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import contextlib
import logging
from typing import Optional, Any, Dict
import mock
import yaml
from d2go.utils.helper import reroute_config_path
from detectron2.config import CfgNode as _CfgNode
from fvcore.common.registry... |
# Copyright 2019 The Glow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
import os
from StringIO import StringIO
from zipfile import ZipFile
import subprocess
import shutil
import fcntl
import time
import signal
import imp
import sys,traceback
def dir_clean_error(function,path,excinfo):
print 'WARNING: Ran into issues trying to remove directory:',path,str(function),str(excinfo)
def cle... |
import FWCore.ParameterSet.Config as cms
#
# This is the include file with the parameters
# for the DTCombinatorialPatternReco algorithm,
# which is the concrete algo for the DTRecSegment4D production.
# The Parametrized Drift algos is used.
#
# this is the RecSegment2D algo include!
from RecoLocalMuon.DTSegment.DTCo... |
"""
This class models the main Selenium tutorial page.
URL: selenium-tutorial-main
The page consists of a header, footer, form and table objects
"""
from page_objects.Base_Page import Base_Page
from page_objects.form_object import Form_Object
from utils.Wrapit import Wrapit
class Scheduler_Main_Page(Base_Page,Form_Ob... |
import os
import tempfile
import json
import pytest
from app import app
@pytest.fixture
def client():
db_fd, app.config['DATABASE'] = tempfile.mkstemp()
app.config['TESTING'] = True
client = app.test_client()
# with app.app_context():
# app.init_db()
yield client
os.close(db_fd)
... |
import os
import torch
import torch.nn as nn
from torch.utils.data import IterableDataset
class Dictionary(object):
def __init__(self, paths):
self.char2idx = {}
self.idx2char = []
self.max_seq_len = 0
self.build_dictionary(paths)
def build_dictionary(self, paths):
self... |
from django.db import models
from polymorphic.models import PolymorphicModel
class Interface(PolymorphicModel):
name = models.CharField(max_length=30, unique=True)
def __str__(self):
return self.name
class NetworkInterface(Interface):
mac_address = models.CharField(max_length=23)
address = ... |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, text_output
@click.command('export_history')
@click.argument("history_id", type=str)
@click.option(
"--gzip",
help="create .tar.gz archive if ``True``, else .tar",
default="True",
show_default=... |
import argparse
import os
from typing import Tuple
from pandas import DataFrame
from common.loading_functions import loading_data
from config import CONFIG
def args():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--dataset', default='10M', choices=['10M', '1M', 'BRUNCH'], help='데이터셋', type=... |
#!/usr/bin/python
# module_check: supported
# Copyright 2021 VMware, Inc. All rights reserved. VMware Confidential
# SPDX-License-Identifier: Apache License 2.0
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
VERSION_MAJOR = 0
VERSION_MINOR = 4
VERSION_BUILD = '0'
VERSION_INFO = (VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD)
VERSION_STRING = "%d.%d.%s" % VERSION_INFO
AUTHOR_NAME = "Dolf Andringa"
DESCRIPTION = "Add support for GeoAlchemy2 Geometry fields to Flask Appbuilder"
AUTHOR_EMAIL = "dolfandringa@gmail.com"
__version... |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
# pylint: disable=missing-module-docstring
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-d... |
from typing import List
import json
import sys
class Graph(object):
UNREACHABLE_DISTANCE = -1
def __init__(self, n):
self.nodes_count = n
self.adj = [[self.UNREACHABLE_DISTANCE for _ in range(n)] for _ in range(n)]
def add_edge(self, u, v, dist: int) -> None:
self.adj[u][v] = dist... |
# -*- coding: utf-8 -*-
import sys
import cv2
import numpy as np
from scipy import ndimage
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import tensorflow as tf
class pline(QWidget):
def __init__(self, parent = None):
QWidget.__init__(self, parent)
self.px = None... |
import json
from urllib.parse import urlparse
from django.db.models import Q
from django.utils.encoding import smart_text
def get_url_path(url):
parsed_url = urlparse(url)
return parsed_url.path
def get_redirect_location(response):
# Due to Django 1.8 compatibility, we have to handle both cases
ret... |
def partition(array, start, end):
pivot = array[start]
low = start + 1
high = end
# if value is larger than pivot it means is on the right side
# and we can move left to the next element
while True:
# indicates all values moved to right
while low <= high and array[high] >= pivot... |
import numpy as np
def plane_error(results, target):
"""
Computes angle between target orbital plane and actually achieved plane.
:param results: Results struct as output by flight_manager (NOT flight_sim_3d).
:param target: Target struct as output by launch_targeting.
:return: Angle... |
import json
import logging
import os
import sys
import signal
import socket
import time
import datetime
import inspect
from collections import OrderedDict
SIMAPP_VERSION="1.0"
SIMAPP_SIMULATION_WORKER_EXCEPTION = "simulation_worker.exceptions"
SIMAPP_TRAINING_WORKER_EXCEPTION = "training_worker.exceptions"
SIMAPP_S3_... |
"""
Docker 操作相关的控制器
add on 2017-11-20 15:59:36
"""
import sys
from subprocess import Popen
from flask import jsonify, request
from buter import Q, ServiceException
from buter.app import dockerBp
from buter.server import docker
@dockerBp.route("/images", methods=['GET', 'POST'])
def images():
"""
docker ima... |
import logging
import re
from uuid import uuid4
from streamlink.compat import parse_qs, str, urljoin
from streamlink.plugin import Plugin, PluginArgument, PluginArguments, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
from streamlink.stream.hls_filtered import Fil... |
#third party imports
import tensorflow as tf
from graph_nets import utils_np
from graph_nets import utils_tf
from graph_nets.demos import models
from graph_nets import modules
from graph_nets import blocks
import matplotlib.pyplot as plt
import networkx as nx
import argparse
import multiprocessing
import os
import ra... |
#appModules/powerpnt.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2012-2018 NV Access Limited
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import comtypes
from comtypes.automation import IDispatch
import comtypes.client
import ctypes
import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2015 HP Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
... |
NOT_PROVIDED = object()
class FieldCacheMixin:
"""Provide an API for working with the model's fields value cache."""
def get_cache_name(self):
raise NotImplementedError
def get_cached_value(self, instance, default=NOT_PROVIDED):
cache_name = self.get_cache_name()
try:
... |
#!/usr/bin/env python
######################################################################
# Copyright (c) 2016 Northrop Grumman.
# All rights reserved.
######################################################################
from __future__ import print_function
import sys
im... |
#!/usr/bin/python
# Copyright (c) 2018-2019, NVIDIA CORPORATION. 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, t... |
'''
/*#############################################################################
HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems(R).
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 Li... |
class Solution:
def imageSmoother(self, M: list) -> list:
l = len(M)
if l == 0:
return M
m = len(M[0])
res = []
for i in range(l):
res.append([0] * m)
# print(res)
for x in range(l):
for y in range(m):
summ =... |
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import sys
sizeof = {"float": 4, "at::Half": 2, "uint8_t": 1}
def unroll(uf, IndexType, InType, OutType, use_weights, isa, fused, use_offsets):
def compute(regid, InType, use_weights, isa, prefetch):
code... |
from exception import AUAException, error_code
from .database import alias, charts, Data
from random import choice
def get_song_info(song_id: str, difficulty: int = -1):
song_list = Data.song_list
try:
for i in song_list.songs:
if i.song_id == song_id:
if difficulty == -1:
... |
# type:ignore
# MyPy will (reproducable) run in an infinite loop if you remove the type ignore in the test! We literally killed it 💀
"""
Tests that the parsed trees are JSON serializable
"""
import pytest # type:ignore[import]
from lark import Token, Tree
from ahbicht.expressions.ahb_expression_parser import parse... |
import time
from init_mysql_connector_cursor import init_mysql_connector_and_cursor
import uuid
from mysql_dao import TaskDBMySqlDao
from mongo_dao import TaskDBMongoDao
from database_enum import DatabaseStack
from database_enum import Database
import argparse
import sys
# This method generates task entries with (url,... |
# -*- coding: utf-8 -*-
__author__ = """Axel ARONIO DE ROMBLAY"""
__email__ = 'axelderomblay@gmail.com'
__version__ = '0.5.3'
from .preprocessing import *
from .encoding import *
from .optimisation import *
from .prediction import *
from .model import *
|
import os
import sys
import time
import glob
import tqdm
import numpy as np
import torch
import utils
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.utils.data
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from torch import optim
from typing import Dict
from... |
import logging
from dataclasses import dataclass
from functools import cached_property
from typing import Optional
from brownie import ZERO_ADDRESS, interface
from brownie.network.contract import InterfaceContainer
from yearn import apy, constants
from yearn.apy.common import ApySamples
from yearn.common import Tvl
f... |
import cv2 as cv
import numpy as np
from ch7.pose_estimation_2d2d import find_feature_matches, pose_estimation_2d2d, pixel2cam
K = np.array([[520.9, 0, 325.1],
[0, 521.0, 249.7],
[0, 0, 1]])
def triangulation(kp_1, kp_2, ms, r_mat, t_vec):
T1 = np.array([[1, 0, 0, 0],
... |
from datetime import datetime, timedelta, tzinfo
class JST(tzinfo):
def utcoffset(self, dt):
return timedelta(hours=9)
def dst(self, dt):
return timedelta(0)
def tzname(self, dt):
return 'JST'
def time_now():
return datetime.now(JST())
|
from airypi.remote_obj import send_to_device
def multi():
send_to_device({'type': 'transaction',
'func': 'begin'})
def execute():
send_to_device({'type': 'transaction',
'func': 'execute'})
def sleep(duration):
send_to_device({'type': 'transaction',
... |
import logging
import os
import re
from flask import Flask, request
from twilio.twiml.messaging_response import MessagingResponse
# from twilio.rest import Client
from mindmeld.components import NaturalLanguageProcessor
from mindmeld.components.dialogue import Conversation
from mindmeld import configure_logs
class ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.