filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_18664 | import os
import torch
import copy
from data_utils import datasets
from training.solver import Solver
from data_utils import distorters
# In a single experiment an arbitrary number of models can be trained sequentially. First the
# experimental setup is configured (setting base parameters and hyperparameter options)... |
the-stack_106_18665 | r"""Utilities to compile possibly incomplete Python source code.
This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:
- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise Sy... |
the-stack_106_18668 | import time
import sys
import multiprocessing
from collections import deque
import gym
import numpy as np
import tensorflow as tf
from stable_baselines import logger
from stable_baselines.common import explained_variance, ActorCriticRLModel, tf_util, SetVerbosity, TensorboardWriter
from stable_baselines.common.runner... |
the-stack_106_18669 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# ... |
the-stack_106_18672 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=3
# total number=10
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
the-stack_106_18674 | from marshmallow import (
fields,
post_load,
Schema,
validate,
validates_schema,
ValidationError,
)
from .state import State
class MulticloudStackSchema(Schema):
stack_name = fields.Str(required=True, validate=[validate.Length(min=1)])
count = fields.Int(required=True, validate=[vali... |
the-stack_106_18676 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class MrpRoutingWorkcenter(models.Model):
_name = 'mrp.routing.workcenter'
_description = 'Work Center Usage'
_order = 'sequence, id'
_check_company_auto = True
... |
the-stack_106_18677 | import eHive
import os
import subprocess
class CompressBybgzip(eHive.BaseRunnable):
"""Store the file in the DB"""
def param_defaults(self):
return {
'compression' : None
}
def run(self):
self.warning('Compressing file: %s'% self.param_required('filename'))
f... |
the-stack_106_18679 | import logging
import warnings
from string import Template
from great_expectations.datasource.types import SqlAlchemyDatasourceTableBatchKwargs
from great_expectations.exceptions import BatchKwargsError, GreatExpectationsError
from great_expectations.marshmallow__shade import (
Schema,
ValidationError,
fie... |
the-stack_106_18680 | __author__ = "Maja Bojarska"
import logging
import threading
import RPi.GPIO as GPIO
from . import battery_guard
from . import gamepad
from . import motor_controller
logging.getLogger(__name__)
class Tadpole(threading.Thread):
""" Class for controlling the Tadpole vehicle. """
def __init__(self):
... |
the-stack_106_18683 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
the-stack_106_18685 | from datetime import datetime
import os
import boto3
S3_CLIENT = boto3.client('s3')
PROJECT_NAME = os.getenv('PROJECT_NAME')
def read_from(key):
params = {
'Bucket': PROJECT_NAME,
'Key': key
}
try:
response = S3_CLIENT.get_object(**params)
except S3_CLIENT.exceptions.NoSuchK... |
the-stack_106_18686 | """
MIT License
Copyright (c) present TheHamkerCat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... |
the-stack_106_18688 | # -*- python -*-
# Copyright (C) 2009-2019 Free Software Foundation, Inc.
# 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 3 of the License, or
# (at your option) any later versio... |
the-stack_106_18689 | import mysql.connector
import click
from toDo.schema import instructions
from flask import current_app, g
from flask.cli import with_appcontext
def get_db():
if 'db' not in g:
g.db = mysql.connector.connect(
host= current_app.config['DATABASE_HOST'],
user= current_app.config['DATA... |
the-stack_106_18691 | import pandas as pd
import sys, os
import numpy as np
from snapy import MinHash, LSH
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
import random
import re
import Settings as Settings
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("project-test").config("spark.some.config.option... |
the-stack_106_18692 | from bxgateway.utils import configuration_utils
from bxcommon.test_utils.mocks.mock_node import MockNode
from bxcommon.test_utils import helpers
from bxgateway import gateway_constants
from bxcommon.models.config.gateway_node_config_model import GatewayNodeConfigModel
import unittest
class ConfigToolsTests(unittest.T... |
the-stack_106_18693 | """EvoNormB0 (Batched) and EvoNormS0 (Sample) in PyTorch
An attempt at getting decent performing EvoNorms running in PyTorch.
While currently faster than other impl, still quite a ways off the built-in BN
in terms of memory usage and throughput (roughly 5x mem, 1/2 - 1/3x speed).
Still very much a WIP, fiddling with ... |
the-stack_106_18694 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 your option) any later version.
#
# This program is distrib... |
the-stack_106_18696 | # encoding: utf-8
"""Tests for genutils.path"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import sys
import tempfile
import nose.tools as nt
from ..testing.decorators import skip_if_not_win32, skip_win32
from .. import path
from .. import py3compa... |
the-stack_106_18698 |
import json
import os
import logging
from os.path import join, normpath
from django.core.cache import cache
from django.conf import settings
from datetime import datetime, timedelta
from django.http import HttpResponse
from biostar.accounts.models import Profile, User
from . import util
from .models import Post, Vot... |
the-stack_106_18701 | import json, re
ontologies = ['ontocompchem', 'ontokin', 'ontospecies', 'wiki']
def process_puncutation(string):
# Load the regular expression library
# Remove punctuation
string_temp = re.sub('[-\n,.!?()\[\]0-9]', '', string)
# Convert the titles to lowercase
string_temp = string_temp.lower()
... |
the-stack_106_18702 | import keras
from keras.layers import Input
from keras.models import Model
from .utils.cloud import remoteModel, modelOut
import numpy as np
class BrokenModel(object):
"""Can split the model at the given layer into two parts.
"""
def __init__(self, model, splitLayer, custom_objects):
"""
# ... |
the-stack_106_18703 | # Copyright (c) 2013-2015 University Corporation for Atmospheric Research/Unidata.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
"""Read upper air data from the Wyoming archives."""
#!/usr/bin/python3
from io import StringIO
import warnings
from bs4 import BeautifulSoup
import numpy... |
the-stack_106_18704 | from __future__ import print_function
from lldbsuite.test.lldbtest import *
import os
import vscode
class VSCodeTestCaseBase(TestBase):
def create_debug_adaptor(self):
'''Create the Visual Studio Code debug adaptor'''
self.assertTrue(os.path.exists(self.lldbVSCodeExec),
'... |
the-stack_106_18706 | #
# Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren,
# Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor,
# Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan,
# Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl
#
# This file is part of acado... |
the-stack_106_18708 | import logging
from crypto_exchange.utils.rest.okex import OKExREST
logger = logging.getLogger(__name__)
class OKExSpot(OKExREST):
def __init__(self, api_key: str = '', secret_key: str = '', ):
self._api_key = api_key
self._secret_key = secret_key
self.headers = {
"Content-ty... |
the-stack_106_18709 | """
SymPy statistics module
Introduces a random variable type into the SymPy language.
Random variables may be declared using prebuilt functions such as
Normal, Exponential, Coin, Die, etc... or built with functions like FiniteRV.
Queries on random expressions can be made using the functions
======================... |
the-stack_106_18710 | from pynput import keyboard
def on_press(key):
try:
print('alphanumeric key {0} pressed'.format(key.char))
except AttributeError:
print('special key {0} pressed'.format(key))
def on_release(key):
print('{0} released'.format(key))
if key == keyboard.Key.esc:
# Stop listener
... |
the-stack_106_18712 | import json
import matplotlib as mp
import matplotlib._version
import pandas as pd
import smtplib # required to send email
from os import environ
from datetime import date, datetime
from io import BytesIO # required for converting matplotlib figure to bytes
from email.mime.image import MIMEImage # required for image at... |
the-stack_106_18714 | #!/usr/bin/env python3
import glob
import re
import contextlib
import os
import platform
import sys
import shutil
import subprocess
import tarfile
import zipfile
import click
import cryptography.fernet
import parver
@contextlib.contextmanager
def chdir(path: str): # pragma: no cover
old_dir = os.getcwd()
o... |
the-stack_106_18717 | import json
import paste.fixture
from ckan import model
from ckan.lib.create_test_data import CreateTestData
import ckan.lib.helpers as h
from ckan.tests import WsgiAppCase
import ckan.plugins as plugins
TEST_VOCAB_NAME = 'test-vocab'
# paste.fixture.Field.Select does not handle multiple selects currently,
# so rep... |
the-stack_106_18718 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
the-stack_106_18720 | # Filename: HCm_Teff_v3.1.py
import string
import numpy as np
import sys
print (' ---------------------------------------------------------------------')
print ('This is HII-CHI-mistry_Teff v. 3.1')
print (' See Perez-Montero et al (2019) for details')
print (' Insert the name of your input text file with the foll... |
the-stack_106_18721 | #!/usr/bin/env python3
import re
import setuptools
with open("pullnrun/_version.py", "r") as f:
try:
version = re.search(
r"__version__\s*=\s*[\"']([^\"']+)[\"']",f.read()).group(1)
except:
raise RuntimeError('Version info not available')
with open("README.md", "r") as f:
long... |
the-stack_106_18727 | import tensorflow as tf
import numpy as np
import traceback
from tensorflow.python.keras.applications.mobilenet_v2 import _inverted_res_block
import os
from . import utils
import cv2
class PoseErrorCallback(tf.keras.callbacks.Callback):
def __init__(
self,
model,
ref_points,
crop_s... |
the-stack_106_18728 | #!/usr/bin/python3
import random
import itertools
def q(n):
"""
We want to solve the N-queens problem: put n queens on a n*n board,
with no queen attacking each other.
"""
print("Hill climbing:")
# We put the queens on each column on the board
queens = tuple([random.randint(0, n - 1) for _... |
the-stack_106_18732 | from django.core import mail
from hc.api.models import Channel
from hc.test import BaseTestCase
class SendTestNotificationTestCase(BaseTestCase):
def setUp(self):
super(SendTestNotificationTestCase, self).setUp()
self.channel = Channel(kind="email", project=self.project)
self.channel.emai... |
the-stack_106_18734 | from .base import *
DEBUG = False
ALLOWED_HOSTS = [
'fahimtran.com',
'www.fahimtran.com',
'pure-faculty-274606.uc.r.appspot.com',
'127.0.0.1',
'localhost',
]
# SECURITY: To secure payloads and user information
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
SECURE_SSL_REDIRECT = True
SECU... |
the-stack_106_18736 | # Copyright 2019 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 applicab... |
the-stack_106_18739 | __author__ = 'sibirrer'
import numpy as np
import MultiLens.Utils.constants as const
def make_grid(numPix, deltapix):
"""
returns x, y position information in two 1d arrays
"""
a = np.arange(numPix)
matrix = np.dstack(np.meshgrid(a, a)).reshape(-1, 2)
x_grid = (matrix[:, 0] - numPix/2.)*delt... |
the-stack_106_18740 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import OrderedDict
from functools import partial
from classytags.utils import flatten_context
from django.contrib.sites.models import Site
from django.template import Context
from django.utils.functional import cached_property
from djan... |
the-stack_106_18742 | from __future__ import unicode_literals
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^$',
views.AppointmentList.as_view(),
name='appointment_list',
),
url(r'^csv/$',
views.CSVAppointmentList.as_view(),
name='csv_appointmen... |
the-stack_106_18743 | import numpy as np
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
#################################################
# Database Setup
###############################... |
the-stack_106_18745 | # -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein, Ant1, Marius van Voorden
#
# This code is subject to the (new) BSD license:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of s... |
the-stack_106_18746 | from typing import *
import hail as hl
from hail.expr.expressions import *
from hail.expr.types import *
from hail.matrixtable import MatrixTable
from hail.table import Table
from hail.typecheck import *
from hail.utils import Interval, Struct, new_temp_file
from hail.utils.misc import plural
from hail.utils.java impo... |
the-stack_106_18749 | import datetime
import typing
from warnings import warn
import discord
from discord.ext import commands
from discord.utils import snowflake_time
from . import error, http, model
from .dpy_overrides import ComponentMessage
class InteractionContext:
"""
Base context for interactions.\n
In some ways simila... |
the-stack_106_18751 | #!/usr/bin/env python3
# Copyright 2019 Johannes von Oswald
#
# 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... |
the-stack_106_18753 | #!/usr/bin/env python
import os
import numpy as np
from selfdrive.can.parser import CANParser
from cereal import car
from common.realtime import sec_since_boot
RADAR_MSGS = range(0x500, 0x540)
def _create_radar_can_parser():
dbc_f = 'ford_fusion_2018_adas.dbc'
msg_n = len(RADAR_MSGS)
signals = list(zip(['X_Rel'... |
the-stack_106_18756 | #!/usr/bin/env python
from ncclient import manager
import sys
from lxml import etree
# Add parent directory to path to allow importing common vars
sys.path.append("..") # noqa
from device_info import sbx_n9kv_ao as device # noqa
# Loopback Info - Change the details for your interface
prefix = "10.99.99.0/24"
# crea... |
the-stack_106_18757 | """Main ecoshard module."""
import datetime
import hashlib
import logging
import json
import os
import re
import requests
import shutil
import subprocess
import sys
import time
import urllib.request
import zipfile
from osgeo import gdal
import numpy
from .geoprocessing import geoprocessing
import sci... |
the-stack_106_18758 | import json
from typing import Mapping, Optional
from base64 import b64encode, b64decode
from . import Handler, AuthenticatedHandler
from malon_lp.crypto.dh import KeyExchange, get_client_id
from malon_lp.crypto.sym import SymmetricCipher
KeyRespository = Mapping[str, bytes]
class DummyAuthenticationHandler(Handle... |
the-stack_106_18759 | import numpy as np
import warnings
from anndata import AnnData
from scipy.sparse import issparse, csr_matrix, lil_matrix, diags
from tqdm import tqdm
from .utils_moments import estimation
from .utils import get_mapper, elem_prod, inverse_norm
from .connectivity import mnn, normalize_knn_graph, umap_conn_indices_dist_em... |
the-stack_106_18760 | import sys
import os
import string
def calc(species, m, n):
gens = [ [0 for x in range(0, n)] for y in range(0, m) ]
for i in range(1, m):
gen = gens[m - i - 1]
genSub = gens[m -i ]
subs = species[m - i]
for j in range(0, n):
s = subs[j]
sIndex = ord(s[1]) - 65
parentIndex = ord(s[0]) -... |
the-stack_106_18762 | import unittest
from gluestring.gluegun import Gluegun
class TestGlueit(unittest.TestCase):
def test_basic(self):
# pup_string = "I Love {{pups}} more than {{octopus}}."
# animal_dictionary = {
# "pups" : "🐶🐶🐶",
# "kittens":"🐱🐱🐱",
# "fi... |
the-stack_106_18763 | # -*- coding: utf-8 -*-
#
# colour-checker-detection documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 5 14:31:53 2014.
#
# 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
# autogene... |
the-stack_106_18764 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
class BasicConv2d(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(BasicConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)
... |
the-stack_106_18765 | """
Zappa core library. You may also want to look at `cli.py` and `util.py`.
"""
##
# Imports
##
import getpass
import glob
import hashlib
import json
import logging
import os
import random
import re
import shutil
import string
import subprocess
import tarfile
import tempfile
import time
import uuid
import zipfile
fro... |
the-stack_106_18767 | from datetime import datetime, date
import re
import format.mla as mla
import format.cmos as cmos
import scraper.main as scraper
def get_authors(soup):
author_tag = soup.find("meta", {"name": "author"})
if not author_tag:
author_tag = soup.find("meta", {"property": "author"})
if not author_tag... |
the-stack_106_18769 | import pytest
from dagster import (
DagsterTypeCheckError,
DependencyDefinition,
Field,
InputDefinition,
Int,
OutputDefinition,
ModeDefinition,
PipelineDefinition,
lambda_solid,
resource,
solid,
)
from dagster.utils.test import execute_solid_within_pipeline
from dagster.cor... |
the-stack_106_18770 | ###########################################################################
# Created by: Hang Zhang
# Email: zhang.hang@rutgers.edu
# Copyright (c) 2017
###########################################################################
import os, sys
BASE_DIR = os.path.dirname(os.path.dirname(os.getcwd()))
sys.path.append(B... |
the-stack_106_18771 | import os
import sys
import builtins
import difflib
import inspect
import pydoc
import keyword
import re
import string
import test.support
import time
import unittest
import xml.etree
import textwrap
from io import StringIO
from collections import namedtuple
from test.script_helper import assert_python_ok
from test.sup... |
the-stack_106_18776 | import ctypes
def check_fd(fd):
""" Validate that a fd parameter looks like a file descriptor.
Raises an exception if the parameter is invalid.
:param fd: File descriptor to check.
"""
if not isinstance(fd, int):
raise TypeError('fd must be an integer, but was {}'.format(fd.__class__.__n... |
the-stack_106_18778 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/MedicationAdministration
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import Any, Dict
from typing import List as ListType
from pydantic import Field, root_validator
from . import fhirtypes
from .backboneelement import Backbo... |
the-stack_106_18779 | # coding=utf-8
# Copyright 2021 The Meta-Dataset 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 ... |
the-stack_106_18780 | from dataframe import data
def test_data_types():
headers = ['Breed', 'Color', 'DogName', 'ExpYear', 'LicenseType', 'OwnerZip', 'ValidDate']
# Only 'ExpYear' has the 'int64' type. All others have 'object' type.
headers_int64 = [headers[3]]
headers_object = set(headers) - set(headers_int64)
# Che... |
the-stack_106_18781 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from six import iteritems
from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit
import requests
import requests_kerberos
from requests.exceptions import Timeout, HTTPError, InvalidURL, Conne... |
the-stack_106_18782 | import json
from django.contrib import admin
from django.db import models
from .models import RequestData, RegtseData, RegdevData, RegtseDataTest, RegdevDataTest, RequestDataTest
from crudapp.models import Atm, AtmImage, AtmModel, AtmModelFunction
class RequestDataAdmin(admin.ModelAdmin):
list_display=('identity... |
the-stack_106_18787 | import threading
import PyLidar3
import matplotlib.pyplot as plt
import math
import time
def draw():
global is_plot
while is_plot:
plt.figure(1)
plt.cla()
plt.ylim(-4000,4000)
plt.xlim(-4000,4000)
plt.scatter(x,y,c='r',s=8)
plt.pause(0.001)
plt.close("all... |
the-stack_106_18789 | import time
import GloVeFastDistances
searchEngine=GloVeFastDistances.GloVeFastDistances("/path/to/glovefile")
while(True):
input1 = input()
if input1 in searchEngine.wordDictionary:
word=searchEngine.wordDictionary[input1]
embeddings=searchEngine.embeddings[word]
start1 = time.time()
... |
the-stack_106_18790 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
import numpy as np
W = dace.symbol('W')
@dace.program
def prog(A, stats):
@dace.map(_[0:W])
def compute(i):
inp << A[i]
sum >> stats(1, lambda x, y: x + y)[0]
ssq >> stats(1, lambda x, y: x + y)[1]... |
the-stack_106_18793 | from unittest import TestCase
from preprocessor.InteractionTypePrefixer import InteractionTypePrefixer
class TestInteractionTypePrefixer(TestCase):
def test_transform(self):
# Arrange
data = ["This is sample entity1 entity1", "entity1", "entity2", "phosphorylation"]
expected = ["QUERYpho... |
the-stack_106_18795 | ''' Dictionary
A dictionary is a collection of key value pairs.
The values can be changed (mutable)
The values have unique keys.
Using the constructor method # 29
Built-in dictionary Methods
Method Description
get() Returns the value of a specific key.
Update() Inserts a s... |
the-stack_106_18796 | import torch
from torch.nn import functional as F
from torch.nn.modules.loss import _WeightedLoss
class SoftmaxCrossEntropyWithLogits(_WeightedLoss):
def __init__(self, weight=None):
super(SoftmaxCrossEntropyWithLogits, self).__init__(weight=None)
self.weight = weight
def forward(self, input, ... |
the-stack_106_18797 | # coding:utf-8
from django import forms
from django.conf import settings
from django.contrib.admin.widgets import AdminTextareaWidget
from django.template.loader import render_to_string
from django.utils.http import urlencode
from django.utils.safestring import mark_safe
# import settings as USettings
from .commands i... |
the-stack_106_18798 | import numpy as np
from skimage.transform import AffineTransform, warp
from skimage.util import pad, img_as_ubyte
from typing import List
from dataset.interpolate.InterpolateDatasetLoader import InterpolateDatasetLoader
from dataset.loader.DatasetLoader import DatasetLoader
from dataset.interpolate.InterpolateSubdatas... |
the-stack_106_18801 | import warnings
import numpy as np
from sklearn.exceptions import ConvergenceWarning
from sklearn.linear_model import ridge_regression
from sklearn.utils.validation import check_is_fitted
from pysindy.optimizers import BaseOptimizer
class STLSQ(BaseOptimizer):
"""Sequentially thresholded least squares algorithm... |
the-stack_106_18805 | N, K = map(int, input().split())
L = [[] for i in range(N + 1)]
for i in range(N - 1):
a, b = map(int, input().split())
L[a].append(b)
L[b].append(a)
class LCA_doubling:
"""
parent: ダブリングテーブル
depth: 元の深さ
"""
def __init__(self, g, root): #g: graph
def dfs(root):
n ... |
the-stack_106_18807 | # Copyright 2019 Xanadu Quantum Technologies 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 agre... |
the-stack_106_18808 | from random import choice
import home
from home import fund, lp
from time import sleep
lista = ['pedra', 'papel', 'tesoura']
while True:
home.titulo('JO KEN PO', 4, '-')
a = choice(lista)
while True:
try:
b = int(input('Escolhe uma opção\n[1] pedra\n[2] papel\n[3] tesoura\nR: '))
... |
the-stack_106_18809 | from __future__ import division
import argparse
import multiprocessing
import chainer
from chainer.datasets import TransformDataset
from chainer import iterators
from chainer.links import Classifier
from chainer.optimizer import WeightDecay
from chainer.optimizers import CorrectedMomentumSGD
from chainer import traini... |
the-stack_106_18810 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import threading
import time
from typing import Callable
import pytest
from mock import MagicMock
import intelliflow.api_ext as flow
from intelliflow.api_ext import *
from intelliflow.core.application.applicati... |
the-stack_106_18813 | # 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 ... |
the-stack_106_18814 | # Copyright 2014-2015 Canonical Limited.
#
# 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 ... |
the-stack_106_18818 | import asyncio
import json
import re
import ssl
import sys
from time import sleep
import pytest
pytest.importorskip("bokeh")
from bokeh.server.server import BokehTornado
from tlz import first
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
import dask
from dask.core import flatten
from distributed.utils ... |
the-stack_106_18819 | import os
import cv2
import numpy as np
from server.services.errors import Errors, PortalError
from server.services.hashing import get_hash
from server.models.abstract.BaseModel import BaseModel
class DarknetModel(BaseModel):
def _load_label_map_(self):
labels = (
open(os.path.join(self._di... |
the-stack_106_18820 | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
'''Code to load instruction words into a simulator'''
import struct
from typing import List, Optional, Tuple, Type
from .err_bits import ILLEGAL_INSN
from .isa import Dec... |
the-stack_106_18821 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('forum', '0005_auto_20160402_1336'),
]... |
the-stack_106_18822 | from flask import Blueprint, render_template, redirect, url_for, flash
from solarvibes import db
from solarvibes.site.forms import EmailForm, EmailAndTextForm, ContactUsForm # Wesite Forms
from solarvibes.site.models import NewsletterTable, AgrimoduleFBTable, PlatformFBTable, WorkWithUsTable, ContactUsTable
site = Blu... |
the-stack_106_18823 | ##############################################################################
# STEP 1:
# CREATING dewey_classification DATABASE
# FROM file create_dewey_classification.sql
# STEP 2:
# FORMATING DATA AND FILES
# FROM file Dewey_decimal_classification_FR.txt
# STEP 3:
# POPULATING dewey_classification DATABASE
# FROM... |
the-stack_106_18828 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 ICON 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 r... |
the-stack_106_18831 | import os
import stat
import warnings
from collections import OrderedDict
from collections.abc import Mapping
from unittest.mock import MagicMock
import pytest
import torch
import torch.nn as nn
from pkg_resources import parse_version
import ignite.distributed as idist
from ignite.engine import Engine, Events, State
... |
the-stack_106_18832 | from time import time
from django.test.client import Client, FakePayload
from django.conf import global_settings
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.wsgi import WSGIHandler
from djangobench.utils import run_comparison_benchmark
class RequestFac... |
the-stack_106_18833 | from collections import namedtuple
from datetime import datetime
from typing import List
import requests
Success = namedtuple("Success", ["RowAffected"])
class GorseException(BaseException):
def __init__(self, status_code: int, message: str):
self.status_code = status_code
self.message = message... |
the-stack_106_18835 | """Class to handle S-parameters."""
import numpy as np
from numpy.linalg import inv
from numpy import diag, sqrt, identity, matmul, iscomplex
import matplotlib.pyplot as plt
from copy import deepcopy as copy
from rftools.parameters import *
class Network(object):
"""Class to handle S-parameters.
Args:
... |
the-stack_106_18836 | #Common imports
import numpy as np
import matplotlib.pyplot as plt
#Relative Imports
from context import kmodel
from kmodel.kronecker_model import model_loader
model_dir = '../../data/kronecker_models/'
#%%
def plot_model():
#%%
#%matplotlib qt
model_foot = model_loader('foot_model.pickle')
mo... |
the-stack_106_18838 | # -*- coding: utf-8 -*-
from addons.base.models import (BaseOAuthNodeSettings, BaseOAuthUserSettings,
BaseStorageAddon)
from django.db import models
from framework.auth.core import Auth
from osf.models.files import File, Folder, BaseFileNode
from addons.base import exceptions
from ad... |
the-stack_106_18839 | # encoding: utf-8
"""
Unit tests for the sumatra.recordstore package
"""
from __future__ import unicode_literals
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import object
import unittest
import os
import sys
import ... |
the-stack_106_18840 | # Copyright (c) 2021 AllSeeingEyeTolledEweSew
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERC... |
the-stack_106_18841 | #!/usr/bin/env python3
import localpath
from typing import Iterator, Sequence
from libcpu.opcode_builder import MicroCode
from libcpu.util import ControlSignal
from libcpu.opcodes import opcodes, fetch
from libcpu.ctrl_word import CtrlWord
control = CtrlWord()
def finalize_steps(microcode: MicroCode, flags: int) -... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.