text stringlengths 2 999k |
|---|
import tensorflow as tf
from tensorflow.keras import layers, activations, initializers, regularizers, constraints
from tensorflow.keras.mixed_precision import global_policy
from core.module import Module
from nn.registry import rnn_registry
from nn.typing import GRUState
from utility.tf_utils import assert_rank
rnn_... |
"""
Discrete Fourier Transforms
Routines in this module:
fft(a, n=None, axis=-1, norm="backward")
ifft(a, n=None, axis=-1, norm="backward")
rfft(a, n=None, axis=-1, norm="backward")
irfft(a, n=None, axis=-1, norm="backward")
hfft(a, n=None, axis=-1, norm="backward")
ihfft(a, n=None, axis=-1, norm="backward"... |
# -*- coding: utf-8 -*-
#
# 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... |
# -*- coding:utf-8 -*-
"""
交易数据接口
Created on 2014/07/31
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
from __future__ import division
import time
import json
import lxml.html
from lxml import etree
import pandas as pd
import numpy as np
from tushare.stock import cons as ct
import... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... |
import .ast
import .brave |
import libvirt, xmltodict, json, random, uuid
import logging
from libvirt import *
from virtapi.controller.host_ctrl import VirtHost
from virtapi.model.template import Templates
from virtapi.model.plan import Plans
from virtapi.model.host import Hosts
from virtapi import settings
from virtapi.utilities import create_c... |
_base_ = [
'../_base_/models/gcnet_r50-d8.py',
'../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_80k.py'
]
model = dict(
decode_head=dict(align_corners=True),
auxiliary_head=dict(align_corners=True),
test_cfg=dict(mode='slide', crop... |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... |
"""Train GAIL or AIRL.
Can be used as a CLI script, or the `train_and_plot` function can be called directly.
"""
import logging
import os
import os.path as osp
from typing import Mapping, Optional
import torch as th
from sacred.observers import FileStorageObserver
from imitation.algorithms import adversarial
from i... |
# based on https://github.com/dawenl/vae_cf
import os
import sys
import numpy as np
from scipy import sparse
import pandas as pd
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str)
parser.add_argument('--output_dir', type=str)
parser.add_argument('--threshold', type=float)
... |
from .mixin import BaseModelMixin
|
# coding: utf-8
"""
No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.1.1+01d50e5
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you m... |
"""
sentry.web.frontend.projects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django... |
import scrapy
class QuotesSpider(scrapy.Spider):
name = 'quotes'
allowed_domains = ['quotes.toscrape.com']
start_urls = ['http://quotes.toscrape.com/']
def parse(self, response):
quotes = response.xpath('//*[@class="quote"]')
for quote in quotes:
text = quote.xpath('//*[@i... |
""" Profile serializer """
# Django RESt Framework
from rest_framework import serializers
# Models
from cride.users.models import Profile
class ProfileModelSerializer(serializers.ModelSerializer):
""" Profile model Serializer """
class Meta:
""" Meta Class """
model = Profile
fields... |
from pick import pick
class Options(object):
__title = 'Please select all package options which you want carcass to generate'
__options = ['Logger', 'Exceptions', 'Microsoft Graph OAuth2', 'Flask App']
def pick(self):
option = pick(self.__options, self.__title, multi_select=True)
return o... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, \
BaseUserManager, PermissionsMixin
from django.conf import settings
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
""" Creat... |
# coding: utf-8
from . import agent, data, svet, veci, vypocty
class Hráč:
def __init__(self):
self.inventář = [getattr(veci, název_třídy)(*parametry)
for název_třídy, parametry in data.počáteční_inventář]
self.artefakty = []
self.svět = svet.Svět()
self.x, ... |
""" the main ui renderer
"""
# pylint: disable=too-many-lines
import curses
import json
import logging
import re
from collections.abc import Mapping
from curses import ascii as curses_ascii
from functools import lru_cache
from math import ceil
from math import floor
from typing import Any
from typing import Callab... |
# -*- coding: utf-8 -*-
#
# Foobar documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 11 10:37:39 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
import pathlib
from bdflib import reader
def read_bdf_font(font_filename):
font_path = pathlib.Path(__file__).parents[0] / font_filename
with font_path.open("rb") as f:
return reader.read_bdf(f)
class BoardTextException(Exception):
pass
class BoardText:
def __init__(self, font, colour_map... |
def setup():
size(500, 500)
smooth()
background(0)
strokeWeight(1)
i = 205
k = 1
flug = 1
def draw ():
global i, k, flug
stroke(i, 20)
if (flug == 1):
line(mouseX , mouseY , 500, random(0,500))
else:
line(mouseX , mouseY , 0, random(0,500))
i = i + k... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
from ..core.variable import Variable
from ..core.pycompat import OrderedDict
from .common import AbstractWritableDataStore
class InMemoryDataStore(AbstractWritableDataStore):
... |
"""
Helpers to construct maps in altair of local authorities
"""
import json
from functools import lru_cache
from pathlib import Path
import altair as alt
import geopandas
from notebook_helper import *
from . import la
pd.options.mode.chained_assignment = None
top_level = Path(__file__).parent.parent
lower_tier = ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# 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 ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-26 17:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('utils', '0001_initial'),
('fms'... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# by http://acm.hdu.edu.cn/showproblem.php?pid=1248
def bestPlan(price):
t = 9
n = 3
dp = []
alist = [150, 200, 350]
while (--t and t > 0):
sum = 0
for i in range(3):
for j in range(alist[i], n):
dp[j] = max(d... |
import unittest
from robot.utils.asserts import assert_equals, assert_raises_with_msg,\
assert_true, assert_false
from robot import utils
from robot.errors import DataError
from robot.common.model import BaseTestSuite, BaseTestCase, _Critical
def _get_suite():
suite = BaseTestSuite('Root')
suite.suites =... |
# change environment
import sys
sys.path.insert(1, '/ifs/home/pw801/bin/python')
# load modules
import pandas as pd
import numpy as np
import scipy
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.metrics import roc_auc_score, precision_score, recall_score, f1_score
from skl... |
"""
@file
@brief Various function to clean the code.
"""
import os
def remove_extra_spaces_and_pep8(filename, apply_pep8=True, aggressive=False, is_string=None):
"""
Removes extra spaces in a filename, replaces the file in place.
@param filename file name or string (but it assumes it is pytho... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, overload
from .. import... |
#
# 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
# distributed under ... |
from .._common import BaseResult
__all__ = [
"sample",
]
_sampler_map = {}
class SampleResult(BaseResult):
"""
Represent the sampling result.
Attributes
----------
x : array_like
The best solution sampled.
fun : scalar
The solution function value.
nit : int
... |
#!/usr/bin/env python
"""Runs over a directory tree searching for supported image files. Resizes any
images larger than the required width and height.
"""
import os
import re
from shutil import copyfile
from argparse import ArgumentParser
from PIL import Image
DEFAULT_WIDTH = 1024
DEFAULT_HEIGHT = 1024
DEFAULT_MAX_... |
import warnings
from . import codegen, SchemaBase, Undefined
def schemaclass(*args, init_func=True, docstring=True, property_map=True):
"""A decorator to add boilerplate to a schema class
This will read the _json_schema attribute of a SchemaBase class, and add
one or all of three attributes/methods, base... |
import powershift.resources as resources
dc = resources.load()
dc.spec.replicas = 3
resources.dump(dc, indent=4, sort_keys=True)
|
"""Define layers related to the Google's Transformer model."""
import tensorflow as tf
from opennmt.layers import common
from opennmt.utils import compat
def tile_sequence_length(sequence_length, num_heads):
"""Tiles lengths :obj:`num_heads` times.
Args:
sequence_length: The sequence length.
num_heads:... |
import json
import nltk
import tweepy
def read_params():
'''
Helper function to read param.json file
Output :
params : params dictionary
'''
with open("auth_params.json") as f:
params = json.loads(f.read())
return params
def get_scores(g_list, tf_dict):
ss = []... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyUhi(PythonPackage):
"""Unified Histogram Interface:
tools to help library authors... |
import dash
import dash_bootstrap_components as dbc
FA = "https://use.fontawesome.com/releases/v5.12.1/css/all.css"
app = dash.Dash(__name__,
external_stylesheets=[dbc.themes.BOOTSTRAP, FA],
update_title=None,
suppress_callback_exceptions=True)
|
# make with baudi SDK
import requests
import pyaudio
import wave
import base64
import json
import win32api
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 8000
RECORD_SECONDS = 3
WAVE_OUTPUT_FILENAME = "out.wav"
def make_audio():
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT... |
#!/usr/bin/env python3
"""
This module defines a class that represents a C/C++ project and that contains methods for interfacing with its vulnerabilities and source files.
"""
import glob
import json
import os
import random
import re
import sys
from collections import defaultdict, namedtuple
from typing import Calla... |
'''
Backend KivyAgg
=====
.. image:: images/backend_agg_example.jpg
:align: right
The :class:`FigureCanvasKivyAgg` widget is used to create a matplotlib graph.
The render will cover the whole are of the widget unless something different is
specified using a :meth:`blit`.
When you are creating a FigureCanvasKivyAg... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2021/3/26 下午4:10
# @Author : MaybeShewill-CV
# @Site : https://github.com/MaybeShewill-CV/image-classification-tensorflow
# @File : freeze_model.py
# @IDE: PyCharm
"""
freeze ckpt model file into pb model
"""
import os.path as ops
import argparse
impor... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2019 Alexander L. Hayes (@hayesall)
#
# 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... |
"""
WSGI config for kickstarter_django project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("... |
# -*- coding: utf-8 -*-
#
# SelfTest/Cipher/ARC2.py: Self-test for the Alleged-RC2 cipher
#
# =======================================================================
# Copyright (C) 2008 Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this... |
import argparse
import pickle
from src.utils import Parameters
from src.experiment import Experiment
from src.logging import logger
from src.trainer import Trainer
from train import train
def get_parser():
parser = argparse.ArgumentParser(description='Tests whether the code *runs* various combinations of the set... |
# Copyright (c) 2017-2021 Neogeo-Technologies.
# 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... |
import numpy as np
from scipy.signal import get_window
from scipy.fftpack import fft
import sys, os, math
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../software/models/'))
import dftModel as DFT
import utilFunctions as UF
import harmonicModel as HM
import matplotlib.pyplot as plt
## ... |
#!/usr/bin/env python3
import asyncio
from mavsdk import System
from mavsdk import (OffboardError, VelocityNedYaw)
async def run():
""" Does Offboard control using velocity NED coordinates. """
drone = System()
await drone.connect(system_address="udp://:14540")
print("Waiting for drone to connect... |
from PyQt4 import QtGui
from PyQt4.QtGui import QDialog, QVBoxLayout, QTextEdit
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
from matplotlib.figure import Figure
class ClusteringConfig(QDial... |
# Paprika Sync documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that... |
# Copyright (C) 2016 by VLAM3D Software inc. https://www.vlam3d.com
# This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
from __future__ import print_function
import argparse
import vulkanmitts as vk
import numpy as np
from cube_data import *
from vkcontextmanager import vkreleasing,... |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... |
from lxml import html
import requests
page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
tree = html.fromstring(page.content)
#This will create a list of buyers:
buyers = tree.xpath('//div[@title="buyer-name"]/text()')
#This will create a list of prices
prices = tree.xpath('//span[@class="item-price"... |
from hipo_rank.dataset_iterators.pubmed import PubmedDataset
from hipo_rank.embedders.bert import BertEmbedder
from hipo_rank.embedders.rand import RandEmbedder
from hipo_rank.embedders.sent_transformers import SentTransformersEmbedder
from hipo_rank.similarities.cos import CosSimilarity
from hipo_rank.directions.ed... |
#!/usr/bin/env python3
import contextlib
import os
@contextlib.contextmanager
def working_directory(path):
"""A context manager which changes the working directory to the given
path, and then changes it back to its previous value on exit.
"""
prev_cwd = os.getcwd()
os.chdir(path)
try:
... |
"""This module contains exceptions defined for Hermes Audio Server."""
class HermesAudioServerError(Exception):
"""Base class for exceptions raised by Hermes Audio Server code.
By catching this exception type, you catch all exceptions that are
defined by the Hermes Audio Server code."""
class Configura... |
#!/usr/bin/env python
# DESCRIBE NODE PY
#
import argparse, json
parser = argparse.ArgumentParser()
parser.add_argument('plan', type=str, help='Plan data file')
parser.add_argument('node', type=str, help='The node e.g. "1.2.3"')
args = parser.parse_args()
try:
with open(args.plan) as fp:
J = json.load(f... |
#!/usr/bin/env python
"""
http://googleresearch.blogspot.com/2012/05/from-words-to-concepts-and-back.html
This script loads data from the inv.dict file into mongo:
http://www-nlp.stanford.edu/pubs/crosswikis-data.tar.bz2/inv.dict.bz2
Here's an example inv.dict line:
Maine 0.461444 Maine W:22581/41237 Wx:13813/46... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
import sched, time
from text.text_filter import *
from visual.inpainting import *
from visual.template_matching import *
from visual.darken import *
from visual.video_obscenity import *
from PIL import Image
def run(image_in = '../relay/img/scre... |
idade = int(input("Qual a sua idade? "))
if idade >= 18:
print("Você é maior de idade.")
print("outra coisa")
else:
print("Você é menor de idade.")
if idade < 18:
print("Você é criança.")
elif idade >=18 and idade <= 65:
print("Você é adulto.")
else:
print("Você é idoso.") |
##################################################################################
#
# apogee.tools.path: return the path of various APOGEE data files
#
# This file depends on various environment variables that should be set:
#
# - SDSS_LOCAL_SAS_MIRROR: top-level directory with data
# - RES... |
import numpy as np
import matplotlib.pylab as plt
def sigmoid(x):
return 1/(1 + np.exp(-x))
x = np.arange(-5.0, 5.0 , 0.1)
y = sigmoid(x)
plt.plot(x, y)
plt.ylim(-0.1, 1.1)
plt.show()
|
from typing import Any, Dict
import mock
import pytest
from django.contrib.auth.hashers import is_password_usable
from django.contrib.auth.models import Group, UserManager
from django.contrib.auth import get_user_model
from django_saml2_auth.exceptions import SAMLAuthError
from django_saml2_auth.user import (create_jw... |
from __future__ import unicode_literals
from django.shortcuts import redirect
from .. import BasicProvider, RedirectNeeded
from .forms import PaymentForm
class StripeProvider(BasicProvider):
def __init__(self, *args, **kwargs):
self.secret_key = kwargs.pop('secret_key')
self.public_key = kwargs... |
from setuptools import find_packages, setup
setup(
name='robot_1418',
version='1.0.0',
packages=['entry_points'],
package_dir={'': 'src'},
install_requires=['pybind11', 'robotpy-pathfinder'],
entry_points={
'robotpy': [
'generate=entry_points.trajectory_generator:TrajectoryGen... |
import pytest
from gi.repository import Gtk
from gaphas.canvas import Canvas
from gaphas.item import Element, Line
from gaphas.view import GtkView
class Box(Element):
def draw(self, context):
cr = context.cairo
top_left = self.handles()[0].pos
cr.rectangle(top_left.x, top_left.y, self.wid... |
from __future__ import print_function
import open3d
import torch.utils.data as data
from PIL import Image
import os
import os.path
import errno
import torch
import json
import codecs
import numpy as np
import progressbar
import sys
import torchvision.transforms as transforms
import argparse
import json
from provider im... |
import pandas as pd
# Now we'll learn about binning
years = [1990, 1991, 1992, 2008, 2012, 2015, 1987, 1969, 2013, 2008, 1999]
# We can seperate these years by decade
decade_bins = [1960, 1970, 1980, 1990, 2000, 2010, 2020]
# Now we'll use cut to get somethign called a Category object
decade_cat = pd.cut(years, dec... |
import numpy as np
from setuptools import setup
from setuptools import find_packages
VERSION = '0.25.0'
AUTHORS = 'Matthew Bourque, Lauren Chambers, Misty Cracraft, Mike Engesser, Mees Fix, Joe Filippazzo, Bryan Hilbert, '
AUTHORS += 'Graham Kanarek, Teagan King, Catherine Martlin, Maria Pena-Guerrero, Johannes Sahlm... |
# 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... |
from turtle import *
bgcolor('black')
color('blue')
speed(11)
right(45)
for i in range(150):
circle(30)
if 7<i<62:
left(5)
if 80<i<133:
right(5)
if i<80:
forward(10)
else:
forward(5) |
class Calls(object):
def __init__(self):
self.calls = []
def addCall(self, call):
self.calls.append(call)
def endCall(self, call):
for c in self.calls:
if call.ID == c.ID:
self.calls.remove(call)
def searchCall(self, call_id):
for c in self.... |
# --------------------------------------------------------------------------
# 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 cause incor... |
# ! /usr/bin/python3
"""### Provide tools for generating settlements in Minecraft.
This package works in conjunction with the GDMC HTTP Interface mod.
Examples and tests are available but not to be imported.
See README.md for more information.
"""
import bitarray
import direct_interface
import interfaceUtils
import lo... |
import unittest
import craynn
from craynn.viz import draw_to_file
from craynn.layers import *
from craynn.subnetworks import *
from craynn.networks import *
from lasagne import *
class TestRepeat(unittest.TestCase):
def test_net(self):
nn = net((None, 1, 128, 128))(
repeat(8)(conv(4))
)
print(
... |
from typing import Any, Dict, List, Union
from gdsfactory.components import factory
skip_test = {
"version_stamp",
"extend_ports_list",
"extend_port",
"grating_coupler_tree",
"compensation_path",
"spiral_inner_io_with_gratings",
"component_sequence",
"straight_heater_metal_90_90",
... |
# 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... |
"""
https://fr.wikipedia.org/wiki/%C3%89criture_du_vieux_norrois
Altnordisches Elementarbuch by Friedrich Ranke and Dietrich Hofmann
"""
from cltk.phonology.utils import *
__author__ = ["Clément Besnier <clemsciences@gmail.com>"]
a = Vowel(Height.open, Backness.front, False, Length.short, "a")
ee = Vowel(Height.op... |
import random
import time
import itertools
import neal
from tabu import TabuSampler
import greedy
from .utils import get_qubo, delete_keys_from_dict, get_bcols_from_samples, filter_out_stored_QUBOs, combine_QUBO_storage, column_solve_postprocess, remove_duplicate_QUBO
def call_simulated_annealing(QUBO, random_state=4... |
"""Define the common values and functions to run the tests."""
from pathlib import Path
from scrapd.core import constant
TEST_ROOT_DIR = Path(__file__).resolve().parent
TEST_DATA_DIR = TEST_ROOT_DIR / 'data'
TEST_DUMP_DIR = TEST_ROOT_DIR.parent / constant.DUMP_DIR
def load_test_page(page):
"""Load a test page."... |
import argparse
import logging
import os
import httplib2
from apiclient import discovery
from googleapiclient.errors import HttpError
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
try:
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
ex... |
from flask import render_template, request, redirect, url_for, send_from_directory
from app import app, mongo
from .helper import render_form_data, get_action, get_doc
################################################################################
# PAPGES
#############################################################... |
# Desafio: Crie um jogo onde o computador vai “pensar” em
# um número entre 0 e 10. O jogador vai tentar adivinhar
# qual número foi escolhido até acertar, entre os palpites
# diga ao jogador se o número do computador é maior ou menor
# ao que ele digitou,no final mostre quantos palpites foram
# necessários para v... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="Pello",
version="1.0.2",
author="Tomáš Hrnčiar",
author_email="tomas.hrnciar@me.com",
description="An example Python Hello World package",
long_description=long_description,
long_... |
from more.transaction import default_commit_veto
def callFUT(response, request=None):
return default_commit_veto(request, response)
def test_it_true_500():
response = DummyResponse('500 Server Error')
assert callFUT(response)
def test_it_true_503():
response = DummyResponse('503 Service Unavailabl... |
version = "1.0"
import metrics
import node
import slm_ratios as slm
slm.set_clks_event_name("CPU_CLK_UNHALTED.CORE")
smt_enabled = False
class CyclesPerUop(slm.CyclesPerUop):
server = True
# LEVEL 1
class FrontendBound(slm.FrontendBound):
server = True
class BackendBound(slm.BackendBound):
server = Tr... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, zameen and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class StandardizedDesignation(Document):
pass
|
import logging
from importlib import reload
from pathlib import Path
from pyroll.core import solve
from pyroll.ui import Reporter, Exporter
def test_solve(tmp_path: Path, caplog):
caplog.set_level(logging.DEBUG, logger="pyroll")
import pyroll.integral_thermal
import pyroll.ui.cli.res.input_min as input... |
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Also available under a BSD-style license. See LICENSE.
import torch
from torch_mlir_e2e_test.torchscript.framework imp... |
class texttobinary:
def __repr__(self):
return 'texttobinary()'
def forward(input):
Dec = list(bytearray(input, "utf8"))
out = [''] * len(input)
for i in range(len(input)):
out[i] = bin(Dec[i]).replace("b", ("0"*(9-len(bin(Dec[i])))))
return out
def backward(input):
return inpu... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class DeleteRepoRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key ... |
#####################################################
# Permanent Timeshift Plugin for Enigma2 Dreamboxes
# Coded by Homey (c) 2013
#
# Version: 2.1
# Support: www.dreambox-plugins.de
#####################################################
from Components.ActionMap import ActionMap
from Components.ConfigList import Confi... |
from ..utility.cat import *
from ..utility.issparse import *
from ..math.unitvec import *
def add_constraints(A, hard=None, soft=None):
"""
Adds hard and soft constraints to the given constraints matrix
Parameters
----------
A : Tensor or SparseTensor
the (N,M,) constraints matri... |
class LastProducts:
# TODO: Implement homework here
def __init__(self, max_number_of_products: int = 3) -> None:
...
def add_watched_product(self, product_name: str, product_category: str) -> None:
...
def print_last_products_in_order(self) -> None:
...
|
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.