text stringlengths 2 999k |
|---|
# coding: utf-8
import pprint
import re
import six
class KeystoneAssociateGroupWithProjectPermissionRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
"""
Exactly equals to Model21 (the best results so far), but differnt configurations.
Exactly based on Model10, but ReLU to GeLU
Based on Model8, add dropout and max, avg combine.
Based on Local model, add residual connections.
The extraction is doubled for depth.
Learning Point Cloud with Progressively Local represen... |
import os
import sys
from SBI.structure import PDB
from default_config.masif_opts import masif_opts
print(masif_opts["ligand"]["assembly_dir"])
if not os.path.exists(masif_opts["ligand"]["assembly_dir"]):
os.mkdir(masif_opts["ligand"]["assembly_dir"])
def assemble(pdb_id):
# Reads and builds the biological as... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU'])
Monomer('BaxM', ['BidM', 'BaxA'])
Monomer('Apop', ['C3pro', 'X... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
"""
Empatica E4 is a wearable device that offers real-time physiological data
acquisition such as blood volume pulse, electrodermal activity (EDA), heart
rate, interbeat intervals, 3-axis acceleration and skin temperature.
"""
import os
import random
import numpy as np
import pandas as pd
class EmpaticaReader:
... |
import pandas as pd
from typing import Tuple
from .data_processing import UNKNOWN_ID_REGEX
from .utils import calcDeltas
__all__ = [
"filterKnownOrbits",
"filterOrbits"
]
def filterKnownOrbits(
orbits: pd.DataFrame,
orbit_observations: pd.DataFrame,
associations: pd.DataFrame,
... |
import Archi
import yaml
def test_model_loading():
try:
config = yaml.safe_load(
open("./esbn_model_test_config.yaml", 'r'),
)
except yaml.YANNLError as e:
print(e)
from Archi import load_model
model = load_model(config)
assert 'KeyValueMemory' in model.... |
#
# 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... |
# -*- coding: utf-8 -*-
import urlparse
from nose.tools import * # flake8: noqa
from tests.base import ApiTestCase
from tests.factories import AuthUserFactory
from api.base.settings.defaults import API_BASE
class TestUsers(ApiTestCase):
def setUp(self):
super(TestUsers, self).setUp()
self.user... |
from muteria.drivers.testgeneration.testcase_formats.python_unittest.unittest\
import * |
#!/usr/bin/python
"""
--------------------------------------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2016 William Yang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (th... |
import unittest
from pytorch_metric_learning.utils import accuracy_calculator
import numpy as np
class TestCalculateAccuracies(unittest.TestCase):
def test_accuracy_calculator(self):
query_labels = np.array([1, 1, 2, 3, 4])
knn_labels1 = np.array(
[
[0, 1, 1... |
# 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 the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Owner(s): ["oncall: fx"]
import builtins
import contextlib
import copy
import functools
import inspect
import math
import numbers
import operator
import os
import pickle
import sys
import torch
import traceback
import typing
import types
import warnings
import unittest
from math import sqrt
from torch.multiprocessin... |
# See LICENSE for licensing information.
#
# Copyright (c) 2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
from policy import replacement_policy as rp
from glob... |
# coding: utf-8
# maposmatic, the web front-end of the MapOSMatic city map generation system
# Copyright (C) 2009 David Decotigny
# Copyright (C) 2009 Frédéric Lehobey
# Copyright (C) 2009 David Mentré
# Copyright (C) 2009 Maxime Petazzoni
# Copyright (C) 2009 Thomas Petazzoni
# Copyright (C) 2009 Gaël Utard
# ... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
# -*- coding: utf-8 -*-
# Scrapy settings for amazon_scraper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/lates... |
import numpy
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer.functions.pooling import pooling_2d
from chainer.utils import conv
class AveragePooling2D(pooling_2d.Pooling2D):
"""Average pooling over a set of 2d planes."""
# TODO(beam2d): Support cover_all mode.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/12/5 19:35
# @Author : cendeavor
# @File : forms.py
# @Software: PyCharm
from flask_wtf import Form, FlaskForm
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import Required, DataRequired, EqualTo
class NameForm(... |
from __future__ import division
from tkinter import *
import tkMessageBox
from PIL import Image, ImageTk
import os
import glob
import random
w0 = 1 #图片原始宽度
h0 = 1 #图片原始高度
# colors for the bboxes
COLORS = ['red','blue','yellow','pink','cyan','green','black']
#image size
SIZE = 256,256
#指定缩放后的图像大小
DEST_SIZE = 500,50... |
# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
`adafruit_pyportal.network`
================================================================================
CircuitPython driver for Adafruit PyPortal.
* Author(s): Limor Fried, Kevin J... |
import logging
import pandas as pd
from ast import literal_eval
from .constants import NUMBERING_RESULTS
from sadie.numbering.scheme_numbering import scheme_numbering
logger = logging.getLogger("NUMBERING")
class NumberingResults(pd.DataFrame):
def __init__(self, *args, scheme="", region_definition="", allowed_... |
# -*- coding: utf-8 -*-
# pylint: disable=no-member
"""
This file contains tests with base functionality.
"""
def test_merge(merged):
"""
Test that all values from settings are present.
"""
assert hasattr(merged, 'SECRET_KEY')
assert hasattr(merged, 'STATIC_ROOT')
def test_override(merged, mon... |
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "share-34244.botics.co"
site_params = {
"name": "SHARE",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_or_create(defau... |
"""
Django settings for do_it_django_prj project.
Generated by 'django-admin startproject' using Django 3.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
impo... |
import logging
import datetime
import os
def config_logs():
# Logfile
logfolder = "logs/"
logdate = datetime.datetime.now().strftime("%y-%m-%d_%H:%M") + "_"
logfile = "aerodust.log"
logpath = logfolder + logfile
#logpath = logfolder + logdate + logfile
if not os.path.exists(logfolder):
... |
# Run with Python 3
# Copyright 2019 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
"""\
HTTP server that can be used as a back end to Captive Web View applications.
The server is based around a Python3 Simple HTTP Server extended to pick files
from one of a number of directories.
The server will change direc... |
import sys
from quadrotor_env import quad, render, animation
import numpy as np
import torch
import torch.nn as nn
from torch.distributions import MultivariateNormal
import numpy as np
from quadrotor_env import quad, render, animation
from model import ActorCritic
"""
MECHANICAL ENGINEERING POST-GRADUATE PROGRAM
UNIVE... |
from flask import Flask, escape, request
from flask import send_file
from Graph.plot import Plot
app = Flask(__name__)
@app.route('/', methods=["POST"])
def hello():
print(request.method)
req_data= request.get_json()
print(req_data)
name = request.args.get("name", "World")
return f'Hello, {escape(name)... |
DUMMY_MENU_ID = 999999
DUMMY_MENU_SLUG = 'SLUGGOESHERE'
|
# Copyright 2021 The HuggingFace Team. 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 applicabl... |
import os
def require(file, *args):
with open(os.path.join(os.path.dirname(file), *args), "r") as fh:
source = fh.read()
return source
|
# Copyright 2020 Google Research. 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... |
"""Module for Testing the Meetup Endpoint."""
import json
# Local Import
from .basecase import TestBaseCase as base
class TestMeetup(base):
"""Testing the Meetup Endpoints with valid input."""
def setUp(self):
base.setUp(self)
def test_create_meetup(self):
"""Testing Creation of a Meetu... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""YOLO_v3 ResNet50 Model Defined in Keras."""
from tensorflow.keras.layers import UpSampling2D, Concatenate
from tensorflow.keras.models import Model
from tensorflow.keras.applications.resnet import ResNet50
from yolo3.models.layers import yolo3_predictions, yol... |
"""
AWR + SAC from demo experiment
"""
from railrl.demos.source.dict_to_mdp_path_loader import DictToMDPPathLoader
from railrl.demos.source.mdp_path_loader import MDPPathLoader
from railrl.launchers.experiments.ashvin.awr_sac_rl import experiment
import railrl.misc.hyperparameter as hyp
from railrl.launchers.arglaunc... |
import numpy as np
from math import *
import pymultinest
import sys
sys.path.insert(0, '/home/kochenma/pysb')
from pysb.integrate import Solver
import csv
import datetime
import time as tm
from model_778 import model
from pysb.pathfinder import set_path
set_path('bng', '/home/kochenma/BioNetGen')
data_object = []
wi... |
#!/usr/bin/env python3
# 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 copy
import os
import random
import re
from collections import defaultdict
from typing import List, Optional, Dic... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-05-19 15:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('areas', '0001_initial'),
... |
#! /user/bin/env python
# _*_ coding: utf-8 _*_
# __author__ = "王顶"
# Email: 408542507@qq.com
"""
循环切片实现
需求总是改变,一会是4层金字塔,一会儿是5层金子塔
到底要几层,改一下 while 循环的条件变量就行了
"""
level = 0
line = ''
stars = '*******************************************'
spaces = ' '
while level < 4:
n ... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# coding: utf-8
import pprint
import re
import six
class UpdateApplicationEndpointRequestBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... |
#!opt/python-3.6/bin/python3
import unittest
import sys
sys.path.append("../src")
from info_ordering import order_info
class TestInfoOrdering(unittest.TestCase):
def test_order_info(self):
# TODO: fix to actually test
value = 5
self.assertEqual(value, 5)
if __name__ == '__main__':
uni... |
"""Semantic analysis of TypedDict definitions."""
from mypy.backports import OrderedDict
from typing import Optional, List, Set, Tuple
from typing_extensions import Final
from mypy.types import Type, AnyType, TypeOfAny, TypedDictType, TPDICT_NAMES
from mypy.nodes import (
CallExpr, TypedDictExpr, Expression, Name... |
from bs4 import BeautifulSoup
import requests
import os
class App:
def __init__(self):
self.userlist = []
self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"}
self.page = 1
... |
"""
Diagnostic:
Diagnostic to produce images of the profile over time from a cube.
These plost show cube value (ie temperature) on the x-axis, and depth/height
on the y axis. The colour scale is the annual mean of the cube data.
Note that this diagnostic assumes that the preprocessors do the bulk of the
hard work, an... |
import unittest
import blitzml
import numpy as np
from common import captured_output
class TestProblemOptions(unittest.TestCase):
def setUp(self):
A = np.arange(20).reshape(5, 4)
b = np.arange(5).astype(np.float64)
self.prob = blitzml.LassoProblem(A, b)
def tearDown(self):
del self.prob
def te... |
import nltk
from langdetect import detect
import csv
class Tokenize:
""" Text tokenizer """
def __init__(self):
""" Default constructor """
self.language = "en"
self.workDirectory = "/run/media/jf/Datos/Tourist Text Mining/datasets/colombia_en/"
self.tagFilename = "t... |
#! /usr/bin/python
from molmod.units import *
from yaff import *
import h5py, numpy as np
#Setting up system and force field
system = System.from_file('system.chk')
ff = ForceField.generate(system, 'pars.txt', rcut=15.0*angstrom, alpha_scale=3.2, gcut_scale=1.5, smooth_ei=True)
#Setting up output
f = h5py.File('outp... |
import os
import numpy as np
import pandas as pd
os.environ['MKL_THREADING_LAYER'] = 'GNU'
# df = pd.DataFrame(columns=['multiprune', 'headstr', 'pluslayer', 'plushead', 'acc1'])
# df.to_csv("multiprune_plusone.csv",index=False)
prevheadlist = [set([7]),set([11]),set([0]),set([7]),set([9]),set([9])]
plusheadlist = [s... |
import wx
from .misc.helpers import deg_to_rad, rad_to_deg
from .misc.vector import Vector
# Size of the turtle canvas. We assume no user will have a screen
# so big that the canvas will be bigger than this.
BITMAP_SIZE = Vector((2000, 1200))
# Center of the canvas.
origin = BITMAP_SIZE / 2.0
def to_my_angle(angle... |
import click
from cmsis_svd.parser import SVDParser
MCU_OPTIONS = [
'STM32F0xx',
]
MCU2VENDOR_FILE = {
'STM32F0xx': ('STMicro', 'STM32F0xx.svd'),
}
ALL = 'show_all'
def show_register(register):
fields = []
for field in register.fields:
upper_index = field.bit_offset + field.bit_width - 1
... |
from mycv.utils.general import disable_multithreads
disable_multithreads()
import os
from pathlib import Path
import argparse
from tqdm import tqdm
import math
import torch
import torch.cuda.amp as amp
from torch.optim.lr_scheduler import LambdaLR
from torch.nn.parallel import DistributedDataParallel as DDP
import wand... |
"""
Base settings to build other settings files upon.
"""
from pathlib import Path
import environ
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
# smcrm/
APPS_DIR = ROOT_DIR / "smcrm"
env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if READ_DOT_ENV_FILE... |
# -*- coding: utf-8 -*-
"""
获取YCY图片
"""
import json
import os
import requests
from settings import PROJECT_PATH
class YCYImage(object):
def __init__(self):
self.headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
import copy
from io import StringIO
import os
import sys
import traceback
from dace.sdfg import SDFG
from dace.transformation.optimizer import Optimizer
class TransformationTester(Optimizer):
""" An SDFG optimizer that consecutively appl... |
import pygame
from snake.resources.constants import BLOCK_SIZE, WIDTH, HEIGHT
from snake.resources.directions import Direction
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
self.f = 0
self.g = 0
self.h = 0
self.neighbors = []
self.origin = Non... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generating a 4D synthetic data set with noise.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A 2D space, time and frequency data set is generated for testing purposes in
reda.
"""
###############################################################################
# import... |
# -*- coding: utf-8 -*-
from model.contact import Contact
def test_add_contact(app, json_contacts, db, check_ui):
contact=json_contacts
app.open_home_page()
old_contacts = db.get_contact_list()
app.contact.create(contact)
assert len(old_contacts) + 1 == app.contact.count()
new_contacts = db.g... |
# author: Carlina Kim, Karanpal Singh, Sukriti Trehan, Victor Cuspinera
# date: 2020-06-21
'''This script will read the saved theme/subtheme model(s), padded validation sets and y validation sets for model evaluation,
and will save the evaluation results in the specified directory.
There are 2 parameters Input Path ... |
"""Learn embedding weights with LBANN."""
import argparse
import os.path
import numpy as np
import lbann
import lbann.contrib.launcher
import lbann.contrib.args
import data.data_readers
import model.random_projection
import utils
import utils.graph
import utils.snap
root_dir = os.path.dirname(os.path.realpath(__file... |
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import os.path as path
from bes.fs.file_util import file_util
from bes.fs.temp_file import temp_file
from bes.testing.unit_test import unit_test
from bes.testing.framework import unit_test_inspect as UTI
fr... |
import json
from vcx.api.connection import Connection
from utils import init_vcx, run_coroutine_in_new_loop
from connection import BaseConnection
class Inviter(BaseConnection):
async def start(self):
await init_vcx()
print("Create a connection to alice and print out the invite details")
c... |
###################################################################
import logging
import tornado.escape
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.websocket
import os.path
import uuid
from os import environ
import json
from tornado.options import define, options
import mimetypes
... |
# Copyright 2017 Huawei Technologies Co.,LTD.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
import collections
import io
from typing import BinaryIO, Tuple, Union
import warnings
import numpy
import skimage.io
import skimage.measure
import skimage.morphology
import skimage.segmentation
import skimage.transform
from .base import BaseSegmentationHelper
class ScikitSegmentationHelper(BaseSegmentationHelper):... |
import math
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init,
kaiming_init)
from mmcv.runner import load_checkpoint
from torch.nn.modules.batchnorm import _BatchNorm
from mmdet.utils import ge... |
from HDPython.ast.ast_classes.ast_base import v_ast_base, add_class
import HDPython.hdl_converter as hdl
from HDPython.ast.ast_hdl_error import HDPython_error
from HDPython.base import HDPython_base
class v_re_assigne_rhsift(v_ast_base):
def __init__(self,lhs, rhs,context=None, astParser=None):
self.lhs ... |
import pytest
import pathlib
import os
import subprocess
import tempfile
from kopf.testing import KopfRunner
from dask_kubernetes.common.utils import check_dependency
DIR = pathlib.Path(__file__).parent.absolute()
check_dependency("helm")
check_dependency("kubectl")
check_dependency("docker")
@pytest.fixture()
a... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
from confluent_kafka import Consumer, KafkaException, KafkaError
import sys
import logging
from pprint import pformat
def print_assignment(consumer, partitions):
print('Assignment:', partitions)
if __name__ == '__main__':
conf = {
'bootstrap.servers': 'localhost:9092',
'group.id': 'de... |
"""Central data class and associated."""
# --- import --------------------------------------------------------------------------------------
import collections
import operator
import functools
import warnings
import numpy as np
import h5py
import scipy
from scipy.interpolate import griddata, interp1d
from .._gr... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/env python
# encoding: utf-8
from distutils.core import setup
setup(name='project_package_name',
version='0.1',
description = 'project description',
author = '...',
packages = ['project_package_name'],
)
|
STEVILO_DOVOLJENIH_NAPAK = 10
PRAVILNA_CRKA = '+'
PONOVLJENA_CRKA = 'o'
NAPACNA_CRKA = '-'
ZMAGA = 'W'
PORAZ = 'X'
class Igra:
def __init__(self, geslo, crke):
self.geslo = geslo
self.crke = crke[:]
def napacne_crke(self):
return [crka for crka in self.crke if crka not in self.gesl... |
#!/usr/bin/env python
# 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... |
from django.urls import path
from . import views
app_name = 'basketapp'
urlpatterns = [
path('', views.view, name='view'),
path('add/<int:product_id>/', views.add, name='add'),
path('remove/<int:basket_item_id>)/', views.remove, name='remove'),
path('edit/<int:basket_item_id>/<int:quantity>/', views.edit,... |
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
for (x_t,y_t) in data_set:
loss_fn = f(w, x_t, y_t)
# compute gradient
d_loss_fn_wrt_w = ...
w -= gamma * d_loss_fn_wrt_w
if <stopping condition is met>:
return w
|
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2012-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
import pytest
import brownie
from brownie import Contract, ZERO_ADDRESS
# gusd
gusd_token_address = "0xD2967f45c4f384DEEa880F807Be904762a3DeA07"
gusd_gauge_addresses = "0xC5cfaDA84E902aD92DD40194f0883ad49639b023"
# susd
susd_token_address = '0xC25a3A3b969415c80451098fa907EC722572917F'
susd_gauge_address = '0xA9099689... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (c) 2013 Qin Xuye <qin@qinxuye.me>
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... |
from decimal import Decimal
from django.db.models import Sum
from django.shortcuts import get_object_or_404
from datetime import date, timedelta
from .models import Task
class TaskRepository:
"""Repository for tasks."""
def list(self):
return Task.objects.all()
def create(self, title: str, descr... |
# 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
from... |
from urllib.parse import urlsplit, urlunsplit
import pytest
import requests
_KUMA_STATUS = None
def pytest_configure(config):
"""Configure pytest for the Kuma deployment under test."""
global _KUMA_STATUS
# The pytest-base-url plugin adds --base-url, and sets the default from
# environment variab... |
from django.urls import path
from . import views
urlpatterns = [
]
|
#!/usr/bin/env python3
# Copyright (c) 2017 The Catcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for setting nMinimumChainWork on command line.
Nodes don't consider themselves out of "initial b... |
# given a string check if its palindromePermutation
def solution(s):
s = s.replace(' ','')
if len(s) == 0 or len (s) == 1:
return True
if len(s) == 2:
return s[0] == s[1]
hashTable = [0] * 128
for i in xrange(0,len(s)):
tmp = ord(s[i])
if hashTable[tmp] ... |
import time
import re
import random
import requests
from urllib import parse
import qq_init as qq
import pymongo
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
class Spider(object):
def __init__(self):
'''
初始化
'''
chrome_options... |
import typing
import netmiko
import napalm_digineo_procurve.queries.interfaces
import napalm_digineo_procurve.queries.lldp_neighbors
import napalm_digineo_procurve.queries.device_info
import napalm_digineo_procurve.queries.system_info
import napalm_digineo_procurve.queries.uptime
def get_uptime(device: netmiko.Base... |
import os
import cvb
print("acquire images from CVMock.vin")
device = cvb.DeviceFactory.open("/opt/cvb/drivers/CVMock.vin")
stream = device.stream
stream.start()
for i in range(5):
image, status = stream.wait()
if status == cvb.WaitStatus.Ok:
image_file = os.path.join(".", ".cvb", "test" + str(i) + ... |
import torch.nn.functional as F
from SparseTensor import SparseTensor
def relu(input):
output = F.relu(input.F)
return SparseTensor(
output, coords_key=input.coords_key, coords_manager=input.coords_man)
|
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
if not email:
raise ValueError('User must have an email address')
... |
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
"""Network architectures used in the StyleGAN2 paper."""
import numpy as np
import tensorfl... |
# Copyright 2019 Contributors to Hyperledger Sawtooth
#
# 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 logging
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import send_mail
from c3nav.celery import app
logger = logging.getLogger('c3nav')
@app.task(bind=True, max_retries=3)
def send_changeset_proposed_notification(self, pk, author, title, description):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.