filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_333 | # 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_0_334 | #------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describ... |
the-stack_0_335 | # stdlib
# stdlib
import dataclasses
from uuid import UUID
# third party
import sympc
from sympc.config import Config
from sympc.tensor import ShareTensor
# syft absolute
import syft
# syft relative
from ...generate_wrapper import GenerateWrapper
from ...proto.lib.sympc.share_tensor_pb2 import ShareTensor as ShareT... |
the-stack_0_336 | # -= ml_breakdown.py =-
# __ by Morgan Loomis
# ____ ___ / / http://morganloomis.com
# / __ `__ \/ / Revision 4
# / / / / / / / 2018-05-13
# /_/ /_/ /_/_/ _________
# /_________/
#
# ______________
# - -/__ License __/- - - - - - - - - - - - - - - - - - - - - - - - - -... |
the-stack_0_337 | import asyncio
import io
import userbot.plugins.sql_helper.no_log_pms_sql as no_log_pms_sql
from telethon import events, errors, functions, types
from userbot.utils import admin_cmd
from userbot.uniborgConfig import Config
@borg.on(admin_cmd(pattern="nccreatedch"))
async def create_dump_channel(event):
if Config... |
the-stack_0_338 | # -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import warnings
from rasa_core.actions import Action
from rasa_core.agent import Agent
from rasa_core.channels.con... |
the-stack_0_339 | """
.. module: cloudaux.aws.decorators
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Patrick Kelley <pkelley@netflix.com> @monkeysecurity
.. moduleauthor:: Mike Grima <mgrima@netflix.com>
"""
import functools
impo... |
the-stack_0_340 | # coding: utf-8
"""
FlashBlade REST API
A lightweight client for FlashBlade REST API 2.3, developed by Pure Storage, Inc. (http://www.purestorage.com/).
OpenAPI spec version: 2.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typ... |
the-stack_0_341 | "this program runs on ngc and syncs data with a local master machine"
import time
import os
import ray
@ray.remote
def sync(agentparams):
master_datadir = agentparams['master_datadir']
master = agentparams.get('master', 'deepthought')
local_datadir = '/result'
while True:
print('transfer tfre... |
the-stack_0_342 | import tensorflow as tf
from build_model import embedded_neural_net, compile_model
def train_model(train_dataset: tf.data.Dataset, validation_dataset: tf.data.Dataset, max_features, patience=4,
epochs=10):
callback = tf.keras.callbacks.EarlyStopping(monitor='val_loss', patience=patience)
model... |
the-stack_0_343 | import redis
r = redis.Redis()
from datetime import date
today = str(date.today())
import datetime
import pickle
existed = False
stand = [460, 1.3, .7]
def gas_lvl(gas):
status = 'normal'
gas = gas.replace(' ','')
gases = gas.split('|')
ox = float(gases[0])
red = float(gases[1])
nh = float(gas... |
the-stack_0_344 | # importation de pygame
import pygame
# importation de la bibliothèque system
import sys
# importation de nos classes
from Model.class_Hero import Hero
from Model.class_Platform import Platform
from Model.class_Atk import Atk
from Model.class_SacDeSable import SacDeSable
from utils import load_imgs
def exit_game(key)... |
the-stack_0_347 | import os
import mlflow
import random
import hashlib
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import classification_report
from sklearn.ensemble import RandomForestClass... |
the-stack_0_350 | from django.core.exceptions import ValidationError
from django.test.client import RequestFactory
from mock import patch
from nose.tools import assert_raises, eq_, ok_
from waffle import Flag
from flicks.base.regions import NORTH_AMERICA
from flicks.base.tests import TestCase
from flicks.videos.forms import VideoSearc... |
the-stack_0_354 | from ..Qt import QtGui, QtCore, QtWidgets
__all__ = ['BusyCursor']
class BusyCursor(object):
"""Class for displaying a busy mouse cursor during long operations.
Usage::
with pyqtgraph.BusyCursor():
doLongOperation()
May be nested.
"""
active = []
def __enter__(self):
... |
the-stack_0_355 | """
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, publish, distr... |
the-stack_0_356 | from adder.full_adder import FullAdder
from comparator.comparator import Comparator
from decoder.decoder_mxn import Decoder_nxm
from flipflop.d import D_FlipFlop
from gate.and_gate import And
from gate.input_gate import Input
from gate.one_gate import One
from gate.or_gate import Or
from gate.xor_gate import Xor
from g... |
the-stack_0_357 | import re
import gevent
from gevent.pywsgi import WSGIHandler
from socketio import transports
from geventwebsocket.handler import WebSocketHandler
class SocketIOHandler(WSGIHandler):
path_re = re.compile(r"^/(?P<resource>[^/]+)/(?P<transport>[^/]+)(/(?P<session_id>[^/]*)/?(?P<rest>.*))?$")
handler_types = {
... |
the-stack_0_359 | def get_set():
return set(map(int, input().split()))
def is_super_set(main, sets):
for set in sets:
if not main.issuperset(set):
return False
return True
A = get_set()
queries = int(input())
sets = []
for _ in range(queries):
sets.append(get_set())
print(is_super_set(A, sets))... |
the-stack_0_360 | # SPDX-License-Identifier: Apache-2.0
import os
from distutils.version import StrictVersion
import numpy as np
import onnx
from onnxruntime import __version__ as ort_version
from skl2onnx import __max_supported_opset__ as max_opset
from skl2onnx.common._topology import OPSET_TO_IR_VERSION
from .tests_helper import dum... |
the-stack_0_361 | """
Base and utility classes for pandas objects.
"""
import builtins
from collections import OrderedDict
import textwrap
from typing import Dict, FrozenSet, Optional
import warnings
import numpy as np
import pandas._libs.lib as lib
from pandas.compat import PYPY
from pandas.compat.numpy import function as nv
from pan... |
the-stack_0_362 | # Lint as: python3
# Copyright 2018, The TensorFlow Federated 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 ... |
the-stack_0_363 | import argparse
import torch
torch.cuda.current_device()
import torch.optim as optim
from painter import *
# settings
parser = argparse.ArgumentParser(description='STYLIZED NEURAL PAINTING')
parser.add_argument('--img_path', type=str, default='./test_images/sunflowers.jpg', metavar='str',
... |
the-stack_0_364 | import base64
import json
import os
import sys
import re
from logging import getLogger, StreamHandler, INFO
from google.cloud import storage
age = os.environ.get('LIFECYCLE_EXPIRE')
ignorePatterns = os.environ.get('IGNORE_PATTERNS')
logger = getLogger(__name__)
handler = StreamHandler()
handler.setLevel(INFO)
logger.... |
the-stack_0_365 | # Copyright 2018 Changan Wang
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software... |
the-stack_0_370 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoinold Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
assumevalid.py
Test logic for skipping signature validation on blocks which we've assumed
valid (h... |
the-stack_0_371 |
from setuptools import find_packages, setup
from pathlib import Path
this_directory = Path(__file__).parent
readme = (this_directory / "README.md").read_text()
setup(
name='sentencesimilarity',
packages=find_packages(),
version='0.1.1',
description='Calculates semantic similarity between given sente... |
the-stack_0_372 | # -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect
class PublicTransit:
def distRaw(self, R, C, i1, j1, i2, j2):
# q = [(i1, j1, 0)]
# deltas = [(1, 0), (-1, 0), (0, -1), (0, 1)]
# while q:
# i, j, d = q.pop(0)
# if i ==... |
the-stack_0_373 | # coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import json
import re
import sys
import yaml
environment_file = '.ci_support/environment.yml'
name_mapping_file = '.ci... |
the-stack_0_374 | # coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
the-stack_0_375 | import os
import sys
module_path = os.path.abspath(os.path.join('../models/'))
print(module_path)
if module_path not in sys.path:
sys.path.append(module_path)
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
import numpy as np
import cv2
import time
if to... |
the-stack_0_376 | # -*- coding: utf-8 -*-
"""
Python Slack Bot class for use with the pythOnBoarding app
"""
import os
from slackclient import SlackClient
# To remember which teams have authorized your app and what tokens are
# associated with each team, we can store this information in memory on
# as a global object. When your bot is... |
the-stack_0_377 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... |
the-stack_0_380 | # 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_0_385 | # -*- encoding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import itertools
import h2o
from h2o.job import H2OJob
from h2o.frame import H2OFrame
from h2o.exceptions import H2OValueError
from h2o.estimators.estimator_base import H2OEstimator
from h2o.two_dim_table impo... |
the-stack_0_386 | # -*- coding: utf-8 -*-
import os
from nbformat.v4.nbbase import new_notebook, new_code_cell, new_markdown_cell, new_raw_cell
from jupytext.compare import compare, compare_notebooks
import jupytext
def test_read_simple_file(script="""# ---
# title: Simple file
# ---
# %% [markdown]
# This is a markdown cell
# %% [... |
the-stack_0_389 | if __name__ == "__main__":
import os
import sys
sys.path.append(os.getcwd() + "/../../")
import pandas as pd
import itertools
from kge_from_text import folder_definitions as fd
import kge_from_text.models.term_embeddings as tt
import kge_from_text.bridges.clean_bridge as bridge
fr... |
the-stack_0_390 | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... |
the-stack_0_392 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import tensorflow as tf
from tensorflow.python import ipu
from ipu_tensorflow_addons.keras.layers import Embedding, LSTM
from tensorflow.keras.layers import Dense
from tensorflow.keras.datasets import imdb
from tensorflow.keras.preprocessing import sequence
fro... |
the-stack_0_393 | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
from datadog_api_client.v2.model_uti... |
the-stack_0_394 | from .claims import Claims
from .cose import COSE
from .cose_key import COSEKey
from .cwt import (
CWT,
decode,
encode,
encode_and_encrypt,
encode_and_mac,
encode_and_sign,
set_private_claim_names,
)
from .encrypted_cose_key import EncryptedCOSEKey
from .exceptions import CWTError, DecodeErr... |
the-stack_0_395 | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pacvim(MakefilePackage):
"""Pacvim is a command-line-based game based off of Pacman.
... |
the-stack_0_396 | #!/usr/bin/python3.6
activate_this = '/home/ubuntu/flaskapp/venv/bin/activate_this.py'
with open(activate_this) as f:
exec(f.read(), dict(__file__=activate_this))
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/home/ubuntu/flaskapp/flaskapp/")
from manage import app as applicati... |
the-stack_0_398 | import _plotly_utils.basevalidators
class SmoothingValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="smoothing", parent_name="carpet.aaxis", **kwargs):
super(SmoothingValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... |
the-stack_0_399 | import numpy as np
from finitewave.core.model import CardiacModel
from finitewave.cpuwave2D.model.aliev_panfilov_2d.aliev_panfilov_kernels_2d \
import AlievPanfilovKernels2D
_npfloat = "float64"
class AlievPanfilov2D(CardiacModel):
def __init__(self):
CardiacModel.__init__(self)
self.v = np.... |
the-stack_0_401 | # TIPS: only used to find the best epoch of MLP
# MLP
import csv
from itertools import islice
import random
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neural_network import MLPRegressor
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import KFold, train_test_split
impor... |
the-stack_0_402 | import logging
from google.appengine.ext import db
from google.appengine.api import memcache
from app.utility.utils import memcached
import app.utility.utils as utils
import app.db.counter as counter
import web
QUESTIONS_PER_SITEMAP = 500
class Sitemap(db.Model):
question_count = db.IntegerProperty(default = ... |
the-stack_0_403 | from django.shortcuts import render
from django.contrib.auth.models import User
from django.http import HttpResponse
from .models import Form
from .forms import ReqForm
from .filters import FormFilter
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.shortcuts import redirect
def... |
the-stack_0_404 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# License: BSD-3 (https://tldrlegal.com/license/bsd-3-clause-license-(revised))
# Copyright (c) 2016-2021, Cabral, Juan; Luczywo, Nadia
# All rights reserved.
# =============================================================================
# DOCS
# =========================... |
the-stack_0_406 | """The tests for the Restore component."""
from datetime import datetime
from unittest.mock import patch
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.core import CoreState, State
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity import Entity
from... |
the-stack_0_409 | import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, Flatten, Dense, Conv2DTranspose, Lambda, Reshape, Layer
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import backend as K
INPUT_DIM = (64,64,3)
CONV_FILTERS = ... |
the-stack_0_410 | from utils import prefer_envar
from logs.logger import log
from logs.log_utils import log_json
from config.reddit.reddit_sub_lists import REDDIT_APPROVED_SUBS
from config.reddit.config_gen import config_gen
import sys
import json
import os
if os.path.isfile('config.json'):
file = open("config.json", "r")
AUTH = pr... |
the-stack_0_411 | from django.http import JsonResponse
from django.utils import timezone
from django.contrib.sessions.models import Session
from rest_framework import views, viewsets, authentication
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.parsers import JSONParser
fro... |
the-stack_0_415 | # Copyright (c) 2017 The Verde Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
Add license notice to every source file if not present
"""
import sys
from argparse import ... |
the-stack_0_416 | # Copyright 2019, The TensorFlow Federated 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 ... |
the-stack_0_417 | #!/usr/bin/env python3
# Copyright (c) 2018-2021 The Xaya developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test spendability of premine and that P2SH is enforced correctly for it."""
from test_framework.test_framework... |
the-stack_0_418 | from re import search
from setuptools import setup, find_packages
with open("graphql/__init__.py") as init_file:
version = search('__version__ = "(.*)"', init_file.read()).group(1)
with open("README.md") as readme_file:
readme = readme_file.read()
setup(
name="GraphQL-core-next",
version=version,
... |
the-stack_0_420 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import sys
from datetime import datetime, timedelta
import operator
import string
from inspect import getargspec
from itertools import product, starmap
from distutils.version import LooseVersion
import nose
from numpy import nan, inf
import numpy as np
import numpy.ma... |
the-stack_0_421 | import os
from os import path
from pathlib import Path
from shutil import rmtree
from typing import Union
from pyspark.sql.types import DataType
from pyspark.sql.types import StructType
from spark_fhir_schemas.r4.complex_types.address import AddressSchema
from spark_fhir_schemas.r4.resources.explanationofbenefit impor... |
the-stack_0_422 | from __future__ import division
from __future__ import print_function
import os
# disable autotune
os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
import argparse
import glob
import logging
logging.basicConfig(level=logging.INFO)
import time
import numpy as np
import mxnet as mx
from tqdm import tqdm
from mxnet impor... |
the-stack_0_423 | # -*- coding: utf-8 -*-
"""
pygments.styles.rrt
~~~~~~~~~~~~~~~~~~~
pygments "rrt" theme, based on Zap and Emacs defaults.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Com... |
the-stack_0_424 | from scraping.funtion import html_convert_python
def get_data_page_locate(url):
soup = html_convert_python( url )
data = []
for row in soup.find("ul", {"id": "postcode-list"}).find_all("li"):
url = row.find('a').attrs['href']
data.append(url)
return data
def get_data_page_region(u... |
the-stack_0_425 | #!/usr/bin/env python
#encoding: utf8
#
# Copyright © Burak Arslan <burak at arskom dot com dot tr>,
# Arskom Ltd. http://www.arskom.com.tr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are m... |
the-stack_0_426 | __author__ = 'dereyly'
import sys
#sys.path.append('/home/dereyly/progs/caffe_cudnn33/python_33')
#sys.path.append('/home/dereyly/progs/caffe-master-triplet/python')
import caffe
import numpy as np
'''
layer {
name: 'rcls_lost_my'
type: 'Python'
bottom: 'feats'
bottom: 'labels'
top: 'cls_lost_my'
python_pa... |
the-stack_0_428 |
"""
Runs one instance of the Atari environment and optimizes using DQN algorithm.
Can use a GPU for the agent (applies to both sample and train). No parallelism
employed, so everything happens in one python process; can be easier to debug.
The kwarg snapshot_mode="last" to logger context will save the latest model at... |
the-stack_0_431 | from datetime import datetime
from pathlib import Path
from tkinter import *
from tkinter import filedialog
from docxtpl import DocxTemplate
import xlrd
import os
import configparser
import sys
def resource_path(relative_path):
if getattr(sys, 'frozen', False):
base_path = sys._MEIPASS
else:
... |
the-stack_0_432 | """
Data structures for sparse float data. Life is made simpler by dealing only
with float64 data
"""
# pylint: disable=E1101,E1103,W0231
from numpy import nan, ndarray
import numpy as np
import warnings
import operator
from pandas.core.common import isnull, _values_from_object, _maybe_match_name
from pandas.core.in... |
the-stack_0_433 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""BYOL tasks."""
import random
from typing import Any, Callable, Dict, Optional, Tuple, cast
import torch
import torch.nn.functional as F
from kornia import augmentation as K
from kornia import filters
from kornia.geometry... |
the-stack_0_434 | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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_437 | # Copyright 2018 The TensorFlow Hub 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 app... |
the-stack_0_438 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.template import TemplateDoesNotExist
from django.template.loader import select_template
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from js_servic... |
the-stack_0_440 | import sys
import yaml
import os
def getcsv(argv):
if len(argv) == 0:
print("No input files given.")
else:
flag = True
out_string = ''
keys = ['L1c', 'L1b', 'L1a', 'L2c', 'L2b', 'L2a', 'L2prf',
'TLBe', 'TLBp', 'TLBa', 'IPC',
'Total_Instructions', 'Total_Cycles',
'L1-Total-Misses', 'L1-Load-Misses... |
the-stack_0_441 | import random
import numpy as np
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from .auto_augment import cutout, apply_policy
from .utils import *
class Cifar10ImageDataGenerator:
def __init__(self, args):
self.datagen = ImageDataGenerator(width_shift_range=0.1, height_shift_range=0... |
the-stack_0_443 | #!/usr/bin/env python
"""Implementation of various cryptographic types."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import binascii
import hashlib
import logging
import os
from cryptography import exceptions
from cryptography import x509
from cry... |
the-stack_0_444 | # Copyright 2019 Google LLC
#
# 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 conditions and the following disclaimer.
# ... |
the-stack_0_446 | #coding=utf-8
HOST = ''
PORT = 50008
# maximum sleep time while there is no connect for a smv process
MAX_SLEEP_TIME = 5
# time out in seconds
TIME_OUT = 5
MU_CHECK_TIMEOUT = 600
MU_CHECK_MEMORY = 1024
# path to NuSMV
SMV_PATH = '/home/lyj238/Downloads/NuSMV/bin/NuSMV'
MU_PATH = '/home/lyj238/Downloads/cmurphi5.4.9... |
the-stack_0_447 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ImportJobRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key i... |
the-stack_0_448 | import cv2
import os
import numpy as np
import random
# 例子为:在NEU-CLS数据集上操作的。
# 在合成后数据集中随机选取若干张数据作为新的数据集。
image_dir = '/content/drive/MyDrive/colab/multiClass/NEU-CLS'
# 打乱原始数据集顺序
img_path = []
for name in os.listdir(image_dir):
img_path.append(os.path.join(image_dir, name))
random.shuffle(img_pat... |
the-stack_0_449 | import discord
import random
import asyncio
import discord
from discord.ext import commands, tasks
class Prescence(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.prescence_default.start()
self.ctfu_rgblighting.start()
def cog_unload(self):
self.prescence_default.c... |
the-stack_0_450 | import random
import string
from time import time
from settings import URL, CHATS_COLLECTION_NAME
from .base import CommandBase
class CommandStart(CommandBase):
async def __call__(self, payload):
self.set_bot(payload)
registered_chat = self.sdk.db.find_one(CHATS_COLLECTION_NAME, {'chat': payloa... |
the-stack_0_451 | import unittest
from .framework import selenium_test, SeleniumTestCase
class ToolDescribingToursTestCase(SeleniumTestCase):
def setUp(self):
super().setUp()
self.home()
@selenium_test
def test_generate_tour_no_data(self):
"""Ensure a tour without data is generated and pops up.""... |
the-stack_0_452 | #!/usr/bin/env python
import fileinput
jumps = [int(jump) for jump in fileinput.input()]
clock, pc, max_pc = 0, 0, 0
while pc < len(jumps):
jump = jumps[pc]
jumps[pc] += 1
pc += jump
clock += 1
if pc > max_pc:
max_pc = pc
print("%09d: %04d" % (clock, pc))
print(clock)
|
the-stack_0_454 | # vim:ts=4:sts=4:sw=4:expandtab
"""Matching Clients with event queues.
"""
import collections
from satori.objects import Object
from satori.events.misc import Namespace
class Dispatcher(Object):
"""Abstract. Dispatches Events to Clients.
"""
def __init__(self):
self.queues = dict()
sel... |
the-stack_0_456 | import logging
log = logging.getLogger('onegov.form') # noqa
log.addHandler(logging.NullHandler()) # noqa
from translationstring import TranslationStringFactory
_ = TranslationStringFactory('onegov.form') # noqa
from onegov.form.collection import (
FormCollection,
FormSubmissionCollection,
FormDefiniti... |
the-stack_0_459 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2019 Snowflake Computing Inc. All right reserved.
#
import os
import random
import re
import string
import time
import pytest
from conftest import get_engine
from mock import patch
from parameters import CONNECTION_PARAMETERS
from snowflake.connector... |
the-stack_0_460 | """
ZetCode PyQt5 tutorial
This example shows an icon
in the titlebar of the window.
Author: Jan Bodnar
Website: zetcode.com
Last edited: August 2017
"""
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon
class Example(QWidget):
def __init__(self):
... |
the-stack_0_461 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
import freezegun
import pytest
import update_ext_version
TEST_DATETIME = "2022-03-14 01:23:45"
# The build ID is calculated via:
# "1" + datetime.datetime.strptime(TEST_DATETIME,"%Y-%m-%d %H:%M:%S").strftim... |
the-stack_0_466 | def imc (peso,altura):
valor = peso / altura **2
if valor <18:
return "Delgadez"
elif valor <25:
return "Normal"
elif valor <29:
return "Sobrepeso"
else:
return "Obesidad"
valor_imc = imc (58,1.55)
print (valor_imc)
|
the-stack_0_468 | # Copyright 2014 The Oppia 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 applicable ... |
the-stack_0_470 | """Provides the 'OffshoreSubstationDesign` class."""
__author__ = "Jake Nunemaker"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "Jake.Nunemaker@nrel.gov"
import numpy as np
from ORBIT.phases.design import DesignPhase
class OffshoreSubstationD... |
the-stack_0_473 | from __future__ import absolute_import
from mock import MagicMock, patch
from sentry.testutils.cases import RuleTestCase
from sentry.rules.actions.notify_event_service import NotifyEventServiceAction
from sentry.tasks.sentry_apps import notify_sentry_app
class NotifyEventServiceActionTest(RuleTestCase):
rule_cl... |
the-stack_0_474 | import pytest
import torch as to
import torch.nn as nn
from functools import partial
from tqdm import tqdm
from pyrado.sampling.utils import gen_batches, gen_ordered_batches
from pyrado.utils.data_types import *
from pyrado.utils.functions import noisy_nonlin_fcn
from pyrado.utils.math import cosine_similarity, cov
fr... |
the-stack_0_475 | # --------------
# import packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import re
from nltk.corpus import stopwords
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.naiv... |
the-stack_0_476 | from bisect import bisect_right
from itertools import accumulate
from math import inf, sqrt
from numbers import Number
class ApproximateHistogram:
"""
Streaming, approximate histogram
Based on http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf
Performance of adding a point is about 5x faste... |
the-stack_0_477 | import numpy as np
def scroll(clip, h=None, w=None, x_speed=0, y_speed=0,
x_start=0, y_start=0, apply_to="mask"):
""" Scrolls horizontally or vertically a clip, e.g. to make fin
credits """
if h is None: h = clip.h
if w is None: w = clip.w
xmax = clip.w-w-1
ymax = clip.h-h-1... |
the-stack_0_478 | """Non-Maximum Suppression module."""
import numpy as np
import torch
def nms(detections, threshold):
"""Apply Non-Maximum Suppression over the detections.
The detections must be a tensor with two dimensions: (number of detections, 5).
Why 5? Because a detection has x1, y1, x2, y2 and score.
Heavily ... |
the-stack_0_479 | import os
from functools import partial
import numpy as np
import pandas as pd
import tables
import matplotlib
import warnings
from PyQt5.QtCore import Qt, QPointF
from PyQt5.QtGui import QPixmap, QPainter, QFont, QPen, QPolygonF, QColor, QKeySequence, QBrush
from PyQt5.QtWidgets import QApplication, QMessageBox
from... |
the-stack_0_480 | from typing import List
import numpy as np
class DNNLayer:
def __init__(self, out_shape, depends_on: List["DNNLayer"] = tuple(), param_count=0):
assert out_shape is not None # get around varargs restriction
self.extra_repr_params = {}
self.unique_idx = "{}{:02d}".format(self.__class__.__n... |
the-stack_0_481 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TradeFundBillDetail(object):
def __init__(self):
self._amount = None
self._asset_type_code = None
self._asset_user_id = None
self._biz_pay_type = None
self... |
the-stack_0_483 | '''
There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given the total number of courses and a list of prerequisite pairs, is it possible for yo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.