filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_16060 |
# 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 applic... |
the-stack_0_16062 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from google.appengine.ext import ndb
from common.base_handler import BaseHandler, Permission
def _FormatDatetime(dt):
if not dt:
return None # prag... |
the-stack_0_16063 | #!/usr/bin/python -tt
# Expense Calculator
class Expense_Calculator(object):
def Expenses(self, Age, Retirement_Age, Inflation, Current_Expenses):
self.Future_Expenses={}
for x in range(Age,Retirement_Age+1):
if x==Age:
self.Future_Expenses[Age]=Current_Expenses
else:
self.Future_Expenses[x]=self.F... |
the-stack_0_16064 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
from django.conf import settings
from django.template import loader
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils.encoding import smart_str
from puppeteer_pdf.utils import (_options... |
the-stack_0_16065 | import os,sys
sys.path.append('../')
import numpy as np
import pandas as pd
from keras.callbacks import EarlyStopping
from keras.layers.advanced_activations import ReLU, PReLU
from keras.layers.core import Dense, Dropout
from keras.layers.normalization import BatchNormalization
from keras.models import Sequential
from... |
the-stack_0_16067 | from typing import List, Dict, Any, Optional
import logging
from pytrec_eval import RelevanceEvaluator
from haystack import MultiLabel, Label
from farm.evaluation.squad_evaluation import compute_f1 as calculate_f1_str
from farm.evaluation.squad_evaluation import compute_exact as calculate_em_str
logger = logging.getL... |
the-stack_0_16068 | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Validates V2 proto messages.
Internally, this module is a bit magical. It keeps a stack of fields currently
being validated per thread. It is used to con... |
the-stack_0_16069 | import sys
import random
import re
import asyncio
import aiohttp
import discord
from discord.ext import commands
import xml.etree.ElementTree as ET
import loadconfig
class anime(commands.Cog):
'''Alles rund um Animes'''
def __init__(self, bot):
self.bot = bot
async def cog_command... |
the-stack_0_16070 | _base_ = "finetune-eval-base.py"
# dataset settings
data_source_cfg = dict(
type="ImageNet",
memcached=False,
mclient_path='/no/matter',
# this will be ignored if type != ImageListMultihead
)
data_train_list = "data/flowers/meta/train-1000.txt"
data_train_root = 'data/flowers'
data_val_list = "... |
the-stack_0_16071 | #!/usr/bin/python
# This file is part of python-registry.
#
# Copyright 2011 Will Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... |
the-stack_0_16072 | # -*- coding: utf-8 -*-
from django.conf.urls import url
from django.urls import path
from . import views
urlpatterns = [
path('', views.AIPicsPageView.as_view(), name="list"),
path('<int:pk>', views.AIPicsDetailView.as_view(), name="detail"),
path('api/set-api-pic-state', views.ApiSetAiPicStateView.as_vi... |
the-stack_0_16073 | import altair as alt
from altair_transform import extract_data, transform_chart
import numpy as np
import pandas as pd
import pytest
@pytest.fixture
def data():
rand = np.random.RandomState(42)
return pd.DataFrame(
{
"x": rand.randint(0, 100, 12),
"y": rand.randint(0, 100, 12),... |
the-stack_0_16074 | import itertools
import re
from cytoolz import (
compose,
curry,
)
from eth_utils import (
remove_0x_prefix,
to_dict,
)
from .filesystem import (
is_under_path,
)
from .hexadecimal import (
hexbytes_to_hexstr,
)
from .string import (
normalize_class_name,
)
def is_project_contract(contr... |
the-stack_0_16075 | # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Copyright 2019 The OSArchiver Authors. All rights reserved.
"""
OSArchiver's Source class that implement a db backend
"""
import re
import time
import logging
import pymysql
import arrow
from numpy import array_spli... |
the-stack_0_16077 | # Original source: https://github.com/pytorch/examples/blob/master/fast_neural_style/neural_style/neural_style.py
import argparse
import os
import sys
import re
from PIL import Image
import torch
from torchvision import transforms
def load_image(filename, size=None, scale=None):
img = Image.open(filename)
if... |
the-stack_0_16078 | from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from .forms import Createform
from django.contrib import messages
@login_required
def editpost(request, id):
obj= get_object_or_404(Post, id=id)
form = Createform(request.POST or ... |
the-stack_0_16079 | import numpy
import pandas
import xarray as xr
import numpy as np
from dolo.numeric.optimize.ncpsolve import ncpsolve
from dolo.numeric.optimize.newton import newton as newton_solver
from dolo.numeric.optimize.newton import SerialDifferentiableFunction
## TODO: extend for mc process
def response(model, dr, varname, T... |
the-stack_0_16081 | import tensorflow as tf
import numpy as np
import cv2
# from .base_model import BaseModel
# from .utils import box_nms
def classical_detector_descriptor(im, **config):
im = np.uint8(im)
if config['method'] == 'sift':
sift = cv2.xfeatures2d.SIFT_create(nfeatures=1500)
keypoints, desc = sift.det... |
the-stack_0_16082 | # Copyright 2021 solo-learn development team.
# 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_0_16086 | #!/usr/bin/python3
from simulation import *
from integrators import *
import utils
import schemas
from pyspark.sql.session import SparkSession
import os
"""arguments"""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("dt", help="delta t for calculating steps",
type=float)
p... |
the-stack_0_16088 | #!/usr/bin/env python
#
# run phmmer against comma separated list of Uniprot IDs.
# produce csv of pairwise match alignment.
#
#
#
#
#
import argparse
import os
import sys
import logging
import traceback
import pandas as pd
gitpath=os.path.expanduser("~/git/cshlwork")
sys.path.append(gitpath)
from protlib import... |
the-stack_0_16090 | from copy import copy
from mysql.connector import MySQLConnection, Error
from python_mysql_dbconfig import read_db_config
import sys
import csv
import boto3
import json
import socket
def query_with_fetchone(query2run,secret,region):
try:
# Grab MySQL connection and database settings. We areusing AWS Secrets... |
the-stack_0_16093 | import time
from typing import Optional, Union, List, Dict, Tuple
import uuid
import aiohttp
from blob import Context
from config import Config
from helpers import userHelper
from lib import logger
from objects.constants import Privileges, Countries
from objects.constants.BanchoRanks import BanchoRanks
from objects.co... |
the-stack_0_16094 | from eth_utils import (
is_bytes,
)
from ssz.sedes import (
Serializable,
infer_sedes,
sedes_by_name,
)
from ssz.sedes.base import (
BaseSedes,
)
def encode(value, sedes=None, cache=True):
"""
Encode object in SSZ format.
`sedes` needs to be explicitly mentioned for encode/decode
... |
the-stack_0_16095 | # A OpenTraced server for a Python service that implements the store interface.
from __future__ import print_function
import time
import argparse
from collections import defaultdict
from six import iteritems
import grpc
from concurrent import futures
from jaeger_client import Config
from grpc_opentracing import ope... |
the-stack_0_16096 | #!/usr/bin/env python
from pvaccess import Channel
from pvaccess import PvBoolean
from pvaccess import PvByte
from pvaccess import PvUByte
from pvaccess import PvShort
from pvaccess import PvUShort
from pvaccess import PvInt
from pvaccess import PvUInt
from pvaccess import PvLong
from pvaccess import PvULong
from pvac... |
the-stack_0_16097 | """Django settings for workbench project."""
import json
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DJFS = {'type': 'osfs',
'directory_root': 'workbench/static/djpyfs',
'url_root': '/static/djpyfs'}
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEMPLATES = [
{
'BACKEND': 'djan... |
the-stack_0_16098 | import os
import re
import logging
from airbrake.notifier import Airbrake
from .secrets import config
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class AirbrakeNotifier:
MAX_NOTIFICATIONS = 50
airbrake_notifier = Airbrake(project_id=config['airbrake_project_id'], api_key=config['airb... |
the-stack_0_16099 | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_0_16100 | from cryptography.fernet import Fernet
def read_key():
file = open('key.ley', 'rb')
key = file.read()
file.close()
return key
def encrpyt(data):
key = read_key()
encoded_data = data.encode()
f = Fernet(key)
encrypted = f.encrypt(encoded_data)
encrypted_decoded_data = encrypted.deco... |
the-stack_0_16101 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# Description: an implementation of a deep learning recommendation model (DLRM)
# The model input consists of dense and sparse features. The ... |
the-stack_0_16102 | # Copyright 2017 Netflix, 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... |
the-stack_0_16103 | """Scraper for the Maryland Attorney General
CourtID: ag
Court Short Name: Maryland Attorney General
"""
import datetime
import os
from time import sleep
from lxml import html
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from juriscraper.AbstractSite import logger, pha... |
the-stack_0_16106 | import binascii
import hashlib
import hmac
import os
import random
import struct
from time import time
import iofree
def pack_uint16(s):
return len(s).to_bytes(2, "big") + s
def sni(host):
return b"\x00\x00" + pack_uint16(pack_uint16(pack_uint16(b"\x00" + host)))
def pack_auth_data(key, session_id):
... |
the-stack_0_16107 | """
Tests that rely on a server running
"""
import base64
import json
import datetime
import os
import pytest
from omnisci import connect, ProgrammingError, DatabaseError
from omnisci.cursor import Cursor
from omnisci._parsers import Description, ColumnDetails
from omnisci.thrift.ttypes import TOmniSciException
# XXX... |
the-stack_0_16109 | import discord, asyncio, random, time
from . import world, worldToImage, rpglang, menus
from .datatypes import RPGUser, BiomeType, LocationType, Biome, Location, ItemType, Item, Weapon, WeaponType, WAttribute, Chunk
from libs import modutil
from ..rpg import rpgcmd
from discord.ext import commands
import discord
def c... |
the-stack_0_16112 | # -*- coding: utf-8 -*-
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
'''
from __future__ import unicode_literals
from ..model.external_link ... |
the-stack_0_16114 | import argparse
import logging
import os
import random
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from networks.vit_seg_modeling import VisionTransformer as ViT_seg
from networks.vit_seg_modeling import CONFIGS as CONFIGS_ViT_seg
from trainer import trainer_synapse
from utils import Params
pa... |
the-stack_0_16115 |
from numpy import array, exp, linspace, sqrt, pi
import matplotlib.pyplot as plt
# Suppose we have the following dataset, which we believe is described by a
# Gaussian peak plus a constant background. Our goal in this example is to
# infer the area of the Gaussian.
x_data = [0.00, 0.80, 1.60, 2.40, 3.20, 4.00, 4.80,... |
the-stack_0_16116 | import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
from datetime import datetime
import dateutil.relativedelta
from plotly.subplots import make_subplots
class marketcapViewClass:
def getMarketcapContent(self, data, bgImage):
content = [dbc.Mod... |
the-stack_0_16117 | """ define the IntervalIndex """
from operator import le, lt
import textwrap
from typing import Any, Optional, Tuple, Union
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
from pandas._libs.interval import Interval, IntervalMixin, IntervalTree
from pandas._libs.tslibs import Tim... |
the-stack_0_16119 | """add discovery
Revision ID: 5a05464c07ae
Revises: c4a0292785e6
Create Date: 2017-09-06 21:55:21.193584
"""
# revision identifiers, used by Alembic.
revision = "5a05464c07ae"
down_revision = "c4a0292785e6"
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
o... |
the-stack_0_16120 | # PySpice example code
import matplotlib.pyplot as plt
import PySpice.Logging.Logging as Logging
from PySpice.Doc.ExampleTools import find_libraries
from PySpice.Probe.Plot import plot
from PySpice.Spice.Library import SpiceLibrary
from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *
logger = Logging.... |
the-stack_0_16123 | import hashlib
import itertools
import re
import sys
import warnings
from collections import defaultdict
from importlib import import_module
from types import ModuleType
from content_editor.models import Type
from django.conf import settings
from django.core.checks import Warning
from django.core.exceptions import Val... |
the-stack_0_16125 | import ipaddress, subprocess
from flask import request, Response
from flask_restful import Resource
from wgpt.models import db, Client, Server, Cluster, ClientSchema, ServerSchema, ClusterSchema
from wgpt.wg_ssh_update import send_ssh_command
clients_schema = ClientSchema(many=True)
client_schema = ClientSchema()
de... |
the-stack_0_16127 | # -*- coding: utf-8 -*-
import lemoncheesecake.api as lcc
from lemoncheesecake.matching import check_that, check_that_in, is_, is_str, is_list, is_integer, require_that, \
require_that_in, has_length
from common.base_test import BaseTest
SUITE = {
"description": "Method 'get_account_history'"
}
@lcc.prop("m... |
the-stack_0_16129 | # Sourced from here: https://python-forum.io/Thread-Learning-Python-with-a-Caesar-cipher?pid=131456#pid131456
# Modified by Drone4four
import string
def encrypt(message, shift=0, replace='', alphabet=string.ascii_letters):
reply = ''
for letter in message:
try:
position = alphabet.index... |
the-stack_0_16132 | import streamlit as st # streamlit run Location100_RF_streamlit.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
import warnings
from sklearn.model_selection import train_test_split, GridSearchCV, learning_curve, cross_val_score
from sklearn.metrics impo... |
the-stack_0_16133 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PapersBot
#
# purpose: read journal RSS feeds and tweet selected entries
# license: MIT License
# author: Nina Miolane
# e-mail: nmiolane@gmail.com
# inspired by: https://github.com/fxcoudert/PapersBot
import imghdr
import json
import os
import random
import re
... |
the-stack_0_16134 | """
Copyright 2017 Robin Verschueren, 2017 Akshay Agrawal
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... |
the-stack_0_16137 | import torch.nn as nn
import torch
class Model(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 3, 3)
self.relu1 = nn.ReLU()
self.mp1 = nn.MaxPool2d(2)
self.conv2 = nn.Conv2d(3, 3, 3)
self.relu2 = nn.ReLU()
self.mp2 = nn.MaxPool2d... |
the-stack_0_16140 | # 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 use ... |
the-stack_0_16141 | """Mock Server for simple calls the cli and public api make"""
from flask import Flask, request, g, jsonify
import os
import sys
from datetime import datetime, timedelta
import json
import yaml
import six
# HACK: restore first two entries of sys path after wandb load
save_path = sys.path[:2]
import wandb
sys.path[0:... |
the-stack_0_16143 | # Copyright 2019 Cloudera 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 writing... |
the-stack_0_16144 | # -*- coding: utf-8 -*-
import datetime
import logging
import os.path
import sqlite3
import string
from nmj.tables import ALL_TABLES, DbVersion, ScanDirs, ScanSystem, ShowGroups
_LOGGER = logging.getLogger(__name__)
INDEXES = [
"CREATE INDEX IDX_PHOTOS_TITLE ON PHOTOS(TITLE ASC);",
"CREATE INDEX IDX_PHOTOS_SEARCH... |
the-stack_0_16146 | #!/usr/bin/env python3
import telnetlib
import time
# yum install python3 (centos7.9)
# 要请求的IP和端口号
Host = '192.168.89.135'
Port = '22'
def do_telnet(Host, Port):
try:
tn = telnetlib.Telnet(Host, Port, timeout=5)
tn.close()
except:
return False
return True
while True:
time.sl... |
the-stack_0_16152 | import json
import requests
from web import config
CATEGORY = 1 # Magic the Gathering
PAGE_LENGTH = 100 # API's max items per page limit is 100
class TCGPlayerException(Exception):
pass
class NoResults(TCGPlayerException):
pass
def _send(
method: str,
endpoint: str,
params: any = None,
data: any = None,
... |
the-stack_0_16157 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import defaultdict
from . import Command
from ..benchmarks import Benchmarks
from ..machine import iter... |
the-stack_0_16159 | #!/usr/bin/env python
__author__ = "Mari Wahl"
__copyright__ = "Copyright 2014, The Cogent Project"
__credits__ = ["Mari Wahl"]
__license__ = "GPL"
__version__ = "4.1"
__maintainer__ = "Mari Wahl"
__email__ = "marina.w4hl@gmail.com"
from helpers import running, constants
# change here for type of net:
NETWORK_FI... |
the-stack_0_16160 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.mturk.core.worlds import MTurkOnboardWorld, MTurkTaskWorld
from parlai.mturk.core.agents import (
MTURK_D... |
the-stack_0_16161 | #!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
the-stack_0_16162 | import FWCore.ParameterSet.Config as cms
fftSimParam = cms.PSet(
NumOfFFT_Points = cms.int32(2048), # Length of signal, This should be an integer number with power of 2
SamplingRepetition = cms.int32(10) # FS: Sampling repetition per ns [1/ns]
)
TofCharge_Test = cms.PSet(
TofVector = cms.vdouble(0.0, 35.0),
Cha... |
the-stack_0_16163 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaebusiness.business import CommandExecutionException
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
from tekton.gae.middleware.json_middleware import JsonResponse, JsonUnsecureResponse
... |
the-stack_0_16164 | import json
from flask import Flask, request
from juggler import Juggler
app = Flask(__name__)
def apiresult(fn):
def _wrapper(*args, **kw):
result = None
error = None
try:
result = fn(*args, **kw)
except Exception as exception:
error = (
... |
the-stack_0_16166 | # -*- coding: utf-8 -*-
import autograd.numpy as np
from lifelines.utils import coalesce, _get_index, CensoringType
from lifelines.fitters import ParametricRegressionFitter
import pandas as pd
from lifelines.utils.safe_exp import safe_exp
class PiecewiseExponentialRegressionFitter(ParametricRegressionFitter):
r""... |
the-stack_0_16167 | # Copyright 2021 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, s... |
the-stack_0_16169 | from flask_wtf.file import FileField
from wtforms import Field
from wtforms.fields import Label
from wtforms.validators import InputRequired, Optional, ValidationError
from wtforms.widgets import TextInput
from re import search
from werkzeug.utils import secure_filename
def validate_filename(form, field):
'''... |
the-stack_0_16172 | from __future__ import print_function, division
from future import standard_library
standard_library.install_aliases()
from builtins import range
from builtins import object
import os
import pickle as pickle
import numpy as np
from DSVC import optim
class Solver(object):
"""
A Solver encapsulates all the lo... |
the-stack_0_16173 | # ckwg +29
# Copyright 2020 by Kitware, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... |
the-stack_0_16174 | import av
import os
from collections import OrderedDict
import importlib
from .base import EncoderConfig
vencoders = OrderedDict()
aencoders = OrderedDict()
sencoders = OrderedDict()
for codec in sorted(av.codecs_available):
try:
c = av.codec.Codec(codec, "w")
except Exception:
pass
els... |
the-stack_0_16175 | """KeysightDAQ enables controlling various Keysight DAQs."""
from __future__ import print_function
from typing import List, Optional, Union
import time
from pyvisainstrument.VisaResource import VisaResource
class KeysightDAQ(VisaResource):
""" KeysightDAQ enables controlling various Keysight DAQs.
Args:
... |
the-stack_0_16178 | from RecoTracker.IterativeTracking.LowPtQuadStep_cff import *
from HIPixelTripletSeeds_cff import *
from HIPixel3PrimTracks_cfi import *
hiLowPtQuadStepClusters = cms.EDProducer("HITrackClusterRemover",
clusterLessSolution = cms.bool(True),
trajectories = cms.InputTag("hiGlobalPrimTracks"),
overrideTrkQ... |
the-stack_0_16180 | # 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_0_16181 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import inspect
import logging
import requests
import xmltodict
from xml.parsers.expat import ExpatError
from optionaldict import optionaldict
from wechatpy.utils import random_string
from wechatpy.exceptions import WeChatPayException, In... |
the-stack_0_16183 | # Copyright 2020, 2021 by B. Knueven, D. Mildebrath, C. Muir, J-P Watson, and D.L. Woodruff
# This software is distributed under the 3-clause BSD License.
# Illustrate the use of sequential sampling for programmers using aircond.
#
import sys
import numpy as np
import argparse
import mpisppy.tests.examples.aircond as ... |
the-stack_0_16184 | # -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket 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 la... |
the-stack_0_16185 | # Copyright 2020 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_0_16188 | # coding=utf-8
# Copyright 2021-present, the Recognai S.L. team.
#
# 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 ... |
the-stack_0_16190 | import asyncio
import importlib
import logging
import os
import sys
import threading
import traceback
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from concurrent.futures.process import BrokenProcessPool
from numbers import Number
from operator import add
from time import sleep
from unittest i... |
the-stack_0_16191 | # Copyright 2018 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import logging
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from c7n_azure import constants
from c7n_azure.actions.logic_app import LogicA... |
the-stack_0_16193 | model = dict(
type='PAN',
backbone=dict(
type='resnet18',
pretrained=True
),
neck=dict(
type='FPEM_v1',
in_channels=(64, 128, 256, 512),
out_channels=128
),
detection_head=dict(
type='PA_Head',
in_channels=512,
hidden_dim=128,
... |
the-stack_0_16194 | from azure.cosmosdb.table.tableservice import TableService
from azure.cosmosdb.table.models import Entity, EntityProperty, EdmType
from database.models.Datum import Datum
from string import Template
import uuid
def generateRowKey():
return str(uuid.uuid4())
class DatumRepository:
def __init__(self):
self.tableS... |
the-stack_0_16195 | """Implementations for torch.nn.functional equivalent for MPC."""
# stdlib
from typing import Optional
from typing import Tuple
from typing import Union
# third party
import numpy as np
import torch
from sympc.session import get_session
from sympc.tensor import MPCTensor
from sympc.tensor import ShareTensor
from sym... |
the-stack_0_16196 | # Checks for an absolute error
# with an error of at most 1e-7
# Don't edit this file. Edit real_abs_rel_template.py instead, and then run _real_check_gen.py
from itertools import zip_longest
from decimal import Decimal, InvalidOperation
from kg.checkers import * ### @import
EPS = Decimal('1e-7')
EPS *= 1+Decima... |
the-stack_0_16197 | # Copyright (C) 2020-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from enum import Enum, auto
from math import gcd
import copy
import logging as log
import numpy as np
from datumaro.components.cli_plugin import CliPlugin
from datumaro.components.extractor import (
DEFAULT_SUBSET_NAME, AnnotationType, ... |
the-stack_0_16198 | from django.shortcuts import render
from django.utils.safestring import mark_safe
import json
from user.models import User
def room(request, room_name, user_name):
print('****')
room_json = mark_safe(json.dumps(room_name))
user_json = mark_safe(json.dumps(user_name))
online = User.objects.filter(is_... |
the-stack_0_16201 | import urllib.request,json
from .models import News_Sources, News_Articles
apiKey = None
base_url = None
news_article_url = None
def configure_request(app):
global apiKey, base_url,news_article_url
apiKey = app.config['NEWS_API_KEY']
base_url = app.config['NEWS_SOURCE_API_BASE_URL']
news_article_url =... |
the-stack_0_16203 | import _plotly_utils.basevalidators
class XbinsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="xbins", parent_name="histogram2dcontour", **kwargs):
super(XbinsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
the-stack_0_16204 | # Lint as: python3
# 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 ... |
the-stack_0_16205 | import random
from colour import Color
import numpy as np
from manimlib.constants import PALETTE
from manimlib.constants import WHITE
from manimlib.utils.bezier import interpolate
from manimlib.utils.simple_functions import clip_in_place
from manimlib.utils.space_ops import normalize
def color_to_rgb(color):
if... |
the-stack_0_16207 | # coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
the-stack_0_16209 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCL... |
the-stack_0_16210 | #-*- coding:utf-8 -*-
import json
import copy
import json
from flask import render_template, abort, request, url_for, redirect, g
from flask.ext.babel import gettext
import time
import datetime
from rrd import app
from rrd.model.screen import DashboardScreen
from rrd.model.graph import DashboardGraph
from rrd.model.e... |
the-stack_0_16211 | import asyncio
import functools
import traceback
import unittest
from tornado.concurrent import Future
from tornado import gen
from tornado.httpclient import HTTPError, HTTPRequest
from tornado.locks import Event
from tornado.log import gen_log, app_log
from tornado.simple_httpclient import SimpleAsyncHTTPClient
from ... |
the-stack_0_16212 | # Copyright 2018-2020 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 applicabl... |
the-stack_0_16213 | import os
import random
import argparse
import traceback
import numpy as np
import torch
from torch.optim import Adam
from torch.utils.data import DataLoader
from tokenizers import SentencePieceBPETokenizer
from transformers import GPT2Config, GPT2LMHeadModel
from tqdm import tqdm
from data import CustomDataset, dyna... |
the-stack_0_16219 | #--------------------- Packages
import pandas as pd
import dash_table
#--------------------- Datatable
def datatable_asset(df):
"""Function to create a datatable which is used to return the tweets and sentiment."""
datatable = dash_table.DataTable(
id='typing_formatting_1',
data=df.to_dict('reco... |
the-stack_0_16221 | # -*- coding:utf-8 -*-
# ! ./usr/bin/env python
# __author__ = 'zzp'
import cv2
import json
import glob
import numpy as np
from os.path import join
from os import listdir
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dir',type=str, default='./GOT_10k', help='your got_10k dat... |
the-stack_0_16222 | from functools import total_ordering
from typing import Dict, Union, Callable, Any
from cereal import log, car
import cereal.messaging as messaging
from common.realtime import DT_CTRL
from selfdrive.config import Conversions as CV
from selfdrive.locationd.calibrationd import MIN_SPEED_FILTER
AlertSize = log.ControlsS... |
the-stack_0_16223 | """This module defines custom management commands for the app admin."""
import asyncio
from asgiref.sync import sync_to_async
from typing import Dict, Optional, Union, List, Tuple
from decimal import Decimal
from django.core.management.base import BaseCommand
from django.db.models import Q
from stellar_sdk.exceptions ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.