filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_24076 | import numpy as np
aa = np.array([[1,2,3],[2,4,6]])
bb = aa>2
idx = np.array([1,3,5])
x = np.zeros((6,))
x[idx] = np.array([1.1,1.4,1.5])
a = np.arange(10).reshape(2, 5)
indexer = np.array([[1,3,2],[2,4,3]])
sup = np.repeat(np.arange(2).reshape(2,1),3,axis=1)
a[sup,indexer] # this is what I need
np.ix_([0, 1], [2,... |
the-stack_106_24080 | """Functional tests for interactive HTTP API."""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
from mock import patch
standard_library.install_aliases()
import functools
import p... |
the-stack_106_24082 | """
Ory Kratos API
Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the admini... |
the-stack_106_24083 | import pandas as pd
import os
import torch
from pathlib import Path
import pickle
import logging
import shutil
from torch.utils.data import (
Dataset,
TensorDataset,
DataLoader,
RandomSampler,
SequentialSampler,
)
from torch.utils.data.distributed import DistributedSampler
from transformers impor... |
the-stack_106_24085 | #!python
# Copyright 2015 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 by applicable... |
the-stack_106_24087 | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
the-stack_106_24089 | import argparse
import re
import sys
from itertools import groupby
from jinja2 import Environment, FileSystemLoader, Template
from pathlib import Path
script_path = Path(__file__).parent.resolve()
sys.path.append(str(script_path.parent))
from utils import createFolder, deleteFolder, genSTM32List
# Base path
core_path... |
the-stack_106_24091 | import re
import json
import random
import cbor2
import base64
from requests.models import Response
from localstack import config
from localstack.constants import APPLICATION_JSON, APPLICATION_CBOR
from localstack.utils.aws import aws_stack
from localstack.utils.common import to_str, json_safe, clone, epoch_timestamp, ... |
the-stack_106_24092 | # TODO from typing import List
import datetime
import json
import os
import re
import urllib.request
from bs4 import BeautifulSoup
from .models import Content
def get_text_wiki(lil):
"""
Get content from wikihow page and format.
:param lil: html tag content.
:return: format content.
"""
glob... |
the-stack_106_24093 | import time
import matplotlib
from charlieenv import CharlieEnv
from evaluatebob import evaluate
from vectorizeenv import VectorizedClass
matplotlib.use('TkAgg')
from stable_baselines3 import PPO
from bobenv import GetBobEnvClass
def just_bob():
for i in [100000, 500000, 1000000, 5000000]:
start = time... |
the-stack_106_24094 | import numpy as np
import pandas as pd
from .classifiers import classifier_dict
def local_test(x_train, pit_train, x_test, alphas=np.linspace(0.0, 1.0, 11), clf_name='MLP', n_trials=1000):
clf = classifier_dict[clf_name]
### calculate T_i value at point of interest x_test
all_rhat_alphas = {}
... |
the-stack_106_24100 | import re
import json
from functools import lru_cache
import typing
from mitmproxy.contentviews import base
PARSE_ERROR = object()
@lru_cache(1)
def parse_json(s: bytes) -> typing.Any:
try:
return json.loads(s.decode('utf-8'))
except ValueError:
return PARSE_ERROR
def format_json(data: ty... |
the-stack_106_24102 | # Note: this broke when moving to Python 3.9 duo to some issue with numba.
# Refer to C++ implementation.
import time
import numpy as np
from numba import njit, uint32
@njit(uint32(uint32, uint32[:], uint32, uint32))
def play_till_round(max_round, memory, last_number, n_starting_numbers):
for round_nr in range(... |
the-stack_106_24104 | #!/usr/bin/env python3
import os
from aws_cdk import (
aws_ec2 as ec2,
aws_ecs as ecs,
aws_lambda as aws_lambda,
aws_dynamodb as dynamodb,
aws_batch as batch,
aws_s3 as s3,
aws_iam as iam,
aws_ecr_assets,
core
)
from batch_job_cdk.constructs.instance_profile import InstanceProfile... |
the-stack_106_24107 | #
# 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_24112 | import SPARQLWrapper
import argparse
from collections import defaultdict,OrderedDict
import json
import re
def runQuery(query):
endpoint = 'https://query.wikidata.org/sparql'
sparql = SPARQLWrapper.SPARQLWrapper(endpoint, agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) C... |
the-stack_106_24113 | # -*- coding: utf-8 -*-
"""
werkzeug.routing
~~~~~~~~~~~~~~~~
When it comes to combining multiple controller or view functions (however
you want to call them) you need a dispatcher. A simple way would be
applying regular expression tests on the ``PATH_INFO`` and calling
registered call... |
the-stack_106_24114 | def hailstone(n):
while 1:
print(n)
if n == 1:
break
n = 3*n + 1 if n & 1 else n // 2
if __name__ == "__main__":
hailstone(int(input("Enter the starting number:\n"))) # try 7 or 27
|
the-stack_106_24117 | from typing import Dict, List, Optional
from attr import dataclass
from feast.feature import Feature
from feast.protos.feast.core.FeatureViewProjection_pb2 import (
FeatureViewProjection as FeatureViewProjectionProto,
)
@dataclass
class FeatureViewProjection:
"""
A feature view projection represents a s... |
the-stack_106_24119 | from typing import Any, Dict, Optional, List
import subprocess
import json
import faldbt.lib as lib
from dbt.logger import GLOBAL_LOGGER as logger
import os
import shutil
from os.path import exists
import argparse
class DbtCliOutput:
def __init__(
self,
command: str,
return_code: int,
... |
the-stack_106_24121 | # Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
from __future__ import print_function
import dace
import numpy as np
# Dynamically creates DaCe programs with the same name
def program_generator(size, factor):
@dace.program(dace.float64[size],
dace.float64[size],
... |
the-stack_106_24122 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2020 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
the-stack_106_24123 | #To reverse a given array
import array as arr
#using library
a= arr.array('d',[1,2,3,4,5])
a1 = a[::-1]
print('Array Reversal -> ',a1)
b = [1,2,3,4]
b1 = b[::-1]
print('array reverse ->',b1)
#reverse using reversed()
c = [52.5,78.9,63.7,935.9]
c.reverse()
print("Reversed array ->",c) |
the-stack_106_24125 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written by Michele Comitini <mcm@glisco.it>
License: LGPL v3
Adds support for OAuth 2.0 authentication to web2py.
OAuth 2.0 spec: http://tools.ietf.org/html/rfc6749
"""
import time
import cgi
from gluon._compat import urllib2
from gluon._compat import urlencode
... |
the-stack_106_24126 | # Database interactions
from pymongo import MongoClient
from datetime import datetime
from calendar import monthrange
from pycountry_convert import country_name_to_country_alpha2, country_alpha2_to_country_name
from pprint import pprint
import json
# client = MongoClient('localhost', 27017)
client = MongoClient('mong... |
the-stack_106_24127 | e = 0
n1 = float(input('Digite um numero; '))
n2 = float(input('Digite outro numero; '))
while not e == 6:
e = int(input('''Escolha O que deseja fazer;
[1] soma
[2] multiplicar
[3] maior
[4] Calcular o fatorial de um número
[5] Digitar novos números
[6] sair
'''))
if e == 1:
... |
the-stack_106_24128 | from kfp import components
import kfp.dsl as dsl
fairness_check_ops = components.load_component_from_url('https://raw.githubusercontent.com/Trusted-AI/AIF360/master/mlops/kubeflow/bias_detector_pytorch/component.yaml')
robustness_check_ops = components.load_component_from_url('https://raw.githubusercontent.com/Trusted... |
the-stack_106_24131 | import json
import importlib
from assetmunki.interop import Serializeable
class Asset(Serializeable):
_columns = [
'machine.serial_number',
'machine.machine_name',
'machine.machine_model',
'machine.machine_desc',
'machine.hostname',
'reportdata.long_username',
... |
the-stack_106_24133 | from bs4 import BeautifulSoup
from terminaltables import SingleTable
import requests, re
def searchCopainsdavant(nom, city):
url = "http://copainsdavant.linternaute.com/s/?ty=1&prenom=%s&nom=%s&nomjf=&annee=&anneeDelta=&ville=%s"
name = nom
if " " in name:
nom = name.split(" ")[1]
prenom = name.split(" ")[0]
e... |
the-stack_106_24135 | import numpy as np
import imgaug.augmenters as iaa
from imgaug.augmentables.segmaps import SegmentationMapsOnImage
from PIL import Image
from parameters import tag_image, tag_label, tag_name, label_folder_name
import random
import os
from typing import Union
class AugManager(object):
def __init__(self, iaalist=N... |
the-stack_106_24136 | import torch
import torch.nn as nn
class Model(torch.nn.Module):
def __init__(self, input_shape, outputs_count, hidden_count = 256):
super(Model, self).__init__()
self.device = "cpu" #torch.device("cuda" if torch.cuda.is_available() else "cpu")
self.layers = [
nn... |
the-stack_106_24137 | """jc - JSON CLI output utility `cksum` command output parser
This parser works with the following checksum calculation utilities:
- `sum`
- `cksum`
Usage (cli):
$ cksum file.txt | jc --cksum
or
$ jc cksum file.txt
Usage (module):
import jc.parsers.cksum
result = jc.parsers.cksum.parse(cksum_... |
the-stack_106_24139 | import os
from indra.preassembler import Preassembler, render_stmt_graph, \
flatten_evidence, flatten_stmts
from indra.sources import reach
from indra.statements import *
from indra.ontology.bio import bio_ontology
from indra.ontology.world import world_ontology
def test_duplicates():
... |
the-stack_106_24140 | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from itertools import product
import pprint
import shutil
import os
import sonnet as snt
import itertools
from tensorflow.python.util import nest
import matplotlib.pyplot as plt
from matplotlib import animation
import matplotlib.gridspec a... |
the-stack_106_24141 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import six
import string
import random
try:
import h5py
H5PY_SUPPORTED = True
except Exception as e:
print("hdf5 is not supported on this machine (please install/reinstall h5py for optimal experience)")
H5PY_SUPPOR... |
the-stack_106_24142 | import dash
from dash.dependencies import Output, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly
import random
import plotly.graph_objs as go
from collections import deque
X = deque(maxlen=20)
X.append(1)
Y = deque(maxlen=20)
Y.append(1)
app = dash.Dash(__name__)
app.layou... |
the-stack_106_24147 | # Copyright 2021 MONAI Consortium
# 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, s... |
the-stack_106_24148 | import functools
import torch
from scipy.linalg import lapack as scll
from falkon.la_helpers import potrf
from falkon.options import FalkonOptions
from falkon.utils.helpers import choose_fn
__all__ = ("check_init", "inplace_set_diag_th", "inplace_add_diag_th",
"lauum_wrapper", "potrf_wrapper")
def check... |
the-stack_106_24150 | import argparse
from app.conf.yaml_conf import read_conf
parser = argparse.ArgumentParser(description='Sentrix server.')
parser.add_argument('--conf', dest='conf', action='store', default='configuration.yaml',
help='Path to the server configuration yaml file')
subparsers = parser.add_subparsers()
... |
the-stack_106_24151 | import matplotlib.pyplot as plt
import numpy as np
import multiprocessing
#multiprocessing.freeze_support() # <- may be required on windows
def plot(datax, datay, name):
x = datax
y = datay**2
plt.scatter(x, y, label=name)
plt.legend()
plt.show()
def multiP():
for i in range(2):
p = m... |
the-stack_106_24154 | from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api
from django.utils.... |
the-stack_106_24156 | """Common test functions."""
from unittest.mock import MagicMock, PropertyMock, patch
from uuid import uuid4
from aiohttp import web
from aiohttp.test_utils import TestClient
import pytest
from supervisor.api import RestAPI
from supervisor.bootstrap import initialize_coresys
from supervisor.coresys import CoreSys
fro... |
the-stack_106_24157 | import collections
import logging
from typing import Dict, List, Optional, Set, Tuple, Union, Callable
from blspy import AugSchemeMPL, G1Element
from Dortbip158 import PyBIP158
from clvm.casts import int_from_bytes
from Dort.consensus.block_record import BlockRecord
from Dort.consensus.block_rewards import calculate_... |
the-stack_106_24159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: Image2Image.py
# Author: Yuxin Wu
import cv2
import numpy as np
import tensorflow as tf
import glob
import os
import argparse
from tensorpack import *
from tensorpack.utils.gpu import get_num_gpu
from tensorpack.utils.viz import stack_patches
from tensorpack.tfut... |
the-stack_106_24160 | import math
from .EmbConstant import *
from .EmbThreadShv import get_thread_set
from .ReadHelper import (
read_int_8,
read_int_16be,
read_int_32be,
read_string_8,
signed8,
signed16,
)
def read(f, out, settings=None):
in_jump = False
f.seek(0x56, 1) # header text
... |
the-stack_106_24161 | import logging
import os
import shutil
from services import dump_asc_12, dump_asc_16, dump_hzk_16, dump_hzk_12, make_font
logging.basicConfig(level=logging.DEBUG)
outputs_dir = 'outputs/'
docs_dir = 'docs/'
releases_dir = 'releases/'
def main():
if os.path.exists(outputs_dir):
shutil.rmtree(outputs_dir... |
the-stack_106_24162 | # coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2021, Knowledge Engineering Group (KEG), Tsinghua University
# Modified by Jiezhong Qiu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
the-stack_106_24164 | """
Derived module from dmdbase.py for forward/backward dmd.
"""
import numpy as np
from scipy.linalg import sqrtm
from .dmdbase import DMDBase
class FbDMD(DMDBase):
"""
Forward/backward DMD class.
:param svd_rank: the rank for the truncation; If 0, the method computes the
optimal rank and uses ... |
the-stack_106_24165 | import hashlib
import hmac
from buidl.helper import (
big_endian_to_int,
encode_base58_checksum,
hash160,
hash256,
int_to_big_endian,
raw_decode_base58,
)
from buidl._libsec import ffi, lib
GLOBAL_CTX = ffi.gc(
lib.secp256k1_context_create(
lib.SECP256K1_CONTEXT_SIGN | lib.SECP256... |
the-stack_106_24166 | #! /usr/bin/env python3
#
# Show a compact release note summary of a range of Git commits.
#
# Example use: release-notes.py --help
#
# Note: the first commit in the range is excluded!
#
# Requires:
# - GitPython https://pypi.python.org/pypi/GitPython/
# - You need to configure your local repo to pull the PR refs f... |
the-stack_106_24167 | ###############################################################
# pytest -v --capture=no tests/1_local/test_variables.py
# pytest -v tests/1_local/test_variables.py
# pytest -v --capture=no tests/1_local/test_variables.py::TestVariables::<METHODNAME>
###############################################################
imp... |
the-stack_106_24168 | # 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_106_24169 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... |
the-stack_106_24170 | """
Test selectors level 2.
```
*
:first-child
E > F
E + F
[foo]
[foo='bar']
[foo~='bar']
[foo|='en']
:hover
:focus
:lang(en)
::pseudo-element (not implemented)
@at-rule (not implemented)
/* comments */
```
We will currently fail on pseudo-elements `::pseudo-element` as they are not real elements.
At the time of CSS2... |
the-stack_106_24173 | from click import Group
from django.contrib.auth import authenticate # , login
from django.shortcuts import get_object_or_404, render
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet, mixins
from django.contrib.auth.models import User
from rest_framework import generics, st... |
the-stack_106_24174 | #!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-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.
"""Bitcoin P2P ... |
the-stack_106_24175 | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
the-stack_106_24176 | # 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 u... |
the-stack_106_24177 | program = open("/share/Ecoli/GCA_000005845.2_ASM584v2_genomic.fna", "r")
genes = program.readlines()[1:]
genome = []
genome1 = []
for i in genes:
i = i.rstrip('\n')
genome.append(i)
for i in genome:
genome1.append(i)
genome2 = ""
for i in range(len(genome1)):
if i == "G":
if i+1 == "A":
if i+2 == "C"... |
the-stack_106_24178 | # -*- coding: utf-8 -*-
'''Code imported from ``textblob-fr`` sample extension.
:repo: `https://github.com/sloria/textblob-fr`_
:source: run_tests.py
:version: 2013-10-28 (5c6329d209)
:modified: July 2014 <m.killer@langui.ch>
'''
import sys
import subprocess
import re
from setuptools import setup
packages = ['textb... |
the-stack_106_24179 | import unittest
from collections import OrderedDict
from unittest import mock
from data import api_caller
class TestLegal(unittest.TestCase):
@mock.patch.object(api_caller, '_call_api')
def test_load_legal_mur(self, call_api):
call_api.return_value = {
'docs': [{
'no': '12... |
the-stack_106_24180 | import pandas as pd
import pytest
from evalml.data_checks import (
DataCheckMessageCode,
DataCheckWarning,
SparsityDataCheck
)
sparsity_data_check_name = SparsityDataCheck.name
def test_sparsity_data_check_init():
sparsity_check = SparsityDataCheck("multiclass", threshold=4 / 15)
assert sparsit... |
the-stack_106_24182 | import pathlib
import unittest
from jinja2 import FileSystemLoader
from jinja2 import Template
from jinja2 import Environment
from datetime import datetime, timedelta
from airflow import DAG
from airflow_kjo import KubernetesJobOperator
class KubeLauncherMock:
def __init__(self):
pass
def apply(self... |
the-stack_106_24184 | import tensorflow as tf
from tensorflow.keras import layers
from model.ops import MultiChannelEmbedding, ConvolutionLayer, MaxPooling
from gluonnlp import Vocab
class SenCNN(tf.keras.Model):
def __init__(self, num_classes: int, vocab: Vocab) -> None:
super(SenCNN, self).__init__()
self._embedding ... |
the-stack_106_24186 | from .config import *
import shodan
import time
def get_device(device_name, json_output=False):
try:
api = shodan.Shodan(shodan_api_key)
results = api.search(device_name)
time.sleep(5)
if json_output:
print(results)
return
print(f"Result... |
the-stack_106_24192 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('orchestra', '0003_auto_20141229_1610'),
]
operations = [
migrations.AddField(
model_name='t... |
the-stack_106_24194 | # Copyright (c) 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.
from code import Code
from model import PropertyType
import cpp_util
import schema_util
import util_cc_helper
class CCGenerator(object):
def __init__(... |
the-stack_106_24195 | from crawler import crawler_51_job
import schedule
import time
import argparse
import sys
def run_one():
keys=['python','java']
c=crawler_51_job()
for k in keys:
c.set_search_key(k)
c.run()
def schedule_run(t):
schedule.every().day.at(t).do(run_one)
while True:
schedule.r... |
the-stack_106_24196 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
the-stack_106_24197 | #! /usr/bin/env python3
import os
from steves_utils.ORACLE.utils_v2 import (ALL_DISTANCES_FEET, ALL_RUNS,
ALL_SERIAL_NUMBERS,
serial_number_to_id)
from steves_utils.papermill_support import run_trials_with_papermill
################... |
the-stack_106_24199 | # coding=utf-8
# Copyright 2018 The Dopamine Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
the-stack_106_24203 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... |
the-stack_106_24204 | """
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import os, sys
sys.path.append(os.path.dirname(__file__))
from Editor_TestClass import BaseClass
class Editor_C... |
the-stack_106_24205 | from functools import partial
from typing import Any, List, Optional
import torch
from torch import nn
from torch.nn import functional as F
BATCH_NORM_MOMENTUM = 0.005
ENABLE_BIAS = True
activation_fn = nn.ELU()
class ASPPConv(nn.Sequential):
def __init__(self, in_channels: int, out_channels: int, dilation: int)... |
the-stack_106_24206 | from scoring_matrices import BLOSUM62
def global_alignment(seq1, seq2, scoring_matrix, indel_penalty):
m = len(seq1)
n = len(seq2)
s = [[0 for i in range(n+1)] for j in range(m+1)]
backtrack_matrix = [[0 for i in range(n+1)] for j in range(m+1)]
for i in range(1, m+1):
s[i][0] =... |
the-stack_106_24207 | from datetime import datetime
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas.core.dtypes.base import _registry as ea_registry
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_interval_dtype,
is_object_dtype,
)
from pandas.core.dtypes.dtypes import (... |
the-stack_106_24210 | import codecs
import datetime as dt
import re
import time
from configparser import ConfigParser
from bs4 import BeautifulSoup as bs
from peewee import fn
from progress.bar import IncrementalBar
from selenium.common.exceptions import (ElementClickInterceptedException,
StaleElemen... |
the-stack_106_24212 | # Copyright 2020 Google 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,... |
the-stack_106_24214 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
"""
Finding Best Hyper Parameter for Classifier
=======================================================
In this example, we try to find the best hyper parameter of Classifier
(`method` and... |
the-stack_106_24216 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import super
import unittest
from parameterized import parameterized
from pprint import pprint
from beem import Steem
from beem.discussions import (
Quer... |
the-stack_106_24219 | import oyaml as yaml
import sys
import configargparse
parser = configargparse.ArgumentParser(auto_env_var_prefix="INIT_")
parser.add_argument("--config-path", help="path to the configuration.yml file", default="/opt/opencga/conf/configuration.yml")
parser.add_argument("--client-config-path", help="path to the client-c... |
the-stack_106_24220 | from __future__ import division
from __future__ import print_function
import codecs
import sys
import tensorflow.compat.v1 as tf
from DataLoader import FilePaths
class DecoderType:
BestPath = 0
WordBeamSearch = 1
BeamSearch = 2
class Model:
# Model Constants
batchSize = 10 # 50
imgSize =... |
the-stack_106_24223 | from functools import partial
import json
import pytest
import requests
import responses
import tamr_client as tc
from tests.tamr_client import fake
@fake.json
def test_get_auth_cookie():
auth = fake.username_password_auth()
s = fake.session()
instance = fake.instance()
assert s.auth is None
as... |
the-stack_106_24225 | import os
parent_directory_names = ["input_images", "csv_data_and_classes", "labelled_xml_data", "tfrecords", "model_training", "trained_model"]
subdirectory_names = ["train", "test"]
for directory_name in parent_directory_names:
cwd = os.getcwd()
directory_to_be_created = os.path.join(cwd, directory_name)
... |
the-stack_106_24226 | # -*- coding:utf-8 -*-
'''
Define the widget modules for TorCMS.
'''
import tornado.escape
import tornado.web
from torcms.model.reply_model import MReply
from torcms.model.rating_model import MRating
from torcms.core.libs.deprecation import deprecated
class BaiduShare(tornado.web.UIModule):
'''
widget for b... |
the-stack_106_24227 | # 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_106_24228 | import warnings
import os.path
import numpy as np
import pandas as pd
import ntpath
import openpyxl
import xlrd
try:
from openpyxl.utils.cell import coordinate_from_string
except:
from openpyxl.utils import coordinate_from_string
from .helpers import compare_pandas_versions, check_valid_xls
from .collect i... |
the-stack_106_24232 | # User Configuration variable settings for pitimolo
# Purpose - Motion Detection Security Cam
# Created - 20-Jul-2015 pi-timolo ver 2.94 compatible or greater
# Done by - Claude Pageau
configTitle = "pi-timolo default config motion"
configName = "pi-timolo-default-config"
# These settings should both be False if thi... |
the-stack_106_24237 | import logging
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.test import Client, TestCase
from django.urls import reverse
from cms.contexts.tests import ContextUnitTest
from cms.pages.models import PageHeading
from cms.pages.tests import ... |
the-stack_106_24240 | # Regularly scheduled update: check which files need updating and process them
# TODO: migrate to GitHub API v4, which uses GraphQL. Example query below -- use
# https://developer.github.com/v4/explorer/ to try it out (need to use the
# actual node IDs returned):
#
# {
# repository(owner: "vim", name: "vim") {
# ... |
the-stack_106_24242 | from openpharmacophore._private_tools.exceptions import FetchError, OpenPharmacophoreValueError
import pandas as pd
from tqdm.auto import tqdm
from io import StringIO
import json
import requests
import time
from typing import List, Dict, Tuple
base_url = "https://pubchem.ncbi.nlm.nih.gov/rest/pug"
def _get_data(url: ... |
the-stack_106_24243 | # coding: utf-8
"""
Accounting Extension
These APIs allow you to interact with HubSpot's Accounting Extension. It allows you to: * Specify the URLs that HubSpot will use when making webhook requests to your external accounting system. * Respond to webhook calls made to your external accounting system by HubSp... |
the-stack_106_24245 | # -*- coding: utf-8 -*-
"""
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 excep... |
the-stack_106_24246 | import random
import time
import math
from copy import deepcopy
import gamePlay
from getAllPossibleMoves import getAllPossibleMoves
ALL_PLAYERS = {}
WIN_PRIZE = 1
LOSS_PRIZE = 0
TURNS_COUNT = 0
C = math.sqrt(2)
def nextMove(board, color, sim_time, max_turns, max_sim, percent_wrong,
moves_remaining, verbose):
... |
the-stack_106_24247 | from core.advbase import *
from slot.a import *
galex_conf = {
'x1.dmg': 82 / 100.0,
'x1.startup': 8 / 60.0,
'x1.recovery': 34 / 60.0,
'x1.hit': 1,
'x2.dmg': 88 / 100.0,
'x2.startup': 0,
'x2.recovery': 28 / 60.0,
'x2.hit': 1,
'x3.dmg': 104 / 100.0,
'x3.startup': 0,
'x3.rec... |
the-stack_106_24250 | #! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... |
the-stack_106_24252 | # -*- coding: utf-8 -*-
# Update by : https://github.com/tenyue/ServerStatus
# 支持Python版本:2.6 to 3.5
# 支持操作系统: Linux, OSX, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures
SERVER = "127.0.0.1"
PORT = 35601
USER = "USER"
PASSWORD = "USER_PASSWORD"
INTERVAL = 1 #更新间隔
import socket
import time
import... |
the-stack_106_24254 | from settings import LOAD_TALIB
if LOAD_TALIB:
import talib
from apps.TA import HORIZONS
from apps.TA.storages.abstract.indicator import IndicatorStorage
from apps.TA.storages.abstract.indicator_subscriber import IndicatorSubscriber
from apps.TA.storages.data.price import PriceStorage
from settings import logger
... |
the-stack_106_24255 | import os
import random
import re
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from threading import Thread
from typing import NoReturn, Tuple
import requests
from bs4 import BeautifulSoup
from googlehomepush import GoogleHome
from googlehomepush.http_ser... |
the-stack_106_24256 | import copy
import logging
from typing import Dict, List, Optional, Union
from ray.tune.error import TuneError
from ray.tune.experiment import Experiment, convert_to_experiment_list
from ray.tune.config_parser import make_parser, create_trial_from_spec
from ray.tune.suggest.search import SearchAlgorithm
from ray.tune.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.