filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_30710 | #!/usr/bin/env python3
# ver 0.1 - copy from rdf_itf.py (v0.1) and modify codes on 2/3/2018
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='calculation scaling of Ree of single chain')
## args
parser.add_argument('-i', '--input', default... |
the-stack_106_30713 | # Copyright 2013-2020 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 SuiteSparse(Package):
"""
SuiteSparse is a suite of sparse matrix algorithms
"""
... |
the-stack_106_30715 | """
Author of this code work, Tsubasa Kuwabara. c FFRI Security, Inc. 2020
"""
import subprocess
import shutil
import os
import json
from util import extract_file_recursive
CWD_DIR = os.getcwd()
def is_die_packingdata_detectable(path, result):
label = os.path.basename(os.path.dirname(path))
l... |
the-stack_106_30717 | #
# squeeze paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle as pdpd
import sys
data_type = 'float32'
def squeeze(name : str, x, axes : list):
pdpd.enable_static()
with pdpd.static.program_guard(pdpd.static.Program(), pdpd.static.Program()):
node_x = pdpd.sta... |
the-stack_106_30718 | import pytest
from tests.support.inline import inline
# 15.1.3 "Let source be the result returned from the outerHTML IDL attribute
# of the document element"
def test_source_matches_outer_html(session):
session.url = inline("<html><head><title>Cheese</title><body>Peas")
expected_source = session.exec... |
the-stack_106_30719 | import opensim
import math
import numpy as np
import os
from .utils.mygym import convert_to_gym
import gym
class Osim(object):
# Initialize simulation
model = None
state = None
state0 = None
joints = []
bodies = []
brain = None
maxforces = []
curforces = []
... |
the-stack_106_30720 | import torch
from torch import nn
class FeedForward(nn.Module):
def __init__(self, dim, hidden_dim, dropout = 0.):
super().__init__()
self.net = nn.Sequential(
nn.Linear(dim, hidden_dim),
nn.GELU(),
nn.Dropout(dropout),
nn.Linear(hidden_dim, dim),
... |
the-stack_106_30721 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.autograd import Variable
import numpy as np
def variable_hook(grad):
return grad
def one_hot(y,depth,cuda=True):
if not cuda:
y_onehot = torch.FloatTensor(y.size(0),d... |
the-stack_106_30728 | import os
import tempfile
import pytest
from sqli.vuln_app import create_app
@pytest.fixture
def vulnerable_app():
db_fd, db_path = tempfile.mkstemp()
app = create_app({"VULNERABLE": True, "DATABASE": db_path})
yield app
os.close(db_fd)
os.unlink(db_path)
@pytest.fixture()
def patched_app():
... |
the-stack_106_30735 | # Copyright 2013-2020 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 Snphylo(Package):
"""A pipeline to generate a phylogenetic tree from huge SNP data"""
... |
the-stack_106_30737 | import sys, argparse, logging
import pandas as pd
import numpy as np
import matplotlib.colors
import matplotlib.pyplot as plt
from adjustText import adjust_text
color_map_green_yellow_red = matplotlib.colors.LinearSegmentedColormap.from_list("", ["green","yellow","red"])
def gradient_image(ax, extent, direction=0.... |
the-stack_106_30738 | import re
def input_error(func):
def inner(adress_book, com):
my_error_1 = "Missing name in database!"
my_error_2 = "Wrong phone-number (must be in format XXX-XXX-XX-XX)!"
my_error_3 = "You maked the fail by inputing the command!"
my_error_4 = "You maked the fail by inputing the num... |
the-stack_106_30740 | """
MIT License
Copyright (c) 2019 Soham Pal, Yash Gupta, Aditya Shukla, Aditya Kanade,
Shirish Shevade, Vinod Ganapathy. Indian Institute of Science.
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 Softw... |
the-stack_106_30742 | import pytest # noqa: F401
import pyomo.core as po
from calliope.test.common.util import build_test_model as build_model
from calliope.backend.pyomo.util import get_domain, get_param, invalid
@pytest.fixture(scope="class")
def model():
return build_model({}, "simple_supply,two_hours,investment_costs")
class ... |
the-stack_106_30744 | # Copyright © 2019 Province of British Columbia
#
# 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 agr... |
the-stack_106_30747 | """
Replaces values in multiple dataframes based on Pandas `replace` method.
"""
from tasrif.processing_pipeline import PandasOperator
from tasrif.processing_pipeline.validators import InputsAreDataFramesValidatorMixin
class ReplaceOperator(InputsAreDataFramesValidatorMixin, PandasOperator):
"""Replaces a value b... |
the-stack_106_30748 | #
# 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 us... |
the-stack_106_30749 | #!/usr/bin/python3
import os,sys,time,pathlib
import filelist as fl
from datetime import datetime
from options import sizeonly,ignoretimes,update, ignore_existing
from message import send,receive,verbose
from sender import pickling, cleaner
def get_lastname(p):
return os.path.normpath(os.path.basename(p))
def g... |
the-stack_106_30751 | '''https://practice.geeksforgeeks.org/problems/count-bst-nodes-that-lie-in-a-given-range/1
Count BST nodes that lie in a given range
Medium Accuracy: 50.5% Submissions: 52649 Points: 4
Given a Binary Search Tree (BST) and a range l-h(inclusive), count the number of nodes in the BST that lie in the given range.
The va... |
the-stack_106_30752 | import io
import pickle
import lmdb
import torch
from PIL import Image
from torch.utils.data import Dataset
def pickle_reader(byte_str):
return pickle.loads(byte_str)
def torch_reader(byte_str):
return torch.load(io.BytesIO(byte_str), map_location=lambda storage, loc: storage)
def raw_reader(byte_str):
... |
the-stack_106_30753 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
import csv
import pickle as pkl
class SkipGram(nn.Module):
def __init__(self, vocab_size, embedding_size):
... |
the-stack_106_30755 | import os
import cv2
import numpy as np
from skimage import transform
import torch
import torch.nn.functional as NF
def parse_batch(batch, device):
batch['image1'] = batch['image1'].to(device, dtype=torch.float)
batch['img1_info'] = batch['img1_info'].to(device, dtype=torch.float)
batch['homo12'] = batch[... |
the-stack_106_30756 | # coding:utf-8
#!/usr/bin/python
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# -- This line is 75 characters ------------------------------------------... |
the-stack_106_30757 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import math
from django.template import Library
from django.utils import six
register = Library()
# The templatetag below is copied from sorl.thumbnail
filesize_formats = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
filesize_long_formats = {
'k': 'kil... |
the-stack_106_30758 | """The module is used to convert the sklearn.svm.SVC
into a Flutter/Dart model."""
import numpy as np
from sklearn.svm import SVC, LinearSVC
from .base import SKLiteBase
class SkliteSVCClassifier(SKLiteBase):
"""SVC implementation."""
@property
def validate_(self) -> str:
"""In order to check wh... |
the-stack_106_30759 | # coding:utf-8
# flake8: noqa
import json
from input_adapter import InputDevAdapter
from assistant.adapters.storage.storage_adapter import StorageAdapter
class CRMAdapter(InputDevAdapter):
def __init__(self, file_path):
super(CRMAdapter, self).__init__()
self.file_path = file_path
sel... |
the-stack_106_30760 | # Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
the-stack_106_30761 | from enum import Enum
from .header import MgmtHeader, MgmtGroup, MgmtOp, MgmtErr, CmdBase, RequestBase, ResponseBase
import cbor
import time
import sys
class MgmtIdImg(Enum):
STATE = 0
UPLOAD = 1
FILE = 2
CORELIST = 3
CORELOAD = 4
ERASE = 5
class SlotDescription(object):
_fl... |
the-stack_106_30762 | # Copyright 2011 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a co... |
the-stack_106_30766 | # Contribution from @fredguth, https://github.com/fredguth/fastai_playground.
from fastai.torch_core import *
from fastai.callback import *
from fastai.basic_train import *
__all__ = ['TerminateOnNaNCallback', 'EarlyStoppingCallback', 'SaveModelCallback', 'TrackerCallback', 'ReduceLROnPlateauCallback' ]
class Termin... |
the-stack_106_30767 | import os
import sys
from setuptools import setup, find_packages
os.environ["DJANGO_SETTINGS_MODULE"] = "test_project.settings"
# Add test_plus to Python path
BASE_DIR = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(BASE_DIR, "test_project"))
f = open(os.path.join(BASE_DIR, "README.md"))
readme = f.read... |
the-stack_106_30768 | from os import path, mkdir
from time import sleep
from colorama import init
from src.generator import main
from src.interface.menu import color_text, main_menu
from requests import get
from re import findall
__version__ = "1.0.3"
def choose(valid):
while True:
try:
entry = str(input(valid)).s... |
the-stack_106_30772 | # -*- coding: utf-8 -*-
# Copyright 2019-2021 CERN
#
# 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 a... |
the-stack_106_30774 | import sys
import os
import json
import xml.etree.ElementTree as ET
START_BOUNDING_BOX_ID = 1
PRE_DEFINE_CATEGORIES = {}
# If necessary, pre-define category and its id
# PRE_DEFINE_CATEGORIES = {"aeroplane": 1, "bicycle": 2, "bird": 3, "boat": 4,
# "bottle":5, "bus": 6, "car": 7, "cat": 8, "... |
the-stack_106_30775 | # -*- coding: utf-8 -*-
from __future__ import print_function
import os
import textwrap
import logging
from . import cli
log = logging.getLogger(__name__)
def is_module(directory):
"""A directory is a module if it contains an ``__init__.py`` file.
"""
return os.path.isdir(directory) and '__init__.py' in... |
the-stack_106_30776 | import tensorflow as tf
from modelv4tiny import yolov4tiny
from utils.misc_utils import parse_anchors, load_weights
num_class = 80
img_size = 416
weight_path = './data/darknet_weights_v4tiny/yolov4-tiny.weights'
save_path = './data/darknet_weights_v4tiny/yolov4-tiny.ckpt'
anchors = parse_anchors('./data/yolo_tiny_anc... |
the-stack_106_30779 | import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import agentframework
import agentstorage
import csv
import random
import argparse
import tkinter
import requests
import bs4
# Quitter function from tkinter loop
# From: https://stackoverflow.com/a... |
the-stack_106_30780 | # 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_30781 | from CharLvl_NMT import *
from encoder import cnn_encoder, rnn_encoder
from decoder import AttnDecoderRNN
class CharLevel_autoencoder(nn.Module):
def __init__(self, criterion, num_symbols, use_cuda):
''' overview of autoencoder forward:
1. Input batch is embedded
2. CNN+Pool... |
the-stack_106_30783 | import torch
import os
import math
from torch.autograd import Variable
import numpy as np
from PIL import Image
from neural_best_buddies.util import util
import numpy as np
def color_map(i):
colors = [
[255,0,0],
[0,255,0],
[0,0,255],
[128,128,0],
[0,128,128]
]
if i... |
the-stack_106_30786 | # -*- coding: utf-8 -*-
import pytest
from rastaecommerce.skeleton import fib
__author__ = "Jens Krause"
__copyright__ = "Jens Krause"
__license__ = "mit"
def test_fib():
assert fib(1) == 1
assert fib(2) == 1
assert fib(7) == 13
with pytest.raises(AssertionError):
fib(-10)
|
the-stack_106_30787 | # Copyright (c) 2017 StackHPC 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 in wr... |
the-stack_106_30789 | import os
from flask import (Flask, redirect, render_template, request, send_file,
send_from_directory, url_for)
from werkzeug.utils import secure_filename
from run import run
from utils import allwed_file
UPLOAD_FOLDER = "uploads"
app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER... |
the-stack_106_30790 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
the-stack_106_30793 | import os
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from torchvision import datasets, models, transforms
def init_face_classifier(args, model_name, num_classes=2, resume_from=None):
input_size = 100
model = None
... |
the-stack_106_30795 | import os
import sys
import shutil
from UserDict import UserDict
# Uncomment to use local kodi addondev repo
# sys.path.append(os.path.join(os.getcwd(), 'kodi-addondev', 'src'))
import requests
import zipfile
from git import Repo
from lxml import etree
import xbmc
from kodi_addon_dev import repo, tesseract
from kodi... |
the-stack_106_30796 | r"""
Reed-Solomon codes and Generalized Reed-Solomon codes
Given `n` different evaluation points `\alpha_1, \dots, \alpha_n` from some
finite field `F`, the corresponding Reed-Solomon code (RS code) of dimension
`k` is the set:
.. MATH::
\{ f(\alpha_1), \ldots, f(\alpha_n) \mid f \in F[x], \deg f < k \}
More ... |
the-stack_106_30798 | import pytest
import os
from utils import compare_errors, first_error_only_line
tests_dir = __file__.rpartition('/')[0] + '/semantic/'
tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')]
@pytest.mark.semantic
@pytest.mark.error
@pytest.mark.run(order=3)
@pytest.mark.parametrize("cool_file", te... |
the-stack_106_30799 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
from plumbum.cmd import mv, mkdir, rename
from plumbum import local
from typing import Tuple
from common import (
Colors,
Config,
get_cmd_or_die,
pb,
setup_logging,
transpile
)
import argparse
import logging
import multiprocessing
import os
impor... |
the-stack_106_30800 | import logging
import os
import click
from utoolbox.io import open_dataset
from utoolbox.io.dataset.base import SessionDataset, TiledDataset
from utoolbox.io.dataset import ZarrDataset
from utoolbox.util.log import change_logging_level
from prompt_toolkit.shortcuts import message_dialog, radiolist_dialog
... |
the-stack_106_30801 | from xml.sax.saxutils import escape
import sgmllib, time, os, sys, new, urlparse, re
from planet import config, feedparser
import htmltmpl
voids=feedparser._BaseHTMLProcessor.elements_no_end_tag
empty=re.compile(r"<((%s)[^>]*)></\2>" % '|'.join(voids))
class stripHtml(sgmllib.SGMLParser):
"remove all tags from th... |
the-stack_106_30802 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from . import FairseqLRScheduler, ... |
the-stack_106_30805 | # Copyright (c) 2014, Clemson University
# 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 conditions an... |
the-stack_106_30808 | from honeygrove import log
from honeygrove.config import Config
from honeygrove.core.Credential import Credential
from honeygrove.core.FilesystemParser import FilesystemParser
from honeygrove.core.HoneytokenDatabase import HoneytokenDatabase
from honeygrove.services.ServiceBaseModel import Limiter, ServiceBaseModel
fr... |
the-stack_106_30809 | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
MultiIndex,
Series,
)
import pandas._testing as tm
class TestSeriesCount:
def test_count_level_series(self):
index = MultiIndex(
levels=[["foo", "bar", "baz"], ["one", "two", "thr... |
the-stack_106_30813 | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from django.utils.html import strip_tags
class Highlighter(object):
css_class = 'highlighted'
html_tag = 'span'
max_length = 200
text_block = ''
def __init__(self, query, **kwargs):... |
the-stack_106_30814 | import threading
import os
import asyncio
import logging
import re
from functools import partial
from datetime import datetime
from loguru import logger
from prompt_toolkit.eventloop.utils import get_event_loop
from prompt_toolkit.application import Application
from prompt_toolkit.buffer import Buffer
from prompt_toolk... |
the-stack_106_30815 | #------------------------------------------------------------------------------
# Copyright (c) 2016, The University of Manchester, UK.
#
# BSD licenced. See LICENCE for details.
#
# Authors: Robert Haines
#------------------------------------------------------------------------------
import numpy as np
import pandas ... |
the-stack_106_30822 | from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.urls import reverse
from dcim.choices import *
from dcim.constants import *
from extras.util... |
the-stack_106_30823 | import json
import requests
def list_places():
response = requests.get('http://places-api:5000/places/')
places = json.loads(response.text)
return places
def get_place(id):
response = requests.get(f'http://places-api:5000/places/{id}')
place = json.loads(response.text)
return place
def g... |
the-stack_106_30824 | #
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from ipaddress import IPv4Address, IPv6Address
from logging import getLogger
import re
from six import string_types, text_type
from ..equality import EqualityTupleMixin
from .geo import GeoCodes
class Change(object):
... |
the-stack_106_30825 | """ test with the .transform """
from io import StringIO
import numpy as np
import pytest
from pandas.core.dtypes.common import ensure_platform_int, is_timedelta64_dtype
import pandas as pd
from pandas import (
Categorical,
DataFrame,
MultiIndex,
Series,
Timestamp,
concat,
date_range,
)
i... |
the-stack_106_30827 | #!/usr/bin/env python
"""REST Translation server."""
from __future__ import print_function
import codecs
import sys
import os
import time
import json
import threading
import re
import traceback
import importlib
import torch
import onmt.opts
from itertools import islice
from copy import deepcopy
from onmt.utils.loggin... |
the-stack_106_30830 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class NovaServerFault:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is... |
the-stack_106_30831 | import six
import colorama
# import this name for other promptly modules
# to use
from colorama import Style as AnsiStyle
colorama.init()
class Style(object):
reset_all = colorama.Style.RESET_ALL
@classmethod
def styles_for_key(cls, key, stylesheet):
styles = {}
context = stylesheet
... |
the-stack_106_30833 | #Escreva um rpograma que converta segundos em horas , minutos e segundos
#Exemplo de execução: input: 3850
# output: 1h 4min 10s
time = int(input('Digite o valor do tempo em segundos: '))
hours = time // 3600
seconds_left = time - (hours*3600)
minutes = seconds_left // 60
seconds_left -= (minutes... |
the-stack_106_30834 | # -*- coding: utf-8 -*-
from copy import copy
from json_writer import JsonWriter
import util
# 当前Writer的功能是生成java专用的json格式,而不是java代码
# json格式:
# 整体是一个字典,包含两个元素,header和body
# header有两行:
# 第一行是表头
# 第二行是列名
# body是一个二维数组:
# 对应了excel的各个单元
class JavaWriter(JsonWriter):
def begin_write(self):
sup... |
the-stack_106_30836 | import os
# Includes the parent directory into sys.path, to make imports work
import os.path, sys
sys.path.append(
os.path.join(
os.path.dirname(
os.path.realpath(__file__)
),
os.pardir
)
)
from constants import (
FILENAMES_OF_QUERIES,
PLSH_INDEX,
NLSH_INDEX,
... |
the-stack_106_30837 | import os.path
__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__commit__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]
try:
base_dir = os.path.dirname(os.path.abspath(__file__))
except NameError:
base_dir = None
__title__ = "ipfreely"... |
the-stack_106_30839 | # 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_30840 | """distutils.command.install_headers
Implements the Distutils 'install_headers' command, to install C/C++ header
files to the Python include directory."""
# created 2000/05/26, Greg Ward
__revision__ = "$Id: install_headers.py,v 1.7 2000/09/30 17:34:50 gward Exp $"
import os
from distutils.core import Command
cla... |
the-stack_106_30841 | import dash, flask, os
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd
import pickle
server = flask.Flask(__name__)
server.secret_key = os.environ.get('secret_key', 'secret')
app = dash.Dash(name = __name__, server = server)
app.config.supress_c... |
the-stack_106_30844 | import translator_bot
import os
"""
This script is invoked from translate-strings.sh, which is intended to be run as part of a Github Action.
If you want to run the tool on the command line, use translator_bot.py instead.
"""
def show_required_field_error(required_field: str):
print('%s is a required field.' % ... |
the-stack_106_30846 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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 L... |
the-stack_106_30847 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_106_30849 | # qubit number=3
# total number=11
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
the-stack_106_30857 | import os
from os.path import join
import tensorflow as tf
from tensorflow.python.framework import ops
current_dir = os.path.dirname(__file__)
build_dir = join(current_dir, '../build')
deform_conv2d_op_exe = tf.load_op_library(join(build_dir, 'deform_conv_op.so'))
deform_conv2d_grad_op_exe = tf.load_op_library(join(b... |
the-stack_106_30858 | import numpy as np
class ExperienceBuffer():
#Store the data from the episodes
def __init__(self):
self.num_episodes = 0
self.num_experiences = 0
self.states_buffer = []
self.actions_buffer = []
self.rewards_buffer = []
self.safety_costs_buffer = []
self.nex... |
the-stack_106_30859 | from datetime import datetime, timedelta
from django.test import TestCase
from casexml.apps.case.tests import check_xml_line_by_line
from corehq.apps.mobile_auth.utils import new_key_record, get_mobile_auth_payload
from dimagi.ext.jsonobject import HISTORICAL_DATETIME_FORMAT
class MobileAuthTest(TestCase):
@stat... |
the-stack_106_30861 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Smart Home Bot for Telegram. Copyright (c) 2017-2018 Oliver Lau <ola@ct.de>
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, ei... |
the-stack_106_30865 | import os
import shutil
import cv2
import numpy as np
from myGpuFeatures import myGpuFeatures
class Method:
# 关于 GPU 加速的设置
is_gpu_available = False
# 关于打印信息的设置
input_dir = ""
is_out_log_file = False
log_file = "evaluate.txt"
is_print_screen = True
# 关于图像增强的操作
is_enhance = False
... |
the-stack_106_30866 | """Support for MyQ-Enabled Garage Doors."""
import logging
import time
import voluptuous as vol
from homeassistant.components.cover import (
DEVICE_CLASS_GARAGE,
DEVICE_CLASS_GATE,
PLATFORM_SCHEMA,
SUPPORT_CLOSE,
SUPPORT_OPEN,
CoverDevice,
)
from homeassistant.config_entries import SOURCE_IMPO... |
the-stack_106_30868 | # plottools.py
"""
Collection of classes to help create plots.
"""
import matplotlib.pyplot as plt
class Plot(object):
"""
Base class for a plot.
:param title: Plot title. Optional.
:type title: str
"""
def __init__(self, title=None):
self.fig = plt.figure()
self.axplot = self... |
the-stack_106_30869 | # -*- coding: utf-8 -*-
"""Test the PyKEEN pipeline function."""
import unittest
import pandas as pd
import pykeen.regularizers
from pykeen.datasets import Nations
from pykeen.models.base import Model
from pykeen.pipeline import PipelineResult, pipeline
from pykeen.regularizers import NoRegularizer
class TestPipe... |
the-stack_106_30871 | # Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def solution(number: int) -> int:
"""
If we list all the natural numbers below 10 that are
multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of
these multiples is 23.
Finish the... |
the-stack_106_30872 | # Copyright (c) 2020. Tim O'Donnell
#
# 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 wr... |
the-stack_106_30873 | from sys import exit
from logging import getLogger
from influxdb import InfluxDBClient
from requests.exceptions import ConnectionError
from influxdb.exceptions import InfluxDBServerError
class DBManager(object):
def __init__(self, server):
self.server = server
self.logger = getLogger()
if ... |
the-stack_106_30875 | import logging
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djan... |
the-stack_106_30876 | """Example behavior cloning script for pointmass.
If you are trying to run this code, ask Ashvin for the demonstration file:
demos/pointmass_demos_100.npy (which should go in your S3 storage)
"""
import railrl.misc.hyperparameter as hyp
from multiworld.envs.mujoco.cameras import sawyer_pusher_camera_upright_v2
from m... |
the-stack_106_30877 | try:
import os
import subprocess
import sys
from pytgcalls.exceptions import GroupCallNotFoundError
from config import Config
import ffmpeg
from pyrogram import emoji
from pyrogram.methods.messages.download_media import DEFAULT_DOWNLOAD_DIR
from pytgcalls import GroupCallFactory
... |
the-stack_106_30878 | # /usr/bin/env python3
"""
网络查询接口:
1. 个股查询
- QA_fetch_get_individual_financial: 查询个股指定时间段指定财务报表指定报告类型数据
2. 截面查询
- QA_fetch_get_crosssection_financial: 查询指定报告期指定报表指定报告类型数据
本地查询接口:
1. 截面查询
- QA_fetch_crosssection_financial
2. 高级查询
- QA_fetch_financial_adv
"""
import datetime
import time
from typing impor... |
the-stack_106_30880 | #!/usr/bin/env python
#
# Copyright (c) 2009-2013, Luke Maurits <luke@maurits.id.au>
# All rights reserved.
# With contributions from:
# * Chris Clark
# * Klein Stephane
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:... |
the-stack_106_30881 | # coding: utf-8
# ## 라이브러리 import
# python recommendation.py 2 EatingFood,Drinking,Watch 광진구 37.5505441 127.0722199
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import pandas as pd
import numpy as np
from urllib.parse import urlencode, quote_plus, unquote
import json
from urllib.request import *
... |
the-stack_106_30882 | from dlchord2 import const
from dlchord2.accidentals import Accidentals
from dlchord2.note import Note
from dlchord2.scale import Scale
def test_create_from_index_note():
for i in range(12):
note = Note.create_from_index_note(i)
def test_create_from_tension():
tensions = const.TENSION_TO_INDEX.keys(... |
the-stack_106_30884 | from __future__ import print_function
import boto3
import datetime
import json
import CloudCanvas
import errors
import service
import fleet
from cgf_utils import aws_utils
from cgf_utils import custom_resource_utils
from botocore.exceptions import ClientError
# import errors
#
# raise errors.ClientError(message) - res... |
the-stack_106_30886 | # Copyright 2019 Google LLC. 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 law or a... |
the-stack_106_30887 | from tests.base_test import BaseTest
from crc.scripts.enum_label import EnumLabel
from crc.api.common import ApiError
class TestGetEnumLabel(BaseTest):
def setUp(self):
self.load_example_data()
self.workflow = self.create_workflow('enum_options_all')
self.workflow_api = self.get_workflow... |
the-stack_106_30888 | from collections import OrderedDict
from typing import Union, Optional, List, Tuple
import os
import shutil
from pathlib import Path
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
from tensorboardX import SummaryWriter
from torch.utils.data.dataloader import default_collate as default_collate_... |
the-stack_106_30892 | # this module contains all the defaults used by the generation of cleaned-up headers
# for the Bionic C library
#
import time, os, sys
from utils import *
# the list of supported architectures
kernel_archs = [ 'arm', 'arm64', 'x86' ]
# the list of include directories that belong to the kernel
# tree. used when looki... |
the-stack_106_30893 | import requests
from termcolor.termcolor import colored, cprint
class httpCommands():
def __init__(self):
pass
def execute_all_func(self, target):
try:
self.get_method(target)
except:
cprint("Error", "red")
try:
self.post_method(target)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.