filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_4710 | # Author: Yi Jiang, <jiangyi14@mails.ucas.ac.cn>, Institute of Physics, Chinese Academy of Sciences
# Adapted from the kdotp-symmetry package by: Dominik Gresch <greschd@gmx.ch> © 2017-2018, ETH Zurich, Institut für Theoretische Physik
"""
Defines functions to construct the basis of the symmetry-constrained Hamiltonia... |
the-stack_0_4711 | import json
from .models import *
def cookieCart(request):
try:
cart = json.loads(request.COOKIES['cart'])
except:
cart = {}
print('Cart:', cart)
items = []
order = {'cart_items' :0, 'cart_total' :0}
cartItems = order['cart_total']
for i in cart:
try:
... |
the-stack_0_4713 | # Copyright (c) 2022 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_0_4714 | import pathlib
import pandas as pd
import panda_scripts as ps
import joint_pca as pca
from argument_validators import alphanumeric
from shutil import rmtree
from math import floor
from numpy.random import randint
from os import remove
import inspect
from __utils import *
# This is a wrapper for all the data-processin... |
the-stack_0_4715 | # 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 applicab... |
the-stack_0_4716 | # -*- coding: utf-8 -*-
'''
tests for user state
user absent
user present
user present with custom homedir
'''
# Import python libs
from __future__ import absolute_import
import os
import sys
from random import randint
import grp
# Import Salt Testing libs
import tests.integration as integration
from tests.support.u... |
the-stack_0_4718 | from __future__ import unicode_literals
from collections import defaultdict
import datetime
import json
from moto.compat import OrderedDict
from moto.core import BaseBackend, BaseModel, CloudFormationModel
from moto.core.utils import unix_time
from moto.core import ACCOUNT_ID
from .comparisons import get_comparison_fu... |
the-stack_0_4721 | #!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
the-stack_0_4722 | #!/usr/bin/env python3
import re
import sys
import sqlite3
import traceback
import os
__location__ = os.path.realpath(
os.path.join(
os.getcwd(),
os.path.dirname(__file__)
)
)
input_failures = 0
try:
DATABASE_NAME = os.path.join(__location__, 'data.sqlite')
conn = sqlite3.connect(DAT... |
the-stack_0_4723 | import asyncio
import base64
from pathlib import Path
from subprocess import Popen
from tempfile import mkstemp
import concurrent.futures
import urllib.parse
from nbconvert.exporters import Exporter, HTMLExporter
import aiohttp
from ._screenshot import get_chrome_path
async def handler(ws, data, key=None):
awai... |
the-stack_0_4725 | """
Precisely APIs
Enhance & enrich your data, applications, business processes, and workflows with rich location, information, and identify APIs. # noqa: E501
The version of the OpenAPI document: 11.9.3
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F4... |
the-stack_0_4726 | #!/usr/bin/env python
"""
For a given motif annotated VCF file (already run through motifs.py) and a bed-like file for loci of interest and some
value for each loci for each sample, find loci that overlap a variant and compare the value of samples with the variant
to those without the variant. Report robut z-scores for... |
the-stack_0_4727 | #!/usr/bin/env python
"""
Fetches github linguist repository, process its information
and store it in database
"""
import os
import rethinkdb as r
import schedule
import shutil
import subprocess
import sys
import time
import yaml
DEVNULL = open(os.devnull, 'wb')
LANGUAGES_REPO = "https://github.com/github/linguist.... |
the-stack_0_4728 | from __future__ import unicode_literals
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ModelState
from django.db.models.options import normalize_together
from django.utils import six
from django.utils.functional import cached_property
fro... |
the-stack_0_4729 | from typing import Tuple
import os
import torch as th
import numpy as np
import gym
import copy
from torch.utils.tensorboard import SummaryWriter
from auto_rl.learning.policy import MLPActorCritic
from auto_rl.learning.buffer import OnPolicyBuffer
from auto_rl.learning.rewards import single_worker_gae, mc_reward_est... |
the-stack_0_4730 | import turtle
# turtle object
t = turtle.Turtle()
t.pensize(6)
turtle.bgcolor("#5383C1")
t.speed(9)
# function for creation of eye
def eye(col, rad):
t.down()
t.fillcolor(col)
t.begin_fill()
t.circle(rad)
t.end_fill()
t.up()
# function for cheeks
def cheek():
t.down()
t.fillcolor("#D03D3D");
t.begin_fill()
... |
the-stack_0_4731 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
the-stack_0_4732 | from Child import Child
from Node import Node # noqa: I201
ATTRIBUTE_NODES = [
# token-list -> token? token-list?
Node('TokenList', kind='SyntaxCollection',
element='Token'),
# token-list -> token token-list?
Node('NonEmptyTokenList', kind='SyntaxCollection',
element='Token', omit_w... |
the-stack_0_4733 | from protocolbuffers import UI_pb2
from careers.career_enums import CareerCategory, WORK_CAREER_CATEGORIES
from careers.career_ops import CareerTimeOffReason
from date_and_time import TimeSpan, DateAndTime
from distributor.shared_messages import build_icon_info_msg, IconInfoData
from drama_scheduler.drama_node import B... |
the-stack_0_4734 | import ray
from copy import deepcopy
from leaderboard.leaderboard_evaluator import LeaderboardEvaluator
from leaderboard.utils.statistics_manager import StatisticsManager
class ChallengeRunner():
def __init__(self, args, scenario, route, port=1000, tm_port=1002, debug=False):
args = deepcopy(args)
... |
the-stack_0_4736 | import os
import boto3
from base import LambdaFunctionBase
class CWScheduledEventManageEC2State(LambdaFunctionBase):
"""
Class starting or stopping EC2 instances not part of a AutoScaling group.
"""
# Section specific to the lambda.
ACTION = os.environ['PARAM_ACTION']
RESOURCE_TAG_KEY = os.e... |
the-stack_0_4737 | # -*- coding: utf-8 -*-
task = Task("MainStory69",desc = u"自动主线69",pretask = ["MainStory15"])
#task.addSetupActionSet("RefreshGame",tag="pre1",desc="RefreshGame")
#task.addTeardownActionSet("TypeCommand",tag= "end1",desc = u"清除所有任务",mp = {'command':'$cleartask 1'})
#task.addTeardownActionSet("TypeCommand",tag= "end2",d... |
the-stack_0_4738 | #!/usr/bin/env python3
import json
import os
import sys
import requests
base_url = "https://api.northwell.edu/"
url = "https://api.northwell.edu/v2/vax-locations/all"
def get_paginated_urls():
response = requests.get(url)
data = response.json()
return [page_url["url"] for page_url in data["response"]["... |
the-stack_0_4741 | #!/usr/bin/env python
import argparse
import boto3
import pandas as pd
import sagemaker
import json
from sagemaker.deserializers import JSONDeserializer
from sagemaker.serializers import JSONSerializer
from botocore.exceptions import ClientError
import logging
import traceback
logging.basicConfig(level=logging.INFO)
L... |
the-stack_0_4744 | # Copyright 2021 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS",... |
the-stack_0_4745 | from django.views.generic import ListView
from constance import config
from learning.models import Tutorial, Category
from learning.filters import TutorialArchiveFilterSet
class TutorialListView(ListView):
model = Tutorial
template_name = "learning/tutorials_archive.html"
page_kwarg = "page"
context_... |
the-stack_0_4746 | #!/usr/bin/env python3 -u
# -*- coding: utf-8 -*-
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# test API provided through BaseSktimeForecaster
"""SKtime Forecasters Test."""
__author__ = ["@mloning"]
__all__ = [
"test_different_fh_in_fit_and_predict_req",
"test_fh_in_fit_opt",
"... |
the-stack_0_4747 | import numpy as np
from autoencirt.irt.grm import GRModel
from bayesianquilts.dense import DenseHorseshoe
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability.python import util as tfp_util
from tensorflow_probability.python.mcmc.transformed_kernel import (
make_transform_fn, ... |
the-stack_0_4749 | """
Support for local control of entities by emulating the Phillips Hue bridge.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/emulated_hue/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant import util
from homeassistant.c... |
the-stack_0_4750 | """mysite2 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... |
the-stack_0_4752 | # -*- coding: utf-8 -*-
# pylint: disable=invalid-name
###############################################################################
# Copyright (c), The AiiDA-CP2K authors. #
# SPDX-License-Identifier: MIT #
# AiiDA-CP2K is hosted on... |
the-stack_0_4756 | from flask import Flask
from flask_restful import Api
from flask_cors import CORS
from src.api import Movies , Categories , Upload
from src.models import Database
from os import getcwd
def create_app():
static_folder = getcwd() + '/img/'
app = Flask(
__name__,
static_folder=static_folder
)... |
the-stack_0_4757 | import discord
import logging
import pprint
import socket
from aiohttp import web
from json import JSONDecodeError
from logging.config import fileConfig
from typing import List, Union
from utils.match import Match
class WebServer:
def __init__(self, bot):
from bot import ICL_bot
fileConfig('logg... |
the-stack_0_4758 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
the-stack_0_4760 | from collections import Counter
from itertools import combinations
import json
import warnings
import networkx as nx
class CrossCorrelationGraph:
"""CrossCorrelationGraph for computing correlation between clusters
Attributes
----------
window : float
Threshold for the window ... |
the-stack_0_4761 | from PyQt5 import QtCore, QtWidgets, QtGui
import numpy as np
import brainbox as bb
class FilterGroup:
def __init__(self):
self.reset_filter_button = QtWidgets.QPushButton('Reset Filters')
self.contrast_options_text = QtWidgets.QLabel('Stimulus Contrast')
self.contrasts = [1... |
the-stack_0_4762 | #
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... |
the-stack_0_4764 | #!/usr/bin/env python
import asyncio
import logging
import time
from collections import deque
from typing import List, Dict, Optional, Tuple, Deque
from hummingbot.client.command import __all__ as commands
from hummingbot.client.tab import __all__ as tab_classes
from hummingbot.core.clock import Clock
from hummingbot... |
the-stack_0_4765 | # Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
import numpy as np
import json
import argparse
import sys
import open3d as o3d
sys.path.append("../Utility")
from file import *
from visualization import *
sys.path.append(".")
from initialize_config import *
def ... |
the-stack_0_4766 | import cv2
import csv
global clickCoordinates
clickCoordinates = list()
def click_point(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
clickCoordinates.append((x, y))
image = cv2.imread("../protos/textures/rover_circuit.jpg")
cv2.namedWindow("image")
cv2.setMouseCallback("image", click_point)
whi... |
the-stack_0_4767 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# This application is an example on how to use aioblescan
#
# Copyright (c) 2017 François Wautier
#
# 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 Soft... |
the-stack_0_4768 | # PyAudio : Python Bindings for PortAudio.
# Copyright (c) 2006 Hubert Pham
# Copyright (c) 2020 Svein Seldal
# 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
... |
the-stack_0_4770 | """
File: test.py
Author: Jens Petit
Email: petit.jens@gmail.com
Github: https://github.com/j-petit
Description: Class for
"""
def modelParse(filename):
"""Parses the standard mplus model into single lines. Model refers to the
concept defined after the model: keyword in mplus.
Each line of the model is t... |
the-stack_0_4773 | """
Starling setup script.
See license in LICENSE.txt.
"""
import setuptools
import os
from starling_sim.version import __version__
# short description of the project
DESC = "Agent-based framework for mobility simulation"
# get long description from README.md
# with open("README.md", "r") as fh:
# LONG_DESC = f... |
the-stack_0_4775 | """
Instantiate a variation font. Run, eg:
$ fonttools varLib.mutator ./NotoSansArabic-VF.ttf wght=140 wdth=85
"""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.fixedTools import floatToFixedToFloat, otRound, floatToFixed
from fontTools.pens.bou... |
the-stack_0_4776 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2017 Alibaba Group Holding 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/LICENS... |
the-stack_0_4777 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 25 14:03:22 2019
@author: Rafael Arenhart
"""
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
'''
use '%matplotlib qt5' no console IPython para abrir o gráfico interativo
'''
PI = np.pi
SAMPLES = 1000
theta = np.random.random(... |
the-stack_0_4780 | import get_pic_from_video as gp
import directory_tree_traversal
import scor_onlie
import op_log
import ftp_op
import time
import configparser
import os.path
# 记录开始运行时间
start_time = time.strftime("%Y-%m-%d %X", time.localtime())
try:
# 读取配置文件
conf = configparser.ConfigParser()
conf.read('arr_config.ini')
... |
the-stack_0_4782 | from flask_login import login_required
from ui import app
from flask import Response, request
from utils.json_encoder import JSONEncoder
from service.job_service import cancel_job, dao_list_jobs, dao_count_jobs, get_job_dao
__author__ = 'tomas'
# returns all the jobs (and their state)
# @app.route("/api/workspace/<wo... |
the-stack_0_4788 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
__all__ = ["Move"]
class Move(object):
def tune(self, state, accepted):
pass
def update(self,
old_state,
new_state,
accepted,
subset=None):
... |
the-stack_0_4789 | import pydicom
from pydicom.filereader import read_dicomdir, read_dataset
from pydicom.data import get_testdata_files
from pydicom.errors import InvalidDicomError
from os.path import dirname, join
from pprint import pprint
import matplotlib.pyplot as plt
from pydicom.dataset import Dataset
from pathlib import Path
from... |
the-stack_0_4791 | #!/usr/bin/env python2.7
"""
Updates 'gene_id' entries in a GTF file downloaded from UCSC Table Browser
to have gene IDs as values instead of transcript IDs.
Two types annotation sources can be used to replace the 'gene_id' values:
1. Local annotation source. To use this, supply a file name to the
'--local' argu... |
the-stack_0_4792 | from typing import Optional
import tensorflow as tf
from kerastuner.applications import resnet
from kerastuner.applications import xception
from tensorflow.keras import layers
from tensorflow.python.util import nest
from autokeras.blocks import reduction
from autokeras.engine import block as block_module
from autoker... |
the-stack_0_4793 | import glob
import itertools as it
import numpy as np
import os
import sys
import xgboost as xgb
try:
from sklearn import datasets
from sklearn.preprocessing import scale
except ImportError:
None
class Dataset:
def __init__(self, name, get_dataset, objective, metric,
has_weights=Fals... |
the-stack_0_4795 | # 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_4796 | import base64
import uuid
from .base import DynamicField
from rest_framework.serializers import FileField, ImageField
from rest_framework import exceptions
from django.core.files.base import ContentFile
from django.utils import six
IMAGE_TYPES = {
'jpeg',
'jpg',
'png',
'gif',
'bmp',
'tiff',
... |
the-stack_0_4797 | import logging
import tempfile
from ocs_ci.framework import config
from ocs_ci.framework.pytest_customization.marks import ignore_leftovers
from ocs_ci.ocs.ocp import wait_for_cluster_connectivity, OCP
from ocs_ci.ocs import constants, node, defaults
from ocs_ci.ocs.resources.pod import get_fio_rw_iops
from ocs_ci.ocs... |
the-stack_0_4802 | import logging
import astropy.units as u
from astropy.wcs import (WCS, WCSSUB_CELESTIAL, WCSSUB_CUBEFACE,
WCSSUB_LATITUDE, WCSSUB_LONGITUDE, WCSSUB_SPECTRAL,
WCSSUB_STOKES, InvalidSubimageSpecificationError)
# Use this once in specutils
from ...utils.wcs_utils import (... |
the-stack_0_4803 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# */AIPND-revision/intropyproject-classify-pet-images/check_images.py
#
# TODO 0: Add your information below for Programmer & Date Created.
# PROGRAMMER: Luis Candanedo
# DATE CREATED: 5/24/2... |
the-stack_0_4804 | import asyncio
import warnings
import pytest
from distributed import Worker, WorkerPlugin
from distributed.utils_test import async_wait_for, gen_cluster, inc
class MyPlugin(WorkerPlugin):
name = "MyPlugin"
def __init__(self, data, expected_notifications=None):
self.data = data
self.expected... |
the-stack_0_4806 | import unittest
import paddle.v2.fluid.core as core
from paddle.v2.fluid.executor import Executor
import paddle.v2.fluid.layers as layers
from paddle.v2.fluid.backward import append_backward_ops
from paddle.v2.fluid.framework import g_main_program
import numpy
class TestShrinkRNNMemory(unittest.TestCase):
def tes... |
the-stack_0_4807 | #!/usr/bin/env python
# coding=utf-8
"""
Ant Group
Copyright (c) 2004-2021 All Rights Reserved.
------------------------------------------------------
File Name : lr_train_and_predict.py
Author : Qizhi Zhang
Email: qizhi.zqz@antgroup.com
Create Time : 2021/5/21 上午10:13
Description : description ... |
the-stack_0_4808 | # https://math.stackexchange.com/questions/4231713/has-anyone-ever-attempted-to-find-all-splits-of-a-rectangle-into-smaller-rectang
# from random import randint
from numpy import random
# from pymclevel.box import BoundingBox
def make2dList(nRows, nCols):
newList = []
for row in xrange(nRows):
# give... |
the-stack_0_4811 | #!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2021, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sour... |
the-stack_0_4813 | """
Holds classes and utility methods related to build graph
"""
import copy
import logging
import os
import threading
from pathlib import Path
from typing import Sequence, Tuple, List, Any, Optional, Dict, cast, NamedTuple
from copy import deepcopy
from uuid import uuid4
import tomlkit
from samcli.lib.build.excepti... |
the-stack_0_4814 | '''
userManager for Docklet
provide a class for managing users and usergroups in Docklet
Warning: in some early versions, "token" stand for the instance of class model.User
now it stands for a string that can be parsed to get that instance.
in all functions start with "@administration_required" or "@a... |
the-stack_0_4815 | #!python3
"""
Python 3 wrapper for identifying objects in images
Requires DLL compilation
Both the GPU and no-GPU version should be compiled; the no-GPU version should be renamed "yolo_cpp_dll_nogpu.dll".
On a GPU system, you can force CPU evaluation by any of:
- Set global variable DARKNET_FORCE_CPU to True
- Set ... |
the-stack_0_4816 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014-2021 The PySCF Developers. 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/li... |
the-stack_0_4819 | """
ID: fufa0001
LANG: PYTHON3
TASK: milk2
"""
fin = open('milk2.in','r')
fout = open('milk2.out','w')
count, *times = fin.readlines()
for i in range(0,int(count)):
times[i]=list(map(int, times[i].split()))
times = sorted(times, key=lambda tup: tup[0])
merged = []
for higher in times:
if not merged:
mer... |
the-stack_0_4820 | # Copyright 2013-2021 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 *
import os
import socket
from os.path import join as pjoin
def get_spec_path(spec, package_name, pat... |
the-stack_0_4821 | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import TYPE_CHECKING
from uuid import uuid4
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distri... |
the-stack_0_4824 | """The IPython kernel implementation"""
import asyncio
from contextlib import contextmanager
from functools import partial
import getpass
import signal
import sys
from IPython.core import release
from ipython_genutils.py3compat import builtin_mod, PY3, unicode_type, safe_unicode
from IPython.utils.tokenutil import to... |
the-stack_0_4827 | """
Advent of Code 2020
Day 16
"""
def get_data(fname: str) -> tuple:
"""
Read the data file.
"""
with open(fname) as f:
texts = f.read().split('\n\n')
# Get the fields and all their valid values. Not space efficient,
# but there aren't that many of them.
fields = {}
for field... |
the-stack_0_4832 | import asyncio
from decimal import Decimal
from os.path import join
from typing import Any, List, TYPE_CHECKING
import pandas as pd
import hummingbot.client.config.global_config_map as global_config
from hummingbot.client.config.config_helpers import missing_required_configs, save_to_yml
from hummingbot.client.config... |
the-stack_0_4834 | import tensorflow as tf
def main():
converter = tf.lite.TFLiteConverter.from_frozen_graph('../pb/frozen_shape_28.pb',
['new_input_node'], ['final_dense/MatMul'])
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_LATENCY]
tflite_model = conve... |
the-stack_0_4835 | import logging
import pickle
import random
from voxpopuli import Voice, PhonemeList
from typing import Union, Dict, List
from random import randint
from distance import levenshtein
from katalixia.tools import weighted_choice
class TreeNode:
def __init__(self):
self.children = dict() # type:Dict[str,Uni... |
the-stack_0_4836 | import asyncio
from h2client.diskcached_connection import DiskcachedConnection
import io
import time
USER_AGENT = 'H2ClientExamples/1 by /u/Tjstretchalot (+https://github.com/tjstretchalot/h2client)'
async def main():
dc_conn = DiskcachedConnection('postman-echo.com')
print('Performing a GET requ... |
the-stack_0_4837 | """Useful mocks for unit testing."""
from __future__ import absolute_import, unicode_literals
import numbers
from datetime import datetime, timedelta
try:
from case import Mock
except ImportError:
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
def TaskMessa... |
the-stack_0_4838 | #!/usr/bin/env python
# encoding: utf-8
import os
import six
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import pfp
import pfp.interp
import pfp.utils
import utils
class TestCompatStrings(utils.PfpTestCase):
def setUp(self):
pfp.interp.Endian.current = ... |
the-stack_0_4840 | #!/usr/bin/env python2
#-*- coding:utf-8 -*-
from docopt import docopt
from routine import parse_char
from charset import get_charset
class ArgError(Exception):
pass
def parse_parameters(doc, version):
p = docopt(doc, version=version)
p = {k.lstrip("-"): v for k, v in p.items()}
try:
retur... |
the-stack_0_4842 | """
O Proxy é um padrão de projeto estrutural que tem a
intenção de fornecer um objeto substituto que atua
como se fosse o objeto real que o código cliente
gostaria de usar.
O proxy receberá as solicitações e terá controle
sobre como e quando repassar tais solicitações ao
objeto real.
Com base no modo como o proxies sã... |
the-stack_0_4843 | """
Add token.client_id column
Revision ID: c36369fe730f
Revises: e15e47228c43
Create Date: 2016-10-19 15:24:13.387546
"""
from __future__ import unicode_literals
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = 'c36369fe730f'
down_revision = 'e15e47228c43'
def... |
the-stack_0_4844 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
## import sys
## sys.path.insert(0, "/home/scott/Dropbox/codes/pyrotein")
## sys.path.insert(0, "/Users/scott/Dropbox/codes/pyrotein")
import os
import numpy as np
import pyrotein as pr
from loaddata import load_xlsx, label_TMs
from display import plot_dmat
import multip... |
the-stack_0_4846 | from __future__ import division
import torch
import numpy as np
import os.path as osp
from mmcv.runner import load_checkpoint
from mmcv.parallel import MMDataParallel
from vegcn.datasets import build_dataset
from vegcn.deduce import peaks_to_labels
from lgcn.datasets import build_dataloader
from utils import (list2... |
the-stack_0_4847 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... |
the-stack_0_4850 | """Tests for Brother Printer integration."""
import json
from homeassistant.components.brother.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_TYPE
from tests.async_mock import patch
from tests.common import MockConfigEntry, load_fixture
async def init_integration(hass) -> MockConfigEntry:
"... |
the-stack_0_4851 | # -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
from tinycss import make_parser
from pprint import pprint as ppr
from reflector import Reflector
from string import ascii_lowercase
DEBUG = __name__ == '__main__'
class HTMLReflector(Reflector):
def __init__(self, default_tag='div', ... |
the-stack_0_4853 | # -*- coding: utf8 -*-
from QcloudApi.qcloudapi import QcloudApi
from tce.tcloud.utils.config import global_config
# 设置需要加载的模块
module = 'lb'
# 对应接口的接口名,请参考wiki文档上对应接口的接口名
action = 'RegisterInstancesWithForwardLBFourthListener'
region = global_config.get('regions')
params = global_config.get(region)
secretId = params[... |
the-stack_0_4854 | import pandas as pd
'''
@test($$;type(pd))
@alt(全ての|すべての|全)
@alt(の名前|名)
@alt(丸める|四捨五入する)
@alt(丸めて|四捨五入して)
@prefix(df;データフレーム)
@prefix(ds;データ列)
@prefix(col;カラム;カラム)
@alt(日付データ|タイムスタンプ[型|]|Pandasの日付型|datetime64型)
@prefix(value;[文字列|日付|])
データ列を使う
データ列をインポートする
'''
pd.to_datetime(x)
'''
@test(pd=df=ds=missing;$$)
[Pandasで、... |
the-stack_0_4855 | import discord, mtranslate
from discord.ext import commands
from contextlib import redirect_stdout
import inspect, aiohttp, asyncio, io, textwrap, traceback, os, json, urbanasync
from cogs import Cog
import random
from paginator import PaginatorSession
class BaiterBot(commands.Bot):
def __init__(self):
su... |
the-stack_0_4856 | # encoding: UTF-8
# Copyright 2016 Google.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 to... |
the-stack_0_4859 | def validate_config_component_req(project, config, value, component_id):
config_obj = project.config(config)
if config_obj.value() == value and project.is_selected(component_id) == 0:
comp = project.component(component_id)
comp_name = comp.label()
project.error('Component ' + comp_name + ' must be sel... |
the-stack_0_4861 | '''
log
===
High-level logger for API requests.
'''
import datetime
import logging
import os
from . import path
def log_name():
'''Get date/time-based log name.'''
return '{:%Y-%m-%d-%H-%M-%S}.log'.format(datetime.datetime.now())
def new_logger(name):
'''Define a new logger.'''
logger ... |
the-stack_0_4864 | import torch
from torch import nn
from torch.nn import functional as F
from networks.cnn_networks import VGG19
from util.tps_grid_gen import TPSGridGen
class GANLoss(nn.Module):
def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0,
tensor=torch.cuda.FloatTensor):
... |
the-stack_0_4869 | # !/usr/bin/env python3
# /-*- coding: UTF-8 -*-
from math import prod
if __name__ == "__main__":
lst = list(map(int, input().split()))
lst = prod([int(a) for a in lst if a > 0])
print(lst)
|
the-stack_0_4871 | #!/usr/bin/env python
import sys
import math
import time
import asyncio
import logging
import unittest
from os.path import join, realpath
from typing import Dict, Optional, List
from hummingbot.core.event.event_logger import EventLogger
from hummingbot.core.event.events import OrderBookEvent, OrderBookTradeEvent, Trade... |
the-stack_0_4872 | """
A Websocket example.
"""
import logging
import pkg_resources
import uvicorn
import bareutils.header as header
from bareasgi import (
Application,
HttpResponse,
text_writer
)
logging.basicConfig(level=logging.DEBUG)
async def index(_request):
"""Redirect to the test page"""
return HttpResp... |
the-stack_0_4876 | import cv2 as cv
import numpy as np
capture = cv.VideoCapture(0)
# check if connected
if capture.isOpened() is False:
print("Error opening camera 0")
exit()
# load model
model = cv.dnn.readNetFromCaffe('deploy.prototxt',
'res10_300x300_ssd_iter_140000_fp16.caffem... |
the-stack_0_4879 | """add_cca_tail.py - Adds CCA tails to fasta file sequences
================================================================
Purpose
-------
This script adds CCA tails to the RNA chromosomes and remove pseudogenes. It takes fasta files as input and outputs fasta files.
Usage
-----
Options
-------
**
Type::
for ... |
the-stack_0_4881 | import torch
import torchvision
import torch.optim as optim
from torch.autograd import Variable
import os
from .dcgan_model import Generator
from .dcgan_model import Discriminator
from .data_loader import get_dataloader
from .utils import save_model
def train(train_data_folder, val_data_folder, params):
train_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.