filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_22532
"""Speech to text.""" import io import os import subprocess import tempfile import time import wave from pathlib import Path from typing import Any, Dict, Iterable, List, Optional, Tuple, Type from urllib.parse import urljoin import requests from rhasspy.actor import RhasspyActor from rhasspy.utils import convert_wav...
the-stack_106_22533
# # Copyright (c) YugaByte, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
the-stack_106_22534
import random import numpy as np def downsample(data_numpy, step, random_sample=True): # input: C,T,V,M begin = np.random.randint(step) if random_sample else 0 return data_numpy[:, begin::step, :, :] def temporal_slice(data_numpy, step): # input: C,T,V,M C, T, V, M = data_numpy.shape return...
the-stack_106_22535
import logging import os from collections import OrderedDict from typing import List from dateutil.parser import parse from great_expectations.data_context.util import instantiate_class_from_config from great_expectations.exceptions import ClassInstantiationError from great_expectations.render.util import num_to_str ...
the-stack_106_22536
import json from unittest.mock import ANY import pytest import requests import schemathesis from schemathesis.models import APIOperation, Case, OperationDefinition from schemathesis.parameters import ParameterSet, PayloadAlternatives from schemathesis.specs.openapi.links import Link, get_container, get_links from sch...
the-stack_106_22538
from mov_sdk.utxo_manager import decode_address, address_to_script print(address_to_script("btm2", "tn1q5zjfmndnexlx79n98wmjk6mhdd33qfwx78xt4w", "testnet")) print(address_to_script("btm", "tm1q5zjfmndnexlx79n98wmjk6mhdd33qfwxv7pm3g", "testnet")) from mov_sdk.mov_api import MovApi # s1 = MovApi(mnemonic_str="") # p...
the-stack_106_22544
# -*- coding:utf-8 -*- # /usr/bin/env python """ Author: Albert King date: 2019/11/16 20:39 contact: jindaxiang@163.com desc: 腾讯-股票-实时行情-成交明细 下载成交明细-每个交易日16:00提供当日数据 该列表港股报价延时15分钟 """ from io import StringIO import pandas as pd import requests def stock_zh_a_tick(code="sh600848", trade_date="20191011"): """ ...
the-stack_106_22545
import Global import logging from handlers.kbeServer.Editor.Interface import interface_global #点赞 def DoMsg_Dianzan(DB ,self_uid,uid ,wid ,lid ,siscid ,tid ,dian ,ctype): # DEBUG_MSG("Msg_Dianzan : %d - %d - %d - %d - %d - %s" % (uid, wid, tid, dian,lid,siscid)) #logging.info("Dianzan - uid[%i],wid[%i],lid[%i]...
the-stack_106_22546
class Node: def __init__(self, value): self.value = value self.left = None self.right = None class BST: def __init__(self, root_val): self.root = Node(root_val) def insert(self, value): newnode = Node(value) if self.root==None: self.root = ne...
the-stack_106_22547
# -*- coding: utf-8 -*- # Copyright © 2014 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated # documentation files (the "Software"), to deal in the # Software without restriction, including without limitation # the rights to use...
the-stack_106_22548
""" Nadel's construction problem in cpmpy. From Rina Dechter 'Constraint Processing', page 5. Attributes the problem to B.A. Nadel 'Constraint satisfaction algorithms' (1989). ''' * The recreation area should be near the lake. * Steep slopes are to be avoided for all but the recreation area. * Poor soil should be avo...
the-stack_106_22549
#!/user/bin/env python # -*- coding: utf-8 -*- """CodeSeeker A simple tool to search for code on GitHub. Usage example: > python -m codeseeker cube 1 file(s) found(s). repository/path/to/file.py > python -m codeseeker cube -o 1 file(s) found(s). repository/path/to/file.py Opening in a...
the-stack_106_22552
"""This module implements an abstract base class (ABC) 'BaseDataset' for datasets. It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses. """ import random import numpy as np import torch.utils.data as data from PIL import Image import torchvision....
the-stack_106_22554
# Example for create a delay in the client side ( the request is splited to 2) # connect(); wait for connection # delay 100msec # send(req) from trex.astf.api import * import argparse # we can send either Python bytes type as below: http_req = b'GET /3384 HTTP/1.1\r\nHost: 22.0.0.3\r\nConnection: Keep-Alive\r\nUse...
the-stack_106_22555
import numpy as np import math from matplotlib.path import Path from matplotlib.patches import PathPatch import matplotlib.pyplot as plt def make_plot_plast(elms, scale=0): '''Рисует исходную схему''' polygons_plast = [] codes_plast = [] polygons_nonplast = [] codes_nonplast = [] polygons_quad...
the-stack_106_22557
# Copyright 2021 The Kubeflow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
the-stack_106_22558
from ..credentials import create_proof_jwt, create_proof, verify_proof from aries_cloudagent.wallet.basic import BasicWallet from asynctest import TestCase as AsyncTestCase class TestJWT(AsyncTestCase): async def setUp(self): self.wallet = BasicWallet() self.example_schema = { "@contex...
the-stack_106_22559
# -*- coding: utf-8 -*- from __future__ import unicode_literals import errno import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation, Suspicio...
the-stack_106_22560
from smt.surrogate_models import RMTB from smt.examples.one_D_step.one_D_step import get_one_d_step, plot_one_d_step xt, yt, xlimits = get_one_d_step() interp = RMTB( num_ctrl_pts=100, xlimits=xlimits, nonlinear_maxiter=20, solver_tolerance=1e-16, energy_weight=1e-14, regularization_weight=0.0...
the-stack_106_22561
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
the-stack_106_22562
# PyTorch from torch import cuda import warnings warnings.filterwarnings('ignore', category=FutureWarning) # Data science tools from os import path # def create_paths(data_path, train_path, test_path, save_net_path): data_dir = path.abspath(data_path) train_dir = data_dir + train_path t...
the-stack_106_22565
import collections import pickle import os def make_char_vocab(filename, output_path): chars = [] with open(filename, 'r', encoding='utf-8') as f: data = f.read() words = data.strip().split('\n') print(len(words)) for word in words[4:]: # ignore ['<PAD>', '<UNK>', '<ROOT>', '<NUM>'] ...
the-stack_106_22570
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # 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 require...
the-stack_106_22571
import json import logging import os import shutil from abc import ABC, abstractmethod from pathlib import Path from typing import Union, Dict, Any, Iterable, List, IO, Tuple, TextIO, Optional import cv2 import numpy as np import pyproj from numpy import ndarray from opensfm import context, features, geo, pygeometry, ...
the-stack_106_22581
import pandas as pd from sklearn.metrics import mean_squared_error import numpy as np # path = "./results/results_2.csv" # MAX_CARD = 501012 # path = './results/results_dmv_all.csv' # MAX_CARD = 9406943 path = './results/tpch_result.csv' df = pd.read_csv(path) MAX_CARD = 6000003 * 0.2 # print(df) est_card = df['e...
the-stack_106_22582
from collections import OrderedDict from pathlib import Path from typing import List, Tuple, Optional import numpy as np import tensorflow as tf from tensorflow.keras.models import Model from tensorflow.keras import backend as K from tensorflow.keras.layers import ( Conv1D, MaxPooling1D, Input, Flat...
the-stack_106_22583
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import logging import urllib import httplib2 from py_utils import retry_util # pylint: disable=import-error from services import luci_auth ...
the-stack_106_22587
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass, field import torch from fairseq import metrics, utils from fairseq.criterions import FairseqCr...
the-stack_106_22590
from __future__ import absolute_import from __future__ import division from __future__ import print_function from math import cos from math import pi from math import sin from compas.geometry import matrix_from_frame from compas.geometry import transform_points from compas.geometry import Circle from compas.geometry ...
the-stack_106_22591
import glob from facenet_pytorch import MTCNN import os from PIL import Image image_dir = r"./origin_images/original" # MTCNN()で顔認識+トリミング mtcnn = MTCNN() # glob.glob(directory)⇨ファイル一覧をディレクトリとして取得 list = glob.glob(os.path.join(image_dir, "*.jpg")) print(list) print('トリミング開始') for i, path in enumerate(li...
the-stack_106_22592
## @file # This file is used to be the warning class of ECC tool # # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full t...
the-stack_106_22593
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2013, Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistri...
the-stack_106_22595
import sys from math import copysign def distance(pos1, pos2): (xstart, ystart) = pos1 (xend, yend) = pos2 dx = xend - xstart dy = yend - ystart if copysign(1, dx) == copysign(1, dy): return abs(dx + dy) else: return max(abs(dx), abs(dy)) def doit(input): way = [((0,0),0)] ...
the-stack_106_22599
""" TencentBlueKing is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaSCommunity Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the...
the-stack_106_22602
""" ExcursionSet.py Author: Jordan Mirocha Affiliation: McGill Created on: Mon 18 Feb 2019 10:38:06 EST Description: """ import numpy as np from .Constants import rho_cgs from .Cosmology import Cosmology from ..util.Math import central_difference from ..util.ParameterFile import ParameterFile from scipy.integrate...
the-stack_106_22604
# Copyright (c) 2010-2014 openpyxl from io import BytesIO from zipfile import ZipFile import pytest from openpyxl.tests.helper import compare_xml from openpyxl.reader.workbook import read_rels from openpyxl.xml.constants import ( ARC_CONTENT_TYPES, ARC_WORKBOOK_RELS, PKG_REL_NS, REL_NS, ) from openpy...
the-stack_106_22609
import typer valid_completion_items = [ ("Camila", "The reader of books."), ("Carlos", "The writer of scripts."), ("Sebastian", "The type hints guy."), ] def complete_name(incomplete: str): for name, help_text in valid_completion_items: if name.startswith(incomplete): yield (name,...
the-stack_106_22610
# -*- coding: utf-8-*- from typing import Dict, Any import numpy as np import tensorflow as tf import tensorflow_addons as tf_ad from tensorflow.keras.layers import Embedding, Bidirectional, LSTM, TimeDistributed, Conv1D, GlobalMaxPooling1D from tensorflow.python.keras.layers import add from feature_extractor import ...
the-stack_106_22611
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
the-stack_106_22613
from src.pipeline_constructor.core.PipelineModel import PipelineModel from src.pipeline_constructor.core.Model3D import Model3D from src.graph_creator.core.PipelineGraph import PipelineGraph, PipelinePart from src.core.PartType import PartType import open3d as o3d import numpy as np class PipelineConstructor: d...
the-stack_106_22614
import view.ui.configuration as configuration from PyQt5 import QtWidgets, QtGui from PyQt5.QtCore import pyqtSlot from model.config import Config class Configuration(QtWidgets.QWidget): def __init__(self, window): super().__init__() self.MainWindow = window ui = configuration.Ui_Form() ...
the-stack_106_22615
#!/usr/bin/env python # vim:ts=4:sts=4:sw=4:et # # Author: Hari Sekhon # Date: 2016-09-12 13:44:24 +0200 (Mon, 12 Sep 2016) # # https://github.com/harisekhon/devops-python-tools # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn # and ...
the-stack_106_22616
import os import yaml from kivy.app import App from kivy.clock import Clock from kivy.core.window import Window from kivy.uix.floatlayout import FloatLayout from kivymd.app import MDApp from gui.core import Navigation from core.connectors import HomeAssistant from core.platform import Shpi if os.path.exists('confi...
the-stack_106_22617
#!/usr/bin/env python # Copyright (c) 2013 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Use the raw transactions API to spend bitcoins received on particular addresses, # and send any change back ...
the-stack_106_22628
import sys , random from functions import split , listToString NumberOfWrites = 0 def Main(): argv1 = str(sys.argv[1]) if argv1 == None: print("Error - No argument Email Provided") Email = split(argv1) numOfElementInList = len(Email) RandomNumberGenerator = random.randint(1, (numOfEle...
the-stack_106_22629
import os from PIL import Image # Fill these variable before running this tool image_path = r"./crops.png" image_id = 7 image = Image.open(image_path) os.mkdir(r'./output_images') if image.width % 16 != 0 or image.height % 16 != 0: print('Error: image could not be cropped to 16x16 files exactly.') for i in range...
the-stack_106_22630
# Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 import os from unittest import mock import pytest from click.testing import Result from vdk.plugin.snowflake import snowflake_plugin from vdk.plugin.snowflake.snowflake_connection import SnowflakeConnection from vdk.plugin.test_utils.util_funcs import...
the-stack_106_22631
# Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Presubmit script for changes affecting tools/perf/. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about th...
the-stack_106_22632
#!/usr/bin/env python import sys import os import threading from subprocess import call import argparse import gzip ## code adapted from PrepareAA.py commit 38e758c19776f02cd0e920bde2513536cccc489f ## https://github.com/jluebeck/PrepareAA # Read the CNVkit .cns files def convert_cnvkit_cnv_to_seeds(cnvkit_output_d...
the-stack_106_22634
# 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) import re import llnl.util.tty as tty import spack.compiler import spack.util.executable class Fj(Package): """The ...
the-stack_106_22635
#! /usr/bin/env python # -*- coding: utf-8 -*- import os, sys from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue698-base", "issue698-v1"] CONFIGS = [ IssueConfig...
the-stack_106_22636
from consoleme.config import config from consoleme.handlers.base import BaseAPIV1Handler from consoleme.lib.account_indexers import get_account_id_to_name_mapping from consoleme.lib.auth import ( can_admin_policies, can_create_roles, can_delete_roles, can_edit_dynamic_config, ) from consoleme.lib.generi...
the-stack_106_22637
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
the-stack_106_22638
#!/bin/python # -*- coding: utf-8 -*- """contains functions related to (re)compiling the model with different parameters """ import numpy as np import time from .stats import post_mean def posterior_sampler(self, nsamples, seed=0, verbose=True): """Draw parameters from the posterior. Parameters ------...
the-stack_106_22640
import tensorflow as tf from tensorflow.keras.optimizers import Adam from tensorflow.keras.metrics import AUC from tensorflow.keras.callbacks import EarlyStopping from mtrec.models import MMoE from utils import build_census import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def main(): """ ============...
the-stack_106_22641
# Ran Jan 16 to simulate reads with RSEM from the monocle model # The monocle model is a tobit model on the cluster1 log tpm # perturbations made on 20% of transcripts with at least 2 fold change, simulated from a log normal effect size distribution # also used to simulate nonperturb import os import glob import numpy...
the-stack_106_22642
import logging from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.db import models from mayan.apps.acls.models import AccessControlList from mayan.apps.common.serialization import yaml_load from .classes import Layer...
the-stack_106_22643
from pylab import * from scipy.stats import norm from scipy.linalg.matfuncs import expm2 import os def phi(x): k = 5 #return norm.pdf(x-4) * exp(1j * k * x) + norm.pdf(x-40) * exp(-1j * k * x) return norm.pdf(x-4) + norm.pdf(x-40) def phi2(x): k = 5 #return norm.pdf(x-4.1) * exp(1j * k * x) + norm...
the-stack_106_22645
from collections import namedtuple import threading import time import wrapt from neotiles.exceptions import NeoTilesError from neotiles.pixelcolor import PixelColor MatrixSize = namedtuple('MatrixSize', 'cols rows') TileSize = namedtuple('TileSize', 'cols rows') TilePosition = namedtuple('TilePosition', 'x y') Pix...
the-stack_106_22646
#!/usr/bin/env python """Safe(ish) evaluation of mathematical expression using Python's ast module. This module provides an Interpreter class that compiles a restricted set of Python expressions and statements to Python's AST representation, and then executes that representation using values held in a symbol table. T...
the-stack_106_22651
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from bottles_of_bear import BottlesOfBear class HQ9Plus(): def __init__(self, tokens): self.tokens = tf.constant(tokens) s...
the-stack_106_22652
from torch import nn from torch_rl.utils import gauss_weights_init from torch_rl.core import * import os import glob class SaveableModel(object): def save(self, path): tor.save(self, path) @classmethod def load(cls, path): return tor.load(path) @classmethod def load_best(cls, ...
the-stack_106_22655
""" Environment (1) set the attribute of Node, App, BasicThroughput, Currently we fix the No. of App with 9, homogeneous cluster. The No. of Nodes could be set, No. of Containers in the batch is not required to know (2) Functions: 1. _state_reset: clear state matrix 2. step: allocate one container t...
the-stack_106_22656
# coding: utf-8 """ Memsource REST API Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis...
the-stack_106_22657
import tempfile import logging import json import os import unittest.mock from unittest.mock import patch from smac.utils.io.traj_logging import TrajLogger from smac.utils.io.traj_logging import TrajEntry from smac.configspace import ConfigurationSpace,\ Configuration, CategoricalHyperparameter, Constant, Unifor...
the-stack_106_22659
from setuptools import setup, find_packages, Command import os from os import path import subprocess import configparser # Get config parameters config = configparser.ConfigParser() config.read('setup.cfg') pkg_name = config['metadata']['name'] pypi_server = config['netsquid']['pypi-server'] def load_readme_text(): ...
the-stack_106_22660
import random from pprint import pprint import copy def gen_fresh_name(base_name, used_names): if base_name not in used_names: new_name = base_name else: for i in range(2, 10000): if f"{base_name}_{i}" in used_names: continue new_name = f"{base_name}_{i}"...
the-stack_106_22661
#!/usr/bin/python # # Copyright 2017 "OVS Performance" Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
the-stack_106_22667
import flask from indexd.blueprint import dist_get_record from indexd.errors import AuthError from indexd.errors import UserError from indexd.alias.errors import NoRecordFound as AliasNoRecordFound from indexd.index.errors import NoRecordFound as IndexNoRecordFound blueprint = flask.Blueprint('dos', __name__) bluep...
the-stack_106_22668
from __future__ import print_function, division, absolute_import from fontTools.ttLib import TTFont from afdko.fontpdf import (doTitle, FontPDFParams) from afdko.otfpdf import txPDFFont from afdko.pdfgen import Canvas from test_utils import get_input_path TOOL = 'fontpdf' OTF_FONT = 'OTF.otf' # ----- # Tests # --...
the-stack_106_22669
# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved. # Use of this source code is governed by a BSD License (see LICENSE). import json import requests from django.conf import settings from django.core.mail import send_mail from django.db import models, transaction from django.db.models.signal...
the-stack_106_22671
from collections import OrderedDict from .FFI import FFIMethod __all__ = [ "PotentialArguments" ] class PotentialArgumentHolder: """ Wrapper class that simply holds onto """ def __init__(self, args): if isinstance(args, OrderedDict): self.arg_vec = args else: ...
the-stack_106_22672
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.modules.events.tracks.controllers import (RHCreateTrack, RHCreateTrackGroup, RHDeleteTrack, ...
the-stack_106_22673
from __future__ import print_function import sys, os, time from h2o.exceptions import H2OTypeError sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils from h2o.automl import H2OAutoML """ This test is used to check arguments passed into H2OAutoML along with different ways of us...
the-stack_106_22674
# apis_v1/documentation_source/position_public_support_count_for_ballot_item_doc.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- def position_public_support_count_for_ballot_item_doc_template_values(url_root): """ Show documentation about positionPublicSupportCountForBallotItem """ re...
the-stack_106_22676
import os, argparse import pandas as pd import ami_md.ami_json as aj dtypes = { 'digitizationProcess.analogDigitalConverter.serialNumber': object, 'digitizationProcess.captureSoftware.version': object, 'digitizationProcess.playbackDevice.serialNumber': object, 'digitizationProcess.timeBaseCorrector.serialNumber': ...
the-stack_106_22677
from typing import List from typing import Union import pandas from sqlalchemy.orm import Session from db.crud import recipeBewertung as crud_recipeBewertung from schemes.exceptions import DatabaseException from schemes.exceptions import RecipeNotFound from schemes.scheme_filter import FilterRecipe from schemes.schem...
the-stack_106_22678
from flask import Flask, request app = Flask(__name__) PORT = 7000 @app.route('/', methods=["GET"]) def home(): remote_user = request.headers.get('REMOTE_USER') return "Hello {}, this is service2.".format(remote_user) if __name__ == "__main__": app.run(port=PORT, debug=True)
the-stack_106_22680
import tensorflow as tf from absl import app, flags, logging from absl.flags import FLAGS import numpy as np import cv2 from core.yolov4 import YOLOv4, YOLOv3, YOLOv3_tiny, decode import core.utils as utils import os from core.config import cfg flags.DEFINE_string('weights', './checkpoints/yolov3-416', 'path to weight...
the-stack_106_22683
RESPONSES = { 'auth_response': { 'status': 200, 'type': 'success', 'code': 'R-0000', 'detail': 'Authentification is success' }, 'json_test': { 'status': 200, 'type': 'success', 'code': 'R-0001', 'detail': 'Json test is correct' }, } ERROR...
the-stack_106_22684
""" Tests that apply specifically to the Python parser. Unless specifically stated as a Python-specific issue, the goal is to eventually move as many of these tests out of this module as soon as the C parser can accept further arguments when parsing. """ import csv from io import BytesIO, StringIO import pytest from...
the-stack_106_22685
# -*- coding: utf-8 -*- # # 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 #...
the-stack_106_22686
#! /usr/bin/env python2.7 import pika import sys import json message = ' '.join(sys.argv[1:]) or "Hello World!" def broadcast (message): connection = pika.BlockingConnection(pika.ConnectionParameters( 'localhost')) channel = connection.channel() channel.queue_declare(queue='hello') channel.basic...
the-stack_106_22691
# Copyright 2021, Robotec.ai sp. z o.o. # # 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 i...
the-stack_106_22692
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2019 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the ...
the-stack_106_22694
# 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_106_22695
import sys from pysam import VariantFile """ mkdir prplot ; cd prplot bedtools intersect -wao -a $data/pingpong_ext/OUT/HGspecificvars_1.bed -b $data/pingpong_ext/OUT/pp/over/sspecific.short.hg-haps.sam.bed > rec1.short.bed bedtools intersect -wao -a $data/pingpong_ext/OUT/HGspecificvars_2.bed -b $data/pingp...
the-stack_106_22696
from train_model import joblib from process_picture import obtain_one_picture def image_identification(image, model_type): """ :param: image :param: model_type :return: """ x_data = obtain_one_picture(image) # deal with picture clr = joblib.load("model/" + model_type +".pkl") retur...
the-stack_106_22697
# Copyright 2017 Bernhard Walter # # 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 writi...
the-stack_106_22698
"""Script to convert an old-structure influxdb to a new one.""" import argparse import sys from typing import List # Based on code at # http://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console def print_progress(iteration: int, total: int, prefix: str = '', suffix: str = '', dec...
the-stack_106_22704
import torch.nn as nn from .blocks import LayerDepwiseDecode, LayerDepwiseEncode class MobileHairNet(nn.Module): def __init__(self, encode_block=LayerDepwiseEncode, decode_block=LayerDepwiseDecode, mobilenet_block=None, *args, **kwargs): super(MobileHairNet, self).__init__() self.encode_block = en...
the-stack_106_22705
# coding: utf-8 # WaveMaker Code # by kense # ############ import numpy as np import matplotlib.pyplot as plt np.random.seed(seed=None) # random seed def jonswap(f,Hs,Tp): # JONSWAP function fp=1/float(Tp) TH = Tp/float(np.sqrt(Hs)) if TH<=3.6: gamma=5 elif (3.6<TH) and (TH<=5): gamma=np.exp(5.75-1.15...
the-stack_106_22706
import sys import getopt import re def main(argv): inname='' outname='' try: opts,args=getopt.getopt(argv,"hi:o:",["infile=","outfile=",]) except getopt.GetoptError: print('pbsv_tra_fliter.py -i <inputfile> -o <outputfile>') sys.exit(2) for opt, arg in opts: if opt =...
the-stack_106_22707
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ DETR model and criterion classes. """ import torch import torch.nn.functional as F from torch import nn from util import box_ops from util.misc import (NestedTensor, nested_tensor_from_tensor_list, accuracy, get_world_siz...
the-stack_106_22708
# Copyright (c) 2017 LINE Corporation # These sources are released under the terms of the MIT license: see LICENSE from unittest import mock from django.test import override_settings from promgen import models, rest, tests from promgen.notification.email import NotificationEmail from promgen.notification.linenotify ...
the-stack_106_22711
# # 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_22712
from urllib.parse import urlparse from discord.ext import commands from .utils import utils import collections import traceback import functools import discord import inspect import logging import asyncio import datetime log = logging.getLogger(__name__) """ Credit to Danny(Rapptz) for example of custom commands It w...
the-stack_106_22713
from datetime import datetime class PCB(object): def __init__(self, pid=0, name="", priority=0, arrival=0, burst=0, simArrival=0, simBurst=0): """ Variables were initially made to handle real-time CPU processing; However, all "sim" variables were later added to account for simulating CPU times...
the-stack_106_22714
# Copyright (c) 2021, NVIDIA CORPORATION. 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_22715
import os # after running this function, we need to manually remove the blank line in the head. def transfer_neuroner_into_ncrfpp(input_dir, output_dir, tag='BIO'): fin_train = open(os.path.join(input_dir, 'train.txt'), 'r') fin_dev = open(os.path.join(input_dir, 'valid.txt'), 'r') fin_test = open(os.path....