filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_31381 | """Rewrite assertion AST to produce nice error messages"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ast
import errno
import imp
import itertools
import marshal
import os
import re
import string
import struct
import sys
import types
import atom... |
the-stack_106_31383 | #!/usr/bin/python
# 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 ... |
the-stack_106_31384 | # Copyright (c) 2011 Jeff Garzik
#
# Previous copyright, from python-jsonrpc/jsonrpc/proxy.py:
#
# Copyright (c) 2007 Jan-Klaas Kollhof
#
# This file is part of jsonrpc.
#
# jsonrpc is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# th... |
the-stack_106_31385 | import pycxsimulator
from pylab import *
n = 100 # size of grid: n * n
Dh = 1. / n # spatial resolution, assuming space is [0,1] * [0,1]
Dt = 0.01 # temporal resolution
wx, wy = -0.01, 0.03 # constant velocity of movement
xvalues, yvalues = meshgrid(arange(0, 1, Dh), arange(0, 1, Dh))
def initialize():
gl... |
the-stack_106_31388 | # -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
class clstm_clf(object):
"""
A C-LSTM classifier for text classification
Reference: A C-LSTM Neural Network for Text Classification
"""
def __init__(self, config):
self.max_length = config.max_length
self.num_classe... |
the-stack_106_31389 | import unittest
import django
if django.VERSION < (3, 2):
default_app_config = 'csv_permissions.apps.CsvPermissionAppConfig'
def load_tests(*args, **kwargs):
empty_suite = unittest.TestSuite()
return empty_suite
__version__ = "0.2.0"
|
the-stack_106_31390 | ######################################################################################################
# Elemento de ruido de 2 bit por trama
import random
def noise(bits_originales, metodo):
# Meto que Requiere la funcion ruido
print('Ruido de unico bit')
if metodo == 'lrc':
n = 7
x = 8
... |
the-stack_106_31392 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals, absolute_import
import frappe
from frappe import _
import json
from frappe.model.document import Document
from frappe.core.doctype.user.user impo... |
the-stack_106_31393 | #!/usr/bin/env python
"""GRR specific AFF4 objects."""
import re
import time
import logging
from grr.client.components.rekall_support import rekall_types as rdf_rekall_types
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import data_store
from grr.lib import flow
from grr.lib import queue_... |
the-stack_106_31397 | # 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... |
the-stack_106_31400 | """
Setup tasks (requires invoke: pip install invoke)
"""
import sys
import platform
from pathlib import Path
import base64
from invoke import task
import shutil
_IS_WINDOWS = platform.system() == 'Windows'
_PY_DEFAULT_VERSION = '3.9'
if not Path('LICENSE').exists():
sys.exit('Error: Run the command from the root... |
the-stack_106_31401 | from datetime import datetime, time, date
import pytest
from freezegun import freeze_time
from tests.utils import file_response
from city_scrapers.constants import COMMITTEE
from city_scrapers.spiders.chi_school_community_action_council import (
ChiSchoolCommunityActionCouncilSpider
)
freezer = freeze_time('2018-... |
the-stack_106_31403 | from __future__ import print_function
import idaapi
# -----------------------------------------------------------------------
# Using raw IDAAPI
def raw_main(p=True):
f = idaapi.get_func(here())
if not f:
return
q = idaapi.qflow_chart_t("The title", f, 0, 0, idaapi.FC_PREDS)
for n in range(0, ... |
the-stack_106_31404 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
the-stack_106_31405 | #! /usr/bin/python
#-*- coding: utf-8 -*-
from __future__ import print_function
from pybern.products.gnssdates.gnssdates import mjd2pydt, gps2pydt, SEC_PER_DAY
def utils_pydt2yydoy(pydt):
''' Return two-digit year and day-of-year as integers (in a tuple) from a
python datetime.datetime instance
'''
... |
the-stack_106_31410 | """
Copyright (c) 2020 Cisco Systems Inc or its affiliates.
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 requi... |
the-stack_106_31412 | # Symbolizing a Vector Layer
# https://github.com/GeospatialPython/Learn/raw/master/Mississippi.zip
from PyQt4.QtGui import *
lyr = QgsVectorLayer("/qgis_data/ms/mississippi.shp", "Mississippi", "ogr")
QgsMapLayerRegistry.instance().addMapLayer(lyr)
symbols = lyr.rendererV2().symbols()
sym = symbols[0]
sym.setColor(... |
the-stack_106_31413 | import argparse
import logging
import os
import uuid
import zmq
from zmq.utils import jsonapi
from .graph import PoolingStrategy
__all__ = ['set_logger', 'send_ndarray', 'get_args_parser', 'check_tf_version', 'auto_bind']
def set_logger(context):
logger = logging.getLogger(context)
logger.setLevel(logging.... |
the-stack_106_31415 | from setuptools import find_packages
from setuptools import setup
package_name = 'ament_uncrustify'
setup(
name=package_name,
version='0.8.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages'... |
the-stack_106_31416 | import os
from smarts.sstudio import gen_traffic
from smarts.sstudio.types import (
Traffic,
Flow,
Route,
TrafficActor,
Distribution,
LaneChangingModel,
JunctionModel,
)
scenario = os.path.dirname(os.path.realpath(__file__))
impatient_car = TrafficActor(
name="car",
speed=Distribu... |
the-stack_106_31417 | # 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... |
the-stack_106_31419 | #
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, pu... |
the-stack_106_31421 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import db
from django.core.exceptions import ValidationError
from django.test import SimpleTestCase
from localflavor.nl import forms, models, validators
from .forms import NLPlaceForm
from .models import NLPlace
class NLLocalFlavorValidato... |
the-stack_106_31422 | """
Demonstrates implementation of SHA1 Hash function in a Python class and gives utilities
to find hash of string or hash of text from a file.
Usage: python sha1.py --string "Hello World!!"
python sha1.py --file "hello_world.txt"
When run without any arguments, it prints the hash of the string "Hello Wor... |
the-stack_106_31424 | """raspy_hill_29176 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cl... |
the-stack_106_31425 | #
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
the-stack_106_31427 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from __future__ import division
import torch
from maskrcnn_benchmark.structures.bounding_box import BoxList
from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask, PolygonList, PolygonInstance
from maskrcnn_benchmark.config i... |
the-stack_106_31429 | """Load a model asset in Blender."""
from pathlib import Path
from pprint import pformat
from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CON... |
the-stack_106_31430 | #!/usr/local/bin/anaconda3/bin/python
#Aquí hay una función que se usa para extraer los transcritos que tienen un ortólogo en alguna especie de las del estudio, esto lo hace del archivo mauricio.Proteinortho-graph
#Adicionalmente hay funciones para que una vez que tiene el identificador del transcrito, los busca en ... |
the-stack_106_31432 | # Copyright (c) Facebook, Inc. and its affiliates.
import os
import pickle
from copy import deepcopy
from dataclasses import dataclass
from enum import Enum
from typing import Any
import torch
import torchvision
from mmf.common.registry import registry
from mmf.modules.embeddings import ProjectionEmbedding, TextEmbedd... |
the-stack_106_31433 | from fractions import Fraction
from function.generic_univariate_pitch_function import GenericUnivariatePitchFunction
from function.piecewise_linear_function import PiecewiseLinearFunction
from function.scalar_range_interpreter import ScalarRangeInterpreter
from function.chromatic_range_interpreter import ChromaticRang... |
the-stack_106_31435 | import unittest
from decimal import Decimal
from django.db import connection
from django.db.models import DecimalField
from django.db.models.functions import Pi, Round
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import DecimalModel, FloatModel, IntegerModel
class Rou... |
the-stack_106_31440 | """Base classes for basic metagraph plugins.
"""
import types
import inspect
from typing import Callable, List, Dict, Set, Any
from .typecache import TypeCache, TypeInfo
class AbstractType:
"""Equivalence class of concrete types."""
# Properties must be a dict of property name to set of allowable values
... |
the-stack_106_31443 | """Grammalecte wrapper."""
import json
import subprocess
import sys
import tempfile
from dataclasses import dataclass, field
from pathlib import Path
from typing import Generator, List, Union
from zipfile import ZipFile
import requests
@dataclass
class GrammalecteMessage:
"""Base class for Grammalecte messages.... |
the-stack_106_31444 | """Test airfs.storage.http"""
import pytest
UNSUPPORTED_OPERATIONS = (
"copy",
"getmtime",
"getctime",
"getsize",
"mkdir",
"listdir",
"remove",
"symlink",
"write",
"shareable_url",
)
def test_handle_http_errors():
"""Test airfs.http._handle_http_errors"""
from airfs.st... |
the-stack_106_31447 | from __future__ import print_function
import lldb
def StepOver(debugger, args, result, dict):
"""
Step over a given number of times instead of only just once
"""
arg_split = args.split(" ")
print(type(arg_split))
count = int(arg_split[0])
for i in range(0, count):
debugger.GetSele... |
the-stack_106_31449 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
"""
A nn.Module wrapper to go with a Sharded Optimizer in order to handle targeted gradient
reduction automatically.
"""
from collections imp... |
the-stack_106_31450 | # -*- coding: utf-8 -*-
from twisted.plugin import IPlugin
from pymoronbot.moduleinterface import IModule
from pymoronbot.modules.commandinterface import BotCommand
from zope.interface import implementer
from pymoronbot.message import IRCMessage
from pymoronbot.response import IRCResponse, ResponseType
from six impor... |
the-stack_106_31451 | from scipy.sparse import dok_matrix
import pickle
import numpy as np
from utils import read_w2v, save_sparse_csr
def build_graph(filename, TOPN, A_name, indice2word_name, annoy=False, dim=100, tree_num=20):
"""
"""
model = read_w2v(filename, dim)
V = len(model.wv.vocab)
print("Num. vocab = %i" % V)... |
the-stack_106_31452 | import time
import gym_envs.kuka_gym.kuka_button_gym_env as kuka_env
# env = kuka_env.KukaButtonGymEnv(renders=True, is_discrete=True, log_folder="mobile_robot", record_data=False, random_target=False)
env = kuka_env.KukaButtonGymEnv(renders=True)
timesteps = 1000 # must be greater than MAX_STEPS
episodes = 100
env... |
the-stack_106_31454 | # -*- coding: utf-8 -*-
from __future__ import with_statement
from datetime import datetime, timedelta
from decimal import Decimal
import os
import pickle
import sys
import unittest
from babel.support import NullTranslations
import flask
from flask_babelhg import (
get_translations,
gettext,
lazy_gettext... |
the-stack_106_31456 | # -*- coding:utf-8 -*-
'''
Created on 2017年1月9日
@author: AppleWang
cpu相关工具集
'''
# -*- coding:utf-8 -*-
import common.utils as utils
class CpuUtils():
def __init__(self, serial, pid):
self.pCpu =self.o_pCpu = 0.0
self.aCpu =self.o_aCpu = 0.0
self.serial = ser... |
the-stack_106_31457 | from __future__ import absolute_import, print_function
import threading
from concurrent import futures
import logging
import multiprocessing
import os
import sys
import tempfile
import typing
import grpc
from grpc_health.v1.health import HealthServicer
from grpc_health.v1 import health_pb2, health_pb2_grpc
from grpc_... |
the-stack_106_31458 | # THE WINTER IS COMING! the old driver will be driving who was a man of the world!
# -*- coding: utf-8 -*- python 3.6.7, create time is 18-11-30 下午12:26 GMT+8
DEFAULT_LOG_FILENAME = '日志.log'
# 启用的爬虫类
SPIDERS = [
# 'spiders.baidu.BaiduSpider',
'spiders.douban.DoubanSpider'
]
# 启用的管道类
PIPELINES = [
# 'pi... |
the-stack_106_31460 | import queue
import logging
import traceback
import threading
import contextlib
import collections
import envi
import envi.bits as e_bits
import envi.memory as e_mem
import envi.pagelookup as e_page
import envi.codeflow as e_codeflow
import vstruct.cparse as vs_cparse
import vstruct.builder as vs_builder
import vstru... |
the-stack_106_31461 | # -*- coding: utf-8 -*-
import sys
import redis
from pickle import dumps, loads
from lumbermill.BaseThreadedModule import BaseThreadedModule
from lumbermill.utils.Buffers import Buffer
from lumbermill.utils.Decorators import ModuleDocstringParser
@ModuleDocstringParser
class Cache(BaseThreadedModule):
"""
A ... |
the-stack_106_31462 | import insightconnect_plugin_runtime
from .schema import SetEncodingInput, SetEncodingOutput, Input, Output, Component
# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
class SetEncoding(insightconnect_plugin_runtime.Action):
def __init__(self):
super(self.__clas... |
the-stack_106_31463 | import cv2
import numpy as np
# mouse callback function
def draw_circle(event,x,y,flags,param):
if event == cv2.EVENT_LBUTTONDBLCLK:
cv2.circle(img,(x,y),100,(255,0,0),-1)
# Create a black image, a window and bind the function to window
img = np.zeros((512,512,3), np.uint8)
cv2.namedWindow('image')
cv2.se... |
the-stack_106_31464 | import numpy as np
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction, acq_max, load_logs, ensure_rng
from sklearn.gaussian_process.kernels import Matern
from sklearn.gaussian_process import GaussianProcessRegressor
def get_globals():
X = np.array([
[0.00, 0.00],
... |
the-stack_106_31466 | import json, os, re
import numpy as np
import pandas as pd
import plotnine as p9
import scipy.stats as stats
from Bio import SeqIO
from tqdm import tqdm
from statsmodels.stats.multitest import multipletests
from figure_3 import generate_input_for_figure
def check_annotations(ID, fastaFile):
for seqRecord in SeqI... |
the-stack_106_31468 | from io import BytesIO
import fitz
import numpy as np
import pytest
import requests
from doctr import io
def test_convert_page_to_numpy(mock_pdf):
pdf = fitz.open(mock_pdf)
# Check correct read
rgb_page = io.pdf.convert_page_to_numpy(pdf[0], default_scales=(1, 1))
assert isinstance(rgb_page, np.ndar... |
the-stack_106_31469 | from typing import Any
from django.core.management.base import CommandParser
from zerver.lib.actions import bulk_add_subscriptions, ensure_stream
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Add some or all users in a realm to a set of streams."""
def add_ar... |
the-stack_106_31470 |
import numpy as np
from helpFun import funVar
def function(X):
# SOURCE:
# Theory and Analysis of Elastic Plates and Shells,
# J. N. Reddy (pag.222)
# Navier Solutions
[Nx, Ny, ne, E, h, a, b] = funVar()
x = X[0]
y = X[1]
s = b/a
alfa = 111e-6 # thermal diffusivity [m/s]
Q0 = 3000*a*b # point force [N]... |
the-stack_106_31472 | import os
import subprocess
from os.path import join
import numpy as np
import pandas as pd
import toml
import torch
from qmplot import manhattanplot
from scipy import stats
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression
from torch.utils.data import DataLoader
from tqdm import ... |
the-stack_106_31473 | # 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... |
the-stack_106_31475 | # -*- coding: utf-8 -*-
import unittest
from iemlav.lib.log_monitor.system_log.harmful_root_command import HarmfulCommands
from iemlav.logger import IemlAVLogger
try:
# if python 3.x.x
from unittest.mock import patch
except ImportError: # python 2.x.x
from mock import patch
class TestHarmfulCommands(uni... |
the-stack_106_31477 | # coding=utf-8
from setuptools import find_packages, setup
base_requires = [
'Click<7.0',
'ansible==3.0.0',
'backports.shutil_get_terminal_size',
'semver',
'junit_xml',
'structlog',
'boto3'
]
test_requires = base_requires + [
'mock',
'coverage',
'pep8<=1.7.0',
'yapf==0.14.0... |
the-stack_106_31479 | import torch
from chamfer_distance import ChamferDistance
import time
chamfer_dist = ChamferDistance()
p1 = torch.rand([80000, 25, 3])
p2 = torch.rand([80000, 15, 3])
s = time.time()
dist1, dist2, idx1, idx2 = chamfer_dist(p1, p2)
loss = (torch.mean(dist1)) + (torch.mean(dist2))
torch.cuda.synchronize()
print(f"Tim... |
the-stack_106_31480 | from auditlog.models import LogEntry
from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
from dojo.models import Question, TextQuestion, ChoiceQuestion, Choice, \
Answer, TextAnswer, ChoiceAnswer, Engagement_Survey, Answered_Survey
admin.site.unreg... |
the-stack_106_31481 | # Copyright 2020 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... |
the-stack_106_31482 | import torch.optim as optim
import torch
import os
from net.resnet import *
from net.vgg import *
from net.lenet import LeNet
from net.googlenet import GoogLeNet
from net.mobilenet import *
from net.mobilenetv2 import *
from net.shufflenetv2 import *
from net.shufflenet import *
from net.densenet import *
f... |
the-stack_106_31483 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
the-stack_106_31484 | #!/usr/bin/env python
"""
A small binary showcasing the search library
"""
import random
from typing import List
import numpy as np # type: ignore
from termcolor import colored
from search.algorithms.astar import AStar
from search.algorithms.bfs import BFS
from search.algorithms.dfs import DFS
from search.algorith... |
the-stack_106_31487 | from PIL import ImageOps
from utils.endpoint import SimpleFilter, setup
@setup
class VerticalMirror(SimpleFilter):
def use_filter(self, img, kwargs):
img = img.convert('RGBA')
half = round(img.height / 2)
use_last_half = False if not 'last_half' in kwargs else bool(kwargs['last_half'])
... |
the-stack_106_31491 | # Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... |
the-stack_106_31492 | # landmarks.py
#
# test creating landmarks
from arena import *
scene = Scene(host="arena.andrew.cmu.edu", realm="realm", scene="test")
object_id = "the_box"
@scene.run_once
def make_box():
scene.add_landmark(
Box(object_id=object_id, position=(0,2,-2)), label="The Box")
scene.run_tasks()
|
the-stack_106_31493 | from mpi4py import MPI
import numpy as np
import random as ra
import datetime
import time
comm=MPI.COMM_WORLD
rank=comm.Get_rank()
size=comm.Get_size()
s=MPI.Status()
def do_something_else(data,d,rank):
if(rank==0):
print("Core {} sent message to Core {} at time:{}".format(rank,d,data.time()))
else:
prin... |
the-stack_106_31494 | # Copyright 2014-2015 ARM 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 w... |
the-stack_106_31495 | import os
import unittest
from recipe_scrapers.allrecipes import AllRecipes
class TestAllRecipesScraper(unittest.TestCase):
def setUp(self):
# tests are run from tests.py
with open(os.path.join(
os.getcwd(),
'recipe_scrapers',
'tests',
'test_data',
... |
the-stack_106_31496 | #! /usr/bin/env python
# Last Change: Mon Aug 20 08:00 PM 2007 J
from __future__ import division, print_function, absolute_import
import re
import itertools
import datetime
from functools import partial
import numpy as np
from scipy.lib.six import next
"""A module to read arff files."""
__all__ = ['MetaData', 'loa... |
the-stack_106_31498 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import gym
import numpy as np
# This is heavily based on
# https://github.com/denisyarats/dmc2gym/blob/master/dmc2gym/wr... |
the-stack_106_31499 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import sys
import traceback
from datetime import datetime
from http import HTTPStatus
from aiohttp import web
from aiohttp.web import Request, Response, json_response
from botbuilder.core import (
BotFrameworkAdapterSett... |
the-stack_106_31500 | import pytest
import jsonpickle
from urllib.parse import quote_plus
from namex.services.name_request.auto_analyse import AnalysisIssueCodes
from ..common import assert_issues_count_is_gt, assert_has_word_upper, save_words_list_classification, save_words_list_virtual_word_condition
from ..configuration import ENDPOIN... |
the-stack_106_31501 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
the-stack_106_31503 | import itertools
import os.path
from collections import defaultdict
import sys
import pandas as pd
from ahocorasick import Automaton
from itertools import product
from typing import List, Any, Optional, Tuple, Union
NT_SUB = str.maketrans('acgtrymkswhbvdnxACGTRYMKSWHBVDNX',
'tgcayrkmswdvbhnxTGCAY... |
the-stack_106_31506 | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publ... |
the-stack_106_31507 | import pytest
from wal_e import exception
from wal_e import worker
class FakeTarPartition(object):
"""Implements enough protocol to test concurrency semantics."""
def __init__(self, num_members, explosive=False):
self._explosive = explosive
self.num_members = num_members
def __len__(self... |
the-stack_106_31509 | # -*- coding: utf-8 -*-
'''
gds.burp.models
~~~~~~~~~~~~~~~
This module contains the primary objects that make working with
Burp's IHttpRequestResponse object's more... Pythonic.
'''
from java.net import URL
try:
from burp import IHttpService, IScanIssue
except ImportError:
class IHttpService(object):pass
... |
the-stack_106_31510 | #!/usr/bin/env python3
# Copyright (c) 2017-2019 The Btcavenue Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test getblockstats rpc call
#
from test_framework.test_framework import BtcavenueTestFramework
from... |
the-stack_106_31513 | from functools import reduce
from pathlib import Path
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import SimpleITK as sitk
from bokeh.models import HoverTool
import panel as pn
import param
import holoviews as hv
from holoviews import opts
from holoviews.operation.datashad... |
the-stack_106_31514 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=9
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_31515 | from sortedcontainers import SortedList
class NoSolutionError(Exception):
"""An error indicating that no solution was found.
Attributes
----------
iteration_limited
Whether the search failed because the maximum number
of iterations was reached.
"""
def __init__(self, iteratio... |
the-stack_106_31516 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_106_31517 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from graph_nets import modules
from graph_nets import utils_tf
import sonnet as snt
OBJ_HIDDEN = 8
REL_HIDDEN = 8
class SegmentClassifier(snt.AbstractModule):
def __init__(self, nam... |
the-stack_106_31518 | # Copyright 2010 New Relic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
the-stack_106_31520 | '''
Generative Adversarial Attacks - den Output des Netes beeinflussen
(z.B. andere Klasse ausgeben als eigentlich ist) durch Noise über ganzes Bild was für das menschliche Auge nicht sichtbar ist,
oder anbringen von Patches (kleine Bilder die dann im Vordergrund liegen) welche dann eine
z.B. andere Klassifizierung be... |
the-stack_106_31521 | from multiprocessing.pool import ThreadPool as Pool
import abc
import logging
from rtcclient import requests
import xmltodict
from rtcclient import urlunquote, OrderedDict
from rtcclient import exception
from rtcclient.utils import token_expire_handler
class RTCBase(object):
__metaclass__ = abc.ABCMeta
log = ... |
the-stack_106_31522 | from __future__ import absolute_import, division, print_function
import numpy as np
import torch
from torch.autograd import Variable
import pyro.distributions as dist
import pyro.poutine as poutine
import pyro.util as util
def _eq(x, y):
"""
Equality comparison for nested data structures with tensors.
"... |
the-stack_106_31525 | # 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_31526 | from django.template.loader import render_to_string
from django.utils.text import slugify
from crispy_forms import layout as crispy_forms_layout
from crispy_forms.utils import TEMPLATE_PACK, flatatt, render_field
from crispy_forms_gds.layout import Size
class Div(crispy_forms_layout.Div):
"""
A layout objec... |
the-stack_106_31527 | import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as la
from floq.helpers.index import n_to_i, i_to_n
from floq.helpers.numpy_replacements import numba_outer, numba_zeros
import floq.helpers.blockmatrix as bm
import floq.helpers.matrix as mm
import floq.errors as errors
import itertools
import cma... |
the-stack_106_31528 | import logging
from typing import Dict, List, Optional, Tuple
import aiosqlite
from spare.consensus.block_record import BlockRecord
from spare.types.blockchain_format.sized_bytes import bytes32
from spare.types.blockchain_format.sub_epoch_summary import SubEpochSummary
from spare.types.full_block import FullBlock
fro... |
the-stack_106_31530 | import matplotlib
from matplotlib.collections import PatchCollection
import matplotlib.cm
from matplotlib.axes import Axes
import matplotlib.transforms as transforms
from matplotlib import pyplot as plt
from matplotlib import rc
from shapely.geometry import Polygon
from collections import OrderedDict, defaultdict
impor... |
the-stack_106_31532 | import pytest
from pytest_cases.tests.example_code import super_function_i_want_to_test
from pytest_cases.tests.utils import nb_pytest_parameters, get_pytest_param
from pytest_cases import cases_data, CaseDataGetter, THIS_MODULE, cases_generator
try:
from pytest_cases import CaseData
except ImportError:
pass
... |
the-stack_106_31533 | # Copyright (c) 2020, Huawei Technologies.
# Copyright (c) 2019, NVIDIA CORPORATION.
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3... |
the-stack_106_31534 | import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="showtickprefix",
parent_name="densitymapbox.colorbar",
**kwargs
):
super(ShowtickprefixValidator, self).__init__(
... |
the-stack_106_31537 | import torch
import torch.nn as nn
import numpy as np
from torch.nn import functional as F
import math
class Mish(nn.Module):
def forward(self, x):
return x * torch.tanh(F.softplus(x))
class DiffusionEmbedding(nn.Module):
""" Diffusion Step Embedding """
def __init__(self, d_denoiser):
... |
the-stack_106_31538 | # 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... |
the-stack_106_31540 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from distutils.core import setup
from platform import python_implementation
from sys import version_info
from os.path import abspath, dirname, join
from setuptools import find_packages
__author__ = 'Leif Johansson'
__version__ = '1.1.2dev0'
here = abspath(dirname(__f... |
the-stack_106_31543 | import importlib
import inspect
import pdb
import logging
def load(name):
logging.info(f"Loading transformer {name}")
# Split name into file and method name?
parts = name.rsplit(".", 1)
module_name = parts[0]
if len(parts) == 1:
class_name = "default"
else:
class_name = parts[1]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.