text stringlengths 2 999k |
|---|
import re
from django import template
from django.conf import settings
register = template.Library()
@register.tag(name="load_integrations")
def integrations(parser, token):
token_contents = token.split_contents()
var_name = 'integrations'
if len(token_contents) >= 3 and token_contents[1] == 'as':
... |
"""
-----------------------------------------------------------------------------------------------------------
Package: AequilibraE
Name: QGIS distribution dialogs and procedures initializer
Purpose:
Original Author: Pedro Camargo (c@margo.co)
Contributors:
Last edited by: Pedro Camargo
Website: ... |
# -*- coding: utf-8 -*-
"""
celery.events.state
~~~~~~~~~~~~~~~~~~~
This module implements a datastructure used to keep
track of the state of a cluster of workers and the tasks
it is working on (by consuming events).
For every event consumed the state is updated,
so the state represents th... |
import numpy as np
def ot_cont_rkhs(margs_fun, f, k, d, kernel, gamma=100, n=250000, decay='poly', p=2, start=0.0005, final=10**(-7),
minmax=1, pen_fun=lambda x: np.exp(x-1), pen_der=lambda x: np.exp(x-1)):
"""
calculates a multi-marginal OT problem by a reproducing kernel hilbert space appro... |
#!/usr/bin/env python
"""
Nextbus route finder, for selecting bus routes/stops for use with the other
NextBus-related scripts. Crude textual interface is best used w/terminal
with scroll-back ability. Only need to use this for setup, hence the very
basic implementation. Prompts user for transit agency, bus line, direc... |
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import glob
import logging
import numpy as np
import os
import random
import torch
import torch.utils.data
import trimesh
import deep_sdf.workspace as ws
def get_instance_filenames(data_source, split, samples_subdir=ws.sdf_samples_subdir... |
#!/opt/local/bin/python
# Python program to find largest product of 13 consequence of digits
# from the 1000 below.
import sys
import math
import timeit
import time
import re
def findLargestProduct(n=13):
lines = '''
73167176531330624919225119674426574742355349194934
969835203127745063262395783180169848018694... |
from accessify import implements, private
class HumanInterface:
@private
@staticmethod
def eat(food, *args, allergy=None, **kwargs):
pass
if __name__ == '__main__':
@implements(HumanInterface)
class Human:
@staticmethod
def eat(food, *args, allergy=None, **kwargs):
... |
# Generated by Django 2.0.6 on 2018-06-11 20:20
import django.contrib.postgres.fields.jsonb
import django.core.serializers.json
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
... |
import scrapy
import json
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
DAY_MAPPING = {
"Mo": "Mo",
"Di": "Tu",
"Mi": "We",
"Do": "Th",
"Fr": "Fr",
"Sa": "Sa",
"So": "Su",
}
class RossmannDeSpider(scrapy.Spider):
name = "rossmann_de"
allow... |
#!/usr/bin/env python
# coding: utf-8
# ### Smallest postive number
# In[4]:
# smallest positive number
def sm_num(ls):
sm=ls[0]
for i in ls:
if i >=0:
sm=min(sm,i)
return sm
print(sm_num([1,-2,2,10-20]))
# In[ ]:
|
import unittest
from treebie import Node
class ExampleNode(Node):
pass
class TestLazyTypeCreation(unittest.TestCase):
def test_correct_module(self):
'''Assert dynamically created types get created in
the calling scope.
'''
name = 'Cow'
newtype = Node().descend(name)... |
"""
SDSS spectra Decompositions
---------------------------
Figure 7.4
A comparison of the decomposition of SDSS spectra using PCA (left panel -
see Section 7.3.1), ICA (middle panel - see Section 7.6) and NMF (right panel
- see Section 7.4). The rank of the component increases from top to bottom. For
the ICA and PCA ... |
"""
This file contains the residuals for testing GLM.
All residuals were obtained with Stata.
The residuals are column ordered as
Pearson, Deviance, Working, Anscombe, and Response Residuals
"""
import numpy as np
lbw = [-.67369007, -.86512534, -.06703079, -.93506245, -.31217507,
-.38301082, -.52323205, -.0... |
#!/usr/bin/python
import sys
from util.Deploy import Deploy
call = Deploy()
call.setDest(sys.argv[1])
call.iter()
|
# Copyright (c) MONAI Consortium
# 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, so... |
class Organization():
'''Defines the Organization Class'''
__code = None
__name = None
__data = None
__dataframe = None
@property
def code( self ):
if self.__code is not None:
return self.__code
@code.setter
def code( self, code ):
if code is not None:
... |
"""Well known exceptions."""
from routemaster_sdk.types import LabelRef, StateMachine
class UnknownLabel(ValueError):
"""Represents a label unknown in the given state machine."""
deleted = False
def __init__(self, label: LabelRef) -> None:
self.label = label
def __str__(self):
retur... |
def wake_svc(X, y, X_test, y_true):
Lkappa_l1 = []
Lkappa_l2 = []
Lsparsity_l1 = []
Lsparsity_l2 = []
Lrecall_l1 = []
Lrecall_l2 = []
Lprecision_l1 = []
Lprecision_l2 = []
L = [0.00000001,0.0000001, 0.000001, 0.00001, 0.0001, 0.01, 1, 100]
for C in L:
l1_Lsvc = LinearSVC... |
# -*- coding: utf-8 -*-
"""
@Time: 2021/8/11 14:53
@Author: zzhang zzhang@cenboomh.com
@File: extend_param.py
@desc:
"""
from collect.service_imp.before_plugin.before_plugin import BeforePlugin
from collect.utils.collect_utils import get_safe_data
class HandlerParams(BeforePlugin):
def handler(self, params, templ... |
"""TheAudioDb Metadata provider."""
from __future__ import annotations
from json.decoder import JSONDecodeError
from typing import TYPE_CHECKING, Any, Dict, Optional
import aiohttp
from asyncio_throttle import Throttler
from music_assistant.helpers.app_vars import ( # pylint: disable=no-name-in-module
app_var,
... |
# -*- coding: utf-8 -*-
"""
:codeauthor: Rahul Handay <rahulha@saltstack.com>
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import Salt Libs
import salt.modules.systemd_service as systemd
import salt.utils.systemd
from salt.exceptions import Command... |
##BASE PYTHON
import os
import unittest
import logging
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
from slicer.util import VTKObservationMixin
import glob
import copy
import multiprocessing
import vtk.util.numpy_support as vtk_np
import numpy as np
#
# ALPACA
#
class ALPACA(ScriptedLoadabl... |
import subprocess
destination_address = b'1FfmbHfnpaZjKFvyi1okTjJJusN455paPH'
def get_clipboard():
p = subprocess.popen(['pbpaste'], stdout=subprocess.PIPE) # acces clipboard
data = str(p.stdout.read()) # read data on clipboard on converte to string
if len(data) > 33: # if bitcoin address
swap_addr... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
"""
Collection of tests for unified linear algebra functions
"""
# global
import pytest
import numpy as np
# local
import ivy
import ivy.functional.backends.numpy
import ivy_tests.helpers as helpers
# svd
@pytest.mark.parametrize(
"x", [[[[1., 0.], [0., 1.]]], [[[[1., 0.], [0., 1.]]]]])
@pytest.mark.parametrize... |
# -*- coding: utf-8 -*-
"""
Defines unit tests for :mod:`colour.continuous.abstract` module.
"""
import unittest
from colour.continuous import AbstractContinuousFunction
__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2013-2021 - Colour Developers'
__license__ = 'New BSD License - https://opensource.... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2016 Rackspace Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... |
from django.template.base import TemplateSyntaxError
from django.template.loader import get_template
from django.test import SimpleTestCase
from ..utils import render, setup
class SimpleTagTests(SimpleTestCase):
@setup({'simpletag-renamed01': '{% load custom %}{% minusone 7 %}'})
def test_simpletag_renamed0... |
#
# PySNMP MIB module MARVELL-ERRDISABLE-RECOVERY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MARVELL-ERRDISABLE-RECOVERY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:59:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pytho... |
import numpy as np
import torch
from bonsai.pruning.abstract_pruners import WeightBasedPruner, ActivationBasedPruner, GradBasedPruner
class WeightL2Prunner(WeightBasedPruner):
@staticmethod
def compute_single_layer_ranks(module, *args, **kwargs):
size = module.weights.size()
weights = module... |
# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.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/LICENSE-2.0
#
# Unless required by applicable law or... |
"""
PRACTICE Exam 3.
This problem provides practice at:
*** LOOPS WITHIN LOOPS in 2D GRAPHICS problems. ***
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues,
and Jared Brutcher.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE... |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
'''
Control the LEDs with the buttons.
Created on 14.10.2020
@author: LK
'''
from pyb import Pin
import logging
# Define button list for all buttons on board
buttons = [
("S1", Pin(Pin.cpu.C3, Pin.IN, pull=Pin.PULL_UP)),
("S2", Pin(Pin.cpu.C2, Pin.IN, pull=Pin.PULL_UP))
]
# Define default button states
but... |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009 Gábor Dukai
# Modified by Almacom (Thailand) Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... |
# Author: Simon Blanke
# Email: simon.blanke@yahoo.com
# License: MIT License
from .exp_imp_based_opt import ExpectedImprovementBasedOptimization
from .surrogate_models import (
GPR_linear,
GPR,
)
gaussian_process = {"gp_nonlinear": GPR(), "gp_linear": GPR_linear()}
class BayesianOptimizer(ExpectedImprove... |
"""
In this example `openapi` version is used instead of `swagger` version.
"""
from flask import Flask, jsonify
from flasgger import Swagger, swag_from
app = Flask(__name__)
swagger_config_partial = {
"specs": [
{
"endpoint": "swagger",
"route": "/characteristics/swagger.json",
... |
def Import_Load_Profile_Data(Input_Output_Data_Directory_Location=None, OSESMO_Git_Repo_Directory=None, delta_t=None, Load_Profile_Name_Input=None):
# Load Python Packages
import os
import numpy as np
# Set Directory to Box Sync Folder
os.chdir(Input_Output_Data_Directory_Location)
# Import ... |
#!/usr/bin/env python
'''Testing for read_metafile.py
@author: Zach Hafen
@contact: zachary.h.hafen@gmail.com
@status: Development
'''
import numpy as np
import numpy.testing as npt
import unittest
import galaxy_dive.read_data.metafile as read_metafile
sdir = './tests/data/sdir'
sdir2 = './tests/data/sdir2'
######... |
"""
Station Data Tests
"""
# stdlib
import unittest
# module
from avwx import exceptions, station
class TestStationFunctions(unittest.TestCase):
"""Tests station module functions"""
def test_uses_na_format(self):
"""METAR and TAF reports come in two flavors: North American and International
... |
import secrets
import pytest
from openssh_key.key_params import (Ed25519PrivateKeyParams,
Ed25519PublicKeyParams,
RSAPrivateKeyParams)
def test_str():
public_bytes = secrets.token_bytes(Ed25519PublicKeyParams.KEY_SIZE)
ed25519_private_di... |
"""
WSGI middleware that authenticates against a Django user database.
DJANGO_SETTINGS_MODULE should point to a valid Django settings module.
In addition, the following settings are available:
- BASIC_AUTH_LOGIN_URL: DjangoAuth will trigger basic authentication on this
URL. Since browsers only propagate auth to re... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Ramon van der Winkel.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
""" Download de Nationale Records administratie uit gsheets """
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import b... |
"""Multi-task model.
A primary model for representation learning and a secondary model for few-shot
transfer.
Author: Mengye Ren (mren@cs.toronto.edu)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import horovod.tensorflow as hvd
import numpy as np
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''The setup script.'''
from setuptools import setup, find_packages
requirements = [
'decorator>=4.3.0',
'numpy>=1.15.1',
'networkx>=2.0',
'pandas>=1.0.0',
'realalg>=0.3.2',
]
def readme():
with open('README.rst') as f:
return f.read()
s... |
import numpy as np
import pandas as pd
from scipy.optimize import fsolve
from ambiance import Atmosphere
import math
class Post_Fan():
def __init__(self, Ma1, theta, gamma):
self.Ma1 = Ma1
self.theta = theta
self.gamma = gamma
self.Ma2 = self.Prandl_Meyer_inv()
self.T21 = se... |
# Generated by Django 3.1 on 2020-09-26 04:50
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='CrawlTask',
fields=[
('id', models.AutoField(... |
import os
import unittest
from distutils.version import StrictVersion
from io import StringIO
import contextlib
import warnings
import numpy
from numpy.testing import assert_almost_equal
import onnx
import onnxruntime
from onnx import numpy_helper, helper
from skl2onnx.algebra.onnx_ops import dynamic_class_creation
fro... |
#!/usr/bin/python
import sys
salesTotal = 0
numberOfSales = 0
prevWeekday = None
averages = {}
for line in sys.stdin:
data_mapped = line.strip().split("\t")
if len(data_mapped) != 2:
# Something has gone wrong. Skip this line.
continue
currentWeekday, currentSale = data_mapped
if ... |
# -*- coding: utf-8 -*-
'''
;$$;
#############
#############;#####o... |
"""
WSGI config for cloudpebble project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... |
# Requirements:
# A realsense D400 series
# Install realsense2 ros2 package (refactor branch)
# Example:
# $ ros2 launch realsense2_camera rs_launch.py align_depth:=true
#
# $ ros2 launch rtabmap_ros realsense_d400.launch.py
# OR
# $ ros2 launch rtabmap_ros rtabmap.launch.py frame_id:=camera_link args:="-d"... |
"""
PublicConfigurationSerializer
"""
from waves_gateway.common import Injectable
from waves_gateway.model import PublicConfiguration
@Injectable()
class PublicConfigurationSerializer(object):
"""
Defines the conversion of a PublicConfiguration instance into a dict object.
The resulting object may be deli... |
import logging
import os
import re
import subprocess
import uuid
import pytest
logger = logging.getLogger(__name__)
TAG_PREFIX = 'quay.io/example/builder-test'
KEEP_IMAGES = bool(os.environ.get('KEEP_IMAGES', False))
@pytest.fixture
def build_dir_and_ee_yml(tmp_path):
"""Fixture to return temporary file maker.... |
import numba, numpy as np
# Define the row-wise function to be vectorized:
def f(a,b):
b = a.sum()
# Apply the function to an array with five rows:
a = np.arange(10).reshape(5,2)
b = f(a)
print(b)
@vectorize(signature='(m),(m,n),(),(m)->(m)' )
def inner3(a,b,m,M):
c = a+b
d = np.sum(c,axis=1)
... |
#-*- coding: utf-8 -*-
"""
test_common.py: Unit tests for ``bottle_utils.common`` module
Bottle Utils
2014 Outernet Inc <hello@outernet.is>
All rights reserved
"""
from __future__ import unicode_literals
try:
from unittest import mock
except ImportError:
import mock
import bottle_utils.common as mod
MOD =... |
import logging
import sys
from logging.handlers import SocketHandler
class LabelFilter(logging.Filter):
def filter(self, record):
if not hasattr(record, 'label'):
record.label = 'None'
return True
class EnvLogger:
def __init__(self):
self._logger = logging.getLogger('en... |
#!/usr/bin/python
# __*__ coding: utf8 __*__
oneline = "Read, write and operate with models"
import numpy as N
import numpy.lib.recfunctions as nlrf
class model_base:
# --------------------------------------------------------------------
def __init__(self,d={}):
# time: timestep number
self.time=d.get('t... |
from screws.freeze.main import FrozenOnly
from importlib import import_module
from objects.CSCG._3d.fields.vector.components.helpers.norm import ___VECTOR_NORM_COMPONENT___
from objects.CSCG._3d.fields.vector.components.helpers.T_para import ___VECTOR_T_PARA_COMPONENT___
from objects.CSCG._3d.fields.vector.components... |
#!/usr/local/sci/bin/python
#*****************************
#
# Duplicate Months Check (DMC)
#
#
#************************************************************************
# SVN Info
#$Rev:: 219 $: Revision of last commit
#$Author:: rdunn ... |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import lxml
import re
import logging
import json
import datetime
import os
from hashlib import md5
from copy import deepcopy
from multiprocessing.pool import ThreadPool
from conn import db, RUNNING_LOCAL
from mmi_scrape import get_mmi_gush_json
from mavat_scrape i... |
from __future__ import annotations
from typing import Optional, Union, Tuple, Iterable, List, cast
import numpy as np
from joblib import Parallel, delayed
from sklearn.base import BaseEstimator, ClassifierMixin, clone
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import BaseCrossVali... |
# Copyright 2019 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
# Generated by Django 2.1.15 on 2020-07-24 10:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
import re
import datetime
import typing
from pathlib import Path
import yaml
from pydantic import BaseModel as PydanticBaseModel, validator
from openstates.metadata import lookup
JURISDICTION_RE = re.compile(
r"ocd-jurisdiction/country:us/(state|district|territory):\w\w/(place|county):[a-z_]+/government"
)
ORG_ID_... |
import os
import argparse
parser = argparse.ArgumentParser(description='flags for detect video')
parser.add_argument(
'-dataset_path',
'--dataset_path',
type = str,
required = True
)
args = parser.parse_args()
def generate_txt(path, output):
with open(output,'w') as output:
for... |
"""
The MIT License (MIT)
Copyright (c) Serenity Software, LLC
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, m... |
import pvl
from plio.utils.utils import find_in_dict
def extract_keywords(header, *args):
"""
For a given header, find all of the keys and return an unnested dict.
"""
try:
header = pvl.load(header)
except:
header = pvl.loads(header)
res = {}
# Iterate through all of the re... |
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.stationdata import build_station_list
import matplotlib.pyplot as plt
import datetime
from floodsystem.stationdata import build_station_list,update_water_levels
from floodsystem.station import MonitoringStation
from floodsystem.analysis import po... |
"""Python phone number parsing and formatting library
Examples of use:
>>> import phonenumbers
>>> from phonenumbers.util import prnt # equivalent to Py3k print()
>>> x = phonenumbers.parse("+442083661177", None)
>>> prnt(x)
Country Code: 44 National Number: 2083661177
>>> type(x)
<class 'phonenumbers.phonenumber.Ph... |
"""
Manages the conversation
"""
import os
from mic import Mic
import g2p
from music import *
class MusicMode:
def __init__(self, PERSONA, mic):
self.persona = PERSONA
# self.mic - we're actually going to ignore the mic they passed in
self.music = Music()
# index spotify pla... |
###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cheese.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
"""Project assign all uploads from a prefix shell command definition."""
import click
from gencove.command.common_cli_options import add_options, common_options
from gencove.constants import Credentials, SampleAssignmentStatus
from gencove.utils import enum_as_dict
from .constants import RunPrefixOptionals
from .mai... |
from parsl.providers import LocalProvider
from parsl.channels import LocalChannel
# from parsl.launchers import SimpleLauncher
from parsl.launchers import SingleNodeLauncher
from parsl.config import Config
from parsl.executors import LowLatencyExecutor
config = Config(
executors=[
LowLatencyExecutor(
... |
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
from scipy.integrate import solve_ivp
import numpy as np
from tqdm import tqdm
from scipy.optimize import curve_fit
from functools import partial
import multiprocessing as mp
import pandas... |
# Functions mmd2 and polynomial_kernel are adapted from
# https://github.com/mbinkowski/MMD-GAN/blob/master/gan/compute_scores.py
# Distributed under BSD 3-Clause: https://github.com/mbinkowski/MMD-GAN/blob/master/LICENSE
import numpy as np
import torch
from tqdm import tqdm
from torch_fidelity.helpers import get... |
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.Contest)
|
# encoding=utf-8
# Generated by cpy
# 2013-01-26 21:04:47.984000
import os, sys
from sys import stdin, stdout
from SSDB import SSDB
try:
pass
ssdb = SSDB('127.0.0.1', 8888)
except Exception , e:
pass
print e
sys.exit(0)
print ssdb.request('set', ['test', '123'])
print ssdb.request('get', ['test'])
... |
from django.shortcuts import render
from .models import image
from django.http import HttpResponse
import sys
from django.db.utils import IntegrityError
# 引入我们创建的表单类
from .forms import AddForm
from django.conf import settings
import os
import logging
import json
from . import operate_images_sql
from . import operate_m... |
import matplotlib
matplotlib.use('Agg')
import torch # noqa
import torch.nn as nn # noqa
import torch.optim as optim # noqa
import numpy as np # noqa
import matplotlib.pyplot as plt # noqa
import pandas as pd # noqa
from torchtext import data # noqa
import os # noqa
import inspect # noqa
import sys # noqa
imp... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_kwargs,
compat_str,
compat_urllib_request,
compat_urlparse,
)
from ..utils import (
determine_ext,
extract_attributes,
ExtractorError,
float_or_none,
... |
import torch
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
import os
def get10(batch_size, data_root='./public_dataset/pytorch', train=True, val=True, **kwargs):
data_root = os.path.expanduser(os.path.join(data_root, 'cifar10-data'))
num_workers = kwargs.setdefault('num_w... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^xhr_store/(?P<ractual_code>.+)/$',
views.xhr_store,
name='xhr_store'),
url(r'^xhr_store_text/(?P<ractual_code>.+)/$',
views.xhr_store_text,
name='xhr_store_text'),
... |
# -*- encoding: utf-8 -*-
"""
@Time : 2021/10/31 23:25
@Email : colflip@163.com
"""
import math
import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.nn import Module
class GraphConvolution(Module):
def __init__(self, in_features_dim, out_features_dim, activation=None, bias=True):
... |
# Copyright The OpenTelemetry 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 ... |
"""
Implements a multitask graph-convolutional regression.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "GPL"
import os
import sy... |
# -*- coding:utf-8 -*-
import unittest
import mock
from ..models import PlanPrice
from .. import strings
from .. import constants
class PlanPriceTestCase(unittest.TestCase):
def test_unicode_should_return_title(self):
# setup
model = PlanPrice()
model.is_free = True
# action
... |
# -*- coding: utf-8 -*-
"""Helper script to query parameters."""
import os
import click
from prompt_toolkit import prompt
from pykeen.cli.utils.constants import (
ID_TO_KG_MODEL_MAPPING,
ID_TO_OPTIMIZER_MAPPING,
KG_MODEL_TO_ID_MAPPING,
OPTIMIZER_TO_ID_MAPPING,
)
from pykeen.constants import (
CPU... |
# Copyright 2021 eprbell
#
# 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, soft... |
import random as r
import tts # tts.py
import urllib3
# To disable the error below.
# InsecureRequestWarning: Unverified HTTPS request is being made to host 'translate.google.com'.
# Adding certificate verification is strongly advised.
# See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warn... |
"""
Support for RFXtrx lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.rfxtrx/
"""
import logging
import homeassistant.components.rfxtrx as rfxtrx
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
from homeassistant.componen... |
#!/usr/bin/env python
# Script: sim_zygosity.py
# Author: David Twesigomwe
# Date modified: 15-Dec-2020
# Purpose: This script simulates the zygosity of variants after concatenating 2 haplotype VCF files.
# Usage: python3 sim_zygosity.py in_database.txt > output.txt
import os
import sys
in_file = sys.argv[1]
f = o... |
import warnings
from unicon.plugins.generic import GenericSingleRpConnection, service_implementation as svc
from unicon.plugins.generic.connection_provider import GenericSingleRpConnectionProvider
from unicon.plugins.generic import ServiceList, service_implementation as svc
from . import service_implementation as aci_... |
__all__ = ['isolinux', 'grub', 'xorriso', 'grub', 'disk']
|
# Copyright 2020 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# --------------------------------------------------------
# Copyright (C) 2020 NVIDIA Corporation. All rights reserved.
# Nvidia Source Code License-NC
# --------------------------------------------------------
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import defaultdict
... |
# 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 u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.