filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_15174
"""Tests for asyncio/sslproto.py.""" import logging import socket from test import support import unittest import weakref from unittest import mock try: import ssl except ImportError: ssl = None import asyncio from asyncio import log from asyncio import protocols from asyncio import sslproto ...
the-stack_0_15175
# -*- coding: utf-8 -*- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. try: from ipywidgets.widgets import DOMWidget, register from traitlets import Unicode, Int, Bool except Exception as exp: # Init dummy objects neede...
the-stack_0_15176
""" owtf.http.transaction ~~~~~~~~~~~~~~~~~~~~~ HTTP_Transaction is a container of useful HTTP Transaction information to simplify code both in the framework and the plugins. """ import cgi import logging import io import gzip import zlib import json try: from http.client import responses as response_messages exc...
the-stack_0_15177
from PyQt4 import QtGui from models.experiment import Experiment __author__ = 'daniel' class ExperimentComboBox(QtGui.QComboBox): def __init__(self, session = None, parent = None): super(ExperimentComboBox, self).__init__(parent) self.session = session self.refresh_experiments() def ...
the-stack_0_15178
# -*- coding: utf-8 -*- # Copyright 2016 Matt Martz # 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 # # ...
the-stack_0_15180
"""Contains the OnScreenDebug class.""" __all__ = ['OnScreenDebug'] from panda3d.core import * from direct.gui import OnscreenText from direct.directtools import DirectUtil class OnScreenDebug: enabled = ConfigVariableBool("on-screen-debug-enabled", False) def __init__(self): self.onScreenText = N...
the-stack_0_15182
from unityagents import UnityEnvironment import numpy as np env = UnityEnvironment(file_name='./Tennis_Linux/Tennis.x86_64') # get the default brain brain_name = env.brain_names[0] brain = env.brains[brain_name] # reset the environment env_info = env.reset(train_mode=True)[brain_name] # number of agents num_agents ...
the-stack_0_15185
import numpy as np import time from collections import OrderedDict, deque, Counter from digideep.environment import MakeEnvironment from .data_helpers import flatten_dict, update_dict_of_lists, complete_dict_of_list, convert_time_to_batch_major, extract_keywise # from mujoco_py import MujocoException # from dm_contro...
the-stack_0_15186
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_15187
# Random Forest Regression import pandas as pd import numpy as np import matplotlib.pyplot as plt dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values from sklearn.ensemble import RandomForestRegressor regressor = RandomForestRegressor(n_estimators = 300, rando...
the-stack_0_15189
import re import logging import uuid import inspect import typing try: orjson_enabled = True import orjson as json except ImportError: orjson_enabled = False import json from enum import Enum from typing import Dict, Type, Callable, Optional, List, Union, Literal from nacl.signing import VerifyKey fro...
the-stack_0_15194
import errno import inspect import os import sys from contextlib import contextmanager from itertools import repeat from functools import update_wrapper from .types import convert_type, IntRange, BOOL from .utils import ( PacifyFlushWrapper, make_str, make_default_short_help, echo, get_os_args, ) f...
the-stack_0_15195
from flask import Flask from flask_sqlalchemy import SQLAlchemy from app.main.config import configurations # Initialize SQLAlchemy database db = SQLAlchemy() def create_app(config): # Check if configuration is valid if config not in configurations: raise ValueError(f'{config} is not a valid configur...
the-stack_0_15198
from tkinter import* raiz=Tk() import psycopg2 from bd import conexion import cv2 from datetime import datetime import time cap = cv2.VideoCapture(0) detector = cv2.QRCodeDetector() control='u' #se declara un fram dentro de la ventana con dimenciones miFrame=Frame(raiz,width=1200, height=600) #se empaqueta miFrame.pac...
the-stack_0_15200
import ctypes import struct # 3p import bson from bson.codec_options import CodecOptions from bson.son import SON # project from ...compat import to_unicode from ...ext import net as netx from ...internal.logger import get_logger log = get_logger(__name__) # MongoDB wire protocol commands # http://docs.mongodb.co...
the-stack_0_15203
#!/usr/bin/env python # sudo apt install python3-tk from camera import * c = Camera('192.168.0.100', 52381) def save_preset_labels(): with open('preset_labels.txt', 'w') as f: for entry in entry_boxes: f.write(entry.get()) f.write('\n') f.close() # GUI from tkinter import Tk, ...
the-stack_0_15204
#!/usr/bin/env python # # Electrum - Lightweight Merge Client # Copyright (C) 2015 Thomas Voegtlin # # 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 l...
the-stack_0_15206
import unittest import types import os import sys import tempfile import shutil import subprocess from openmdao.api import Problem from openmdao.test_suite.components.sellar import SellarNoDerivatives from openmdao.devtools import iprof_mem @unittest.skip("interactive test, not to be run with test suite") class Te...
the-stack_0_15208
import yaml from unittest import TestCase from .utils import TEST_DATA_PATH from foliant.meta.classes import Chapter from foliant.meta.classes import Meta from foliant.meta.classes import MetaChapterDoesNotExistError from foliant.meta.classes import MetaDublicateIDError from foliant.meta.classes import MetaSectionDoe...
the-stack_0_15211
from distutils.core import setup, Extension module_device = Extension('device', sources = ['device.cpp'], library_dirs=["C:\Program Files (x86)\Windows Kits\10\Lib"] ) setup (name = 'WindowsDevices', version = '1.0', description = ...
the-stack_0_15212
import numpy as np from scipy.stats import norm import unittest import ray import ray.rllib.algorithms.dqn as dqn import ray.rllib.algorithms.pg as pg import ray.rllib.algorithms.ppo as ppo import ray.rllib.algorithms.sac as sac from ray.rllib.utils.framework import try_import_tf from ray.rllib.utils.test_utils import...
the-stack_0_15215
from pathlib import Path import pytest import torch.autograd import colossalai from colossalai.context.parallel_mode import ParallelMode from colossalai.core import global_context as gpc from colossalai.engine import Engine from colossalai.logging import get_global_dist_logger from colossalai.nn.layer._parallel_utili...
the-stack_0_15216
""" The processors exist in Pythia to make data processing pipelines in various datasets as similar as possible while allowing code reuse. The processors also help maintain proper abstractions to keep only what matters inside the dataset's code. This allows us to keep the dataset ``get_item`` logic really clean and no...
the-stack_0_15217
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_15219
import vcf import argparse from pyfaidx import Fasta from Bio import SeqIO from Bio.SeqRecord import SeqRecord from Bio.Seq import MutableSeq from Bio.Seq import Seq parser = argparse.ArgumentParser(description='Extract ref sequence and variants for a cluster') parser.add_argument('-f', help='the reference genome fas...
the-stack_0_15220
#!/usr/bin/env conda run -n py27Env python2.7 # -*- coding: utf-8 -*- """ Hyperalign on one half of a hyperscanning task and look for improvements in leave-one-out ISC in the other half. """ import numpy as np import pickle from mvpa2.suite import * import time import glob import sys sys.path.append('/dartfs-hpc/rc/l...
the-stack_0_15222
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_15225
''' Extract info from a call to the clean task from CASA logs. ''' import re from itertools import izip from datetime import datetime from astropy import units as u import numpy as np from astropy.table import Table # Define some strings for re all_time_date = r"^[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2...
the-stack_0_15229
from datetime import datetime from pathlib import Path import fire import torch import torch.nn as nn import torch.optim as optim import utils import ignite import ignite.distributed as idist from ignite.contrib.engines import common from ignite.contrib.handlers import PiecewiseLinear from ignite.engine import Engine...
the-stack_0_15231
#!/usr/bin/env python # -*- coding: utf-8 -*- # ************************************ # @Time : 2019/7/3 22:34 # @Author : Xiang Ling # @Lab : nesa.zju.edu.cn # @File : cfg_train.py # ************************************ import numpy as np import os import torch from datetime import datetime from sklearn...
the-stack_0_15232
# # 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_0_15233
# @date 17.05.2021.0 # @clock 22.50 # @author onur55-tr from turtle import * def my_goto(x,y): penup() goto(x,y) pendown() def gozler(): fillcolor('#ffffff') begin_fill() tracer(False) a = 2.5 for i in range(120): if 0 <= i < 30 or 60 <= i < 90: ...
the-stack_0_15235
from .helpers import get_pylint_output, write_output from ..automation_tools import read_json import os, sys # https://docs.pylint.org/features.html#general-options def find(items, filename, coreonly): enabled = ','.join(items) print('Generating %s in all of pygsti%s. This should take less than a ...
the-stack_0_15237
import collections import copy import glob import logging import os import pickle import sys import tarfile import time from io import BytesIO from dxtbx.model.experiment_list import ( Experiment, ExperimentList, ExperimentListFactory, ) from libtbx.phil import parse from libtbx.utils import Abort, Sorry ...
the-stack_0_15238
from django.contrib.auth import views as auth_views from django.urls import path from prometheus_client import Gauge import vote.views from management import views from management.models import ElectionManager from vote.models import Election, Session app_name = 'management' election_gauge = Gauge('wahlfang_election...
the-stack_0_15240
import json import web import six import re import os import urlparse from werkzeug.exceptions import BadRequest, MethodNotAllowed from urllib import unquote from utils import props from init_subclass_meta import InitSubclassMeta from graphql import Source, execute, parse, validate from graphql.error import format_e...
the-stack_0_15241
#!/usr/bin/env python # Copyright 2016 Google Inc. 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...
the-stack_0_15244
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
the-stack_0_15245
import os, glob from conans import ConanFile, tools, AutoToolsBuildEnvironment from conans.errors import ConanException from conans.model.version import Version class IlmBaseConan(ConanFile): name = "ilmbase" description = "IlmBase is a component of OpenEXR. OpenEXR is a high dynamic-range (HDR) image file ...
the-stack_0_15246
# -*- coding: utf-8 -*- """ Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix) Copyright (C) 2018 Caphm (original implementation module) Common base for crypto handlers SPDX-License-Identifier: MIT See LICENSES/MIT.md for more information. """ import json import base64 import time import ...
the-stack_0_15247
#!/usr/bin/env python import os import sys from DIRAC import S_OK, S_ERROR, gLogger, exit from DIRAC.Core.Base import Script Script.setUsageMessage('''Register SE files from a list of files to DFC. These list of files must be locally readable {0} [option|cfgfile] DFCRoot LocalRoot Filelist SE Example: {0} /juno/lu...
the-stack_0_15248
# Copyright (c) 2021, NVIDIA CORPORATION. # # 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_15249
from brownie import ( network, accounts, config, interface, Contract, ) from brownie.network.state import Chain from brownie import web3 from web3 import Web3 def get_account(index=None, id=None): if index is not None: return accounts[index] if id: return accounts.load(id) ...
the-stack_0_15251
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. # # 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_15253
import pytest import json import tempfile import pyethereum.trie as trie import logging logging.basicConfig(level=logging.DEBUG, format='%(message)s') logger = logging.getLogger() def check_testdata(data_keys, expected_keys): assert set(data_keys) == set(expected_keys), \ "test data changed, please adjus...
the-stack_0_15255
from keras import backend as K def matthews_correlation(y_true, y_pred): '''Calculates the Matthews correlation coefficient measure for quality of binary classification problems. ''' y_pred_pos = K.round(K.clip(y_pred, 0, 1)) y_pred_neg = 1 - y_pred_pos y_pos = K.round(K.clip(y_true, 0, 1)) ...
the-stack_0_15256
from __future__ import division, print_function, absolute_import import functools import numpy as np import math import sys import types import warnings # trapz is a public function for scipy.integrate, # even though it's actually a numpy function. from numpy import trapz from scipy.special import roots_legendre from...
the-stack_0_15258
''' NERYS a universal product monitor Current Module: Other Sites Usage: NERYS will monitor specified sites for keywords and sends a Discord alert when a page has a specified keyword. This can be used to monitor any site on a product release date to automatically detect when a product has been uploaded. Use...
the-stack_0_15262
# positioner_window.py, window to control a positioning instrument # Reinier Heeres, <reinier@heeres.eu>, 2008 # # 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 2 of the License, ...
the-stack_0_15263
""" Module containing class which computes fits of data using linear models through analytical calculations. It has functions to output the signal estimate (with errors), parameter covariance, and more. It can accept the noise level either as standard deviations of channels (if uncorrelated) or as a covariance matrix i...
the-stack_0_15266
# -*- test-case-name: twisted.test.test_ssl -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ This module implements Transport Layer Security (TLS) support for Twisted. It requires U{PyOpenSSL <https://pypi.python.org/pypi/pyOpenSSL>}. If you wish to establish a TLS connection, please u...
the-stack_0_15268
from molsysmt._private_tools.exceptions import * from molsysmt.forms.common_gets import * import numpy as np from molsysmt.native.molecular_system import molecular_system_components from molsysmt._private_tools.files_and_directories import temp_filename form_name='file:mdcrd' is_form = { 'file:mdcrd':form_nam...
the-stack_0_15269
# -*- coding: utf-8 -*- import logging import torch import torch.cuda from beaver.data import build_dataset from beaver.infer import beam_search from beaver.loss import WarmAdam, LabelSmoothingLoss from beaver.model import NMTModel from beaver.utils import Saver from beaver.utils import calculate_bleu fro...
the-stack_0_15270
#!/usr/bin/python2 # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistri...
the-stack_0_15271
import fnmatch import functools import typing import os import pygears from pygears import reg from pygears.core.gear import OutSig from ...base_resolver import ResolverBase, ResolverTypeError from pygears.util.fileio import find_in_dirs, save_file from pygears.conf import inject, Inject from pygears.hdl import hdlmod ...
the-stack_0_15273
from app.tweet.adapters.repository import PostgresTweetAggregateRepository from app.tweet.domain.model import Tweet from uuid import uuid4 import pytest class TestSave: @pytest.mark.asyncio async def test_save(self, postgres_session): repo = PostgresTweetAggregateRepository(postgres_session) ...
the-stack_0_15274
#!/usr/bin/env python import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../')) import glob import math import shutil import cv2 import matplotlib.pyplot as plt import numpy as np from skimage import img_as_ubyte from skimage.filters import * from Preprocess.tools.peakdetect import * dir...
the-stack_0_15275
from rest_framework.permissions import BasePermission class IsNormalUser(BasePermission): def has_permission(self, request, view): # allow all POST requests if not request.user.is_staff: if request.method == 'POST' or request.method == 'PUT' or request.method == 'DELETE' \ ...
the-stack_0_15276
import math import random import libpyDirtMP as prx prx.init_random(random.randint(1,999999)) acrobot = prx.two_link_acrobot("acrobot") simulation_step = 0.01 prx.set_simulation_step(simulation_step) print("Using simulation_step:", simulation_step) start_state = [0, 0, 0, 0] goal_state = [math.pi, 0, 0, 0] obs_pos...
the-stack_0_15278
import constants import numpy as np import MySQLdb import time import datetime import os CONCEPT_START = "START" def get_file_prefix(): """获得有效的文件前缀名""" from datetime import datetime now = datetime.now() return "{}_{}_{}".format(now.year, now.month, now.day) def init_file(): ...
the-stack_0_15279
import numpy as np import scipy.io as sio import matplotlib.pyplot as plt from tensorflow.python.keras import models, layers, losses, optimizers, utils from tensorflow.python.keras import backend as K def PINet_CIFAR10(): ## model input_shape = [32,32,3] initial_conv_width=3 initial_stride=1 ...
the-stack_0_15280
""" package aries_staticagent """ from setuptools import setup, find_packages from version import VERSION def parse_requirements(filename): """Load requirements from a pip requirements file.""" lineiter = (line.strip() for line in open(filename)) return [line for line in lineiter if line and not line.sta...
the-stack_0_15282
# import the necessary packages import argparse import cv2 # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="Path to the image") args = vars(ap.parse_args()) # load the image, convert it to grayscale, and blur it slightly image...
the-stack_0_15284
import os import re import foobar _REPO_DIR = os.path.dirname(os.path.dirname(__file__)) def test_version_number_match_with_changelog(): """__version__ and CHANGELOG.md match for the latest version number.""" changelog = open(os.path.join(_REPO_DIR, "CHANGELOG.md")).read() # latest version number in ch...
the-stack_0_15285
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import binascii import os import pytest from cryptography.exceptions import ( AlreadyFinalized, InvalidSignature, _Reasons, ...
the-stack_0_15288
import os, datetime import csv import pycurl import sys import shutil from openpyxl import load_workbook import pandas as pd import download.box from io import BytesIO import numpy as np from download.box import LifespanBox verbose = True snapshotdate = datetime.datetime.today().strftime('%m_%d_%Y') box_temp='/home/p...
the-stack_0_15289
from guild import batch_util # Flags max_trials = 5 batch_fail = False trials_fail = "" batch_run = batch_util.batch_run() proto_flags = batch_run.batch_proto.get("flags") or {} trials_count = batch_run.get("max_trials") or max_trials trials_fail_list = [int(s) for s in str(trials_fail).split(",") if s] for i in ran...
the-stack_0_15290
#!/usr/bin/env python # coding: utf-8 # Imports from luigi.parameter import IntParameter from luigi import LocalTarget, Task from luigi.format import UTF8 import datetime import pandas as pd import re import os from configs.Configurations import Configurations '''bigrams''' from gensim.models import Phrases from coll...
the-stack_0_15293
import logging import os from chirp.common import conf from chirp.library import album from chirp.library import audio_file class Dropbox(object): def __init__(self, dropbox_path=None): dropbox_path = dropbox_path or conf.MUSIC_DROPBOX self._path = dropbox_path self._dirs = {} se...
the-stack_0_15294
""" We need new tests framework """ from unittest import TestCase from slack_entities.entities.channel import Channel class ChannelTestCase(TestCase): def test_get(self): # Getting channel by name channel_1 = Channel.get(name='test') # Getting channel by id channel_2 = Channel.get...
the-stack_0_15295
from flask import request, redirect, abort, jsonify, url_for from CTFd.models import db, Solves, Challenges, WrongKeys, Keys, Tags, Files from CTFd import utils import os import boto3 import hashlib import string from werkzeug.utils import secure_filename def clean_filename(c): if c in string.ascii_letters + str...
the-stack_0_15296
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test merkleblock fetch/validation # from test_framework.test_framework import DankcoinTestFramework ...
the-stack_0_15298
import os import logging from django.conf import settings log_path = os.path.join(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'logs'), 'web.log') # 创建 logger logger = logging.getLogger() logger.setLevel(logging.DEBUG) # logger.propagate = 0 formatter = logging.Formatter('%(asctime)s - %(...
the-stack_0_15300
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_0_15303
from manimlib import * import networkx as nx from .algo_vgroup import * from .algo_node import * import queue class AlgoSegTreeNode(object): def __init__(self, id, l, r, v, left=None, right=None): self.l = l self.r = r self.v = v self.id = id self.left = left ...
the-stack_0_15305
#!/usr/bin/env python # -*- coding: utf-8 -*- """Read pages from Parameter namespace in old wiki and save in new wiki.""" import pywikibot import pywikibot.pagegenerators FAC_NS = 102 MACHINE_NS = 116 TABLE_NS = 118 old_site = pywikibot.Site('en', 'siriuswiki') new_site = pywikibot.Site('en', 'newsiriuswiki') comm...
the-stack_0_15307
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2014 Google Inc. 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/LICEN...
the-stack_0_15309
import unittest import unittest.mock from programy.clients.render.renderer import RichMediaRenderer class MockRichMediaRenderer(RichMediaRenderer): def __init__(self, config): RichMediaRenderer.__init__(self, config) def handle_text(self, userid, text): self._userid = userid self._t...
the-stack_0_15311
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_urllib_request, ) from ..utils import ( parse_iso8601, ) class SportDeutschlandIE(InfoExtractor): _VALID_URL = r'https?://sportdeutschland\.tv/(?P<sport>[^/?#]+)/(?P<id>[^?#/...
the-stack_0_15313
import os, setuptools dir_path = os.path.dirname(os.path.realpath(__file__)) with open(os.path.join(dir_path, 'requirements.txt')) as f: required_packages = f.read().splitlines() with open(os.path.join(dir_path, 'README.md'), "r") as fh: long_description = fh.read() setuptools.setup( name='FINE', versi...
the-stack_0_15314
# import pemfc_dash # import pemfc_dash.main from pemfc_dash.main import app server = app.server if __name__ == "__main__": # [print(num, x) for num, x in enumerate(dl.ID_LIST) ] app.run_server(debug=True, use_reloader=False) # app.run_server(debug=True, use_reloader=False, # host="0.0.0...
the-stack_0_15315
import re from rest_framework import serializers from rest_framework.validators import UniqueTogetherValidator from api.helpers.utils import StatusChoices from users.serializers import UserSerializer from flights.serializers import FlightSerializer from .models import Booking def is_valid_ticket(value): if re.se...
the-stack_0_15316
"""Tests for the Battery data frame""" import json import os import h5py import pandas as pd from pandas import HDFStore from pytest import fixture from batdata.data import BatteryDataset @fixture() def test_df(): return BatteryDataset(raw_data=pd.DataFrame({ 'current': [1, 0, -1], 'voltage': [2...
the-stack_0_15320
import os import re import tempfile import pytest from analyzer import util comment = ( '@S.Jovan The expected result should look sth. like this:\n[\n{ ""key1"": str10, ""key2"": str20, ""key3"": str30 },\n{ ""key1"": str11, ""key2"": str21, ""key3"": str31 },\n{ ""key1"": str12, ""key2"": str22, ""key3"": str32 ...
the-stack_0_15321
"""Holder for the (test kind, list of tests) pair with additional metadata their execution.""" from __future__ import absolute_import import itertools import threading import time from . import report as _report from . import summary as _summary from .. import config as _config from .. import selector as _selector ...
the-stack_0_15324
# Copyright 2020 The Cirq Developers # # 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 ...
the-stack_0_15326
import sys import pytest import shutil from pathlib import Path from cookiecutter import main CCDS_ROOT = Path(__file__).parents[1].resolve() args = { 'project_name': 'AwesomeProject', 'author_name': 'AwesomeName', 'description': 'A very awesome project.', 'open_source_license': 'BSD-3...
the-stack_0_15327
import tty import sys import curses import datetime import locale from decimal import Decimal import getpass import logging import electrum_mona from electrum_mona.util import format_satoshis from electrum_mona.bitcoin import is_address, COIN, TYPE_ADDRESS from electrum_mona.transaction import TxOutput from electrum_m...
the-stack_0_15331
# Set up an NN to recognize clothing # Use 85% of MNIST data to train and 15% to test # We will also used ReLU from __future__ import absolute_import, division, print_function # Import Tensorflow import tensorflow as tf import tensorflow_datasets as tfds tf.compat.v1.logging.set_verbosity(tf.compat.v1.logg...
the-stack_0_15333
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('web', '0011_card_how_to_obtain'), ] operations = [ migrations.AddField( model_name='account', name='...
the-stack_0_15335
if __name__ == '__main__' and __package__ is None: import sys from os import path sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) )) import pickle import numpy as np import matplotlib.pyplot as plt import cv2 from data.transforms.image import de_transform from vision.multiview import ...
the-stack_0_15336
from django.db import models from django.utils.text import slugify from django.core.validators import MinValueValidator, MinLengthValidator from django.db.models.fields import SlugField from django.contrib.auth.models import User # Create your models here. class Person(models.Model): DIRECTOR = 'DR' DEAN_OF_ACADEM...
the-stack_0_15339
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = "xh" # Date: 2019/11/13 from core import info_collection from conf import settings import urllib.request import urllib.parse, urllib.error import os, sys import json import datetime class ArgvHandler(object): def __init__(self, argv_list): self...
the-stack_0_15340
''' Copyright 2019 The Microsoft DeepSpeed Team ''' import math import torch import torch.distributed as dist try: from deepspeed.git_version_info import version from deepspeed.moe.utils import is_moe_param from deepspeed.ops.adam import DeepSpeedCPUAdam from deepspeed.ops.op_builder import UtilsBuil...
the-stack_0_15343
from time import sleep from json import dumps from kafka import KafkaProducer producer = KafkaProducer(bootstrap_servers=['localhost:9092'], value_serializer=lambda x: dumps(x).encode('utf-8')) print("Please insert a number --> 'stop' to exit") input_user = input() index = 0 while input_user != "stop": data = {"...
the-stack_0_15344
# -*- coding: utf-8 -*- """ pygments.lexers.agile ~~~~~~~~~~~~~~~~~~~~~ Lexers for agile languages. :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re try: set except NameError: from sets import Set as set from pygment...
the-stack_0_15345
from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import os import warnings import numpy as np from keras import Model from keras import layers from keras.optimizers import SGD, Adam from keras.callbacks import ModelCheckpoint, EarlyStopping from C...
the-stack_0_15346
import cntk as C import numpy as np from helpers import * from cntk.layers import * from cntk.layers.sequence import * from cntk.layers.typing import * from cntk.debugging import debug_model import pickle import importlib import os class PolyMath: def __init__(self, config_file): data_config ...
the-stack_0_15347
""" Misc tools for implementing data structures """ import re import collections import numbers import codecs import csv import types from datetime import datetime, timedelta from numpy.lib.format import read_array, write_array import numpy as np import pandas as pd import pandas.algos as algos import pandas.lib as ...
the-stack_0_15348
import pytest from subprocess import call import os import yaml """ test metafunc this test will test metafunc. this test will also show how to run tests where failure is expected (i.e., checking that we handle invalid parameters). """ class TestCLI: """ simple metafunc test class This uses the subpr...