text stringlengths 2 999k |
|---|
import pytest
from arroyo.utils.metrics import Gauge, configure_metrics, get_metrics
from tests.metrics import Gauge as GaugeCall
from tests.metrics import TestingMetricsBackend
def test_gauge_simple() -> None:
backend = TestingMetricsBackend
name = "name"
tags = {"tag": "value"}
gauge = Gauge(backe... |
import argparse
import importlib
import json
import os
import sys
from collections import defaultdict
import numpy as np
import tensorflow as tf
import logger
import utils
from config_rnn import defaults
np.set_printoptions(suppress=True)
def classify(config_name, seq_len, n_trials, batch_size):
configs_dir = ... |
#########################################################################################################################
## Distribution code Version 1.0 -- 14/10/2021 by Tak Ming Wong Copyright 2021, University of Siegen
##
## The Code is created based on the method described in the following paper
## [1] "Dee... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
import string
from textwrap import dedent
from pants.build_graph.t... |
from __future__ import absolute_import, division, print_function
import unittest
import logging
import pprint
log = logging.getLogger(__name__)
class TestLoadingOperators(unittest.TestCase):
def test_loading(self):
import pbsmrtpipe.loader as L
operators = L.load_all_installed_chunk_operators()... |
from programa import terceira_questao
if __name__ == "__main__":
terceira_questao()
|
import setuptools
setuptools.setup(
name="hpvm_profiler",
version="0.1",
author="Akash Kothari, Yifan Zhao",
author_email="akashk4@illinois.edu, yifanz16@illinois.edu",
description="A package for profiling of HPVM approximation configurations",
packages=["hpvm_profiler"],
install_requires=[... |
import datetime
import unittest
from zoomus import components, util
import responses
def suite():
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(CreateV1TestCase))
suite.addTest(unittest.makeSuite(CreateV2TestCase))
return suite
class Cre... |
# -*- coding: utf-8 -*-
from flask import Flask
app = Flask(__name__)
from myapp import views
|
import sys
from rpython.translator.c.support import USESLOTS # set to False if necessary while refactoring
from rpython.translator.c.support import cdecl
from rpython.translator.c.support import llvalue_from_constant, gen_assignments
from rpython.translator.c.support import c_string_constant, barebonearray
from rpython... |
import os
from torch.utils.tensorboard import SummaryWriter
from .plot_image import *
def get_writer(output_directory, log_directory):
logging_path=f'{output_directory}/{log_directory}'
if os.path.exists(logging_path):
raise Exception('The experiment already exists')
else:
os.mkdir(log... |
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import os
from . import FileStore, TCPStore
_rendezvous_handlers = {}
def register_rendezvous_handler(scheme, handler):
"""Registers a new rendezvous handler.
Before we can run collective algorithms, participa... |
#-------------------------------------#
# 调用摄像头或者视频进行检测
# 调用摄像头直接运行即可
# 调用视频可以将cv2.VideoCapture()指定路径
# 视频的保存并不难,可以百度一下看看
#-------------------------------------#
import time
import cv2
import numpy as np
import tensorflow as tf
from PIL import Image
from efficientdet import EfficientDet
gpus =... |
from Command import Command
from iExecLog import Log
import re
class Order():
id = "none"
price = "None"
pool = "None"
category = "None"
timestamp = "None"
def __init__(self, _id=None, _price=None, _pool=None, _category=None, _timestamp=None):
self.id = _id
self.price = _price... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from typing import List
from spack.package import *
class PySphinxcontribSerializinghtml(PythonPackage):
"""sphinxco... |
"""
This is an object-oriented plotting library.
A procedural interface is provided by the companion pyplot module,
which may be imported directly, e.g.::
import matplotlib.pyplot as plt
or using ipython::
ipython
at your terminal, followed by::
In [1]: %matplotlib
In [2]: import matplotlib.pyplot... |
#!/usr/bin/env python
# Filename: util.py
'''
util
@author: Andrew Philpot
@version 0.79
collection of misc utils
Usage: python util.py
Options:
\t-h, --help:\tprint help to STDOUT and quit
\t-v, --verbose:\tverbose output
'''
import sys
import inspect
import types
import getopt
import fileinput
import tempfile
impo... |
#!/usr/bin/python
import sys
import subprocess
import os
import psutil
import shutil
import pdb
def init_alloc_core():
global allocated
total_cores = psutil.cpu_count()
for i in range(total_cores):
allocated[i] = 0
return
def return_free_core():
#select the core having minimum... |
"""
A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit the parent domains "leetcode.com" and "com"... |
# Evaluate DAP participation using Chrome headless.
# Can also be run in Lambda.
lambda_support = True
# Signal that this is a JS-based scan using headless Chrome.
# The scan method will be defined in third_parties.js instead.
scan_headless = True
# make sure we have the domain/url stuff set up properly
def init_do... |
# 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... |
from django.test import TestCase
from tests.utils import TestConfiguration
class JobModelTestCase(TestCase):
def setUp(self) -> None:
self.config = TestConfiguration()
def test_downstream_jobs(self):
downstream_jobs = self.config.job.get_downstream_jobs(include_self=False)
self.asse... |
from __future__ import absolute_import
from __future__ import print_function
import collections
import datetime
import re
import os.path
from .shims import subprocess_check_output
MANUAL_EDIT_WARNING = """This file is generated using the %s script. DO NOT MANUALLY EDIT!!!!
Last Modified: %s
""" % (os.path.basename(... |
import os
import time
import json
import torch
import torchvision
from PIL import Image
import matplotlib.pyplot as plt
from torchvision import transforms
from network_files import FasterRCNN, FastRCNNPredictor, AnchorsGenerator
from backbone import resnet50_fpn_backbone, MobileNetV2
from draw_box_utils import draw_b... |
import argparse
import os
import azureml.dataprep as dprep
print("Replace undefined values to relavant values and rename columns to meaningful names")
parser = argparse.ArgumentParser("normalize")
parser.add_argument("--input_normalize", type=str, help="combined and converted taxi data")
parser.add_argument("--output... |
"""Support for Anthem Network Receivers and Processors."""
import logging
import anthemav
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT... |
from ..services import ip_service
from ..clients import ssh_client
async def get_factorio_logs_tail(game, lines):
ip = await ip_service.get_ip(game)
return ssh_client.execute_get(ip, f'tail -n {lines} /opt/factorio/factorio-current.log')
|
_base_ = [
'../_base_/models/mask_rcnn_swin_fpn.py',
'../_base_/datasets/cityscapes_instance.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=... |
import logging
import io
import itertools
import ray
import torch
from ray.util.sgd.torch.constants import USE_FP16, NUM_STEPS
from ray.util.sgd import utils
logger = logging.getLogger(__name__)
amp = None
try:
from apex import amp
except ImportError:
logger.debug("apex is not installed.")
pass
class ... |
def greet(personal, family, title="", polite=False):
""" Generate a greeting string for a person.
Parameters
----------
personal: str
A given name, such as Will or Jean-Luc
family: str
A family name, such as Riker or Picard
title: str
An optional title, such as Captain ... |
from pathlib import Path
import os, cv2, torch
import threading
from detection_program.options import opt
import numpy as np
from torch.autograd import Variable
import copy, time
from utils.eval_utils import generate_result, eliminate_fewer_points, sort_along_y, eliminate_out, draw_points, sort_lane
from PySide2.QtCore... |
import qrcode
titulo=input('Title: ')
texto=input("what data do you want to enter \n ")
color_codigo=input("Code color (ingles): ")
color_fondo=input("Bacground color (ingles): ")
while True:
porcentaje=input("The code error percent (L->7%,M->15%,Q->25%,H->30%): ")
if (porcentaje.upper()=="L" or porcentaje.upper()=="... |
import argparse
import os
from pathlib import Path
import gym
import gym_puddle # noqa f401
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from utils.utils import minmax_normalization_ab
matplotlib.rcParams.update({"font.size": 24})
sns.set()
parser = argparse.ArgumentPa... |
"""Disassembler of Python byte code into mnemonics."""
import sys
import types
import collections
import io
from opcode import *
from opcode import __all__ as _opcodes_all
from opcode import _nb_ops
__all__ = ["code_info", "dis", "disassemble", "distb", "disco",
"findlinestarts", "findlabels", "show_code"... |
#!/usr/bin/env python
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
"""
Module contains tools for processing files into DataFrames or other objects
"""
from __future__ import print_function
from pandas.compat import range, lrange, StringIO, lzip, zip, string_types, map
from pandas import compat
from collections import defaultdict
import re
import csv
import warnings
import numpy as np... |
#!/usr/bin/env python
"""
A ROS Node for the Arduino microcontroller
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2012 Patrick Goebel. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public ... |
import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
# Add lib to PYTHONPATH
lib_path = osp.join(this_dir, 'lib')
add_path(lib_path)
#coco_path = osp.join(this_dir, 'data', 'coco', 'PythonAPI')
#add_path(coco_path)
|
import os
import sys
import json
import pandas as pd
import psycopg2
import yaml
import argparse
SOURCE_FILE_NLU_JSON = '/scriptsData/migration/dataNLU/nlu.json'
SOURCE_FILE_NLU_MD = './scriptsData/migration/dataNLU/nlu.md'
SOURCE_FILE_YAML = './scriptsData/migration/domain.yml'
SOURCE_FILE_STORIES = './scriptsDat... |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
"""
Layer that transforms VNC config objects to ifmap representation
"""
from cfgm_common.zkclient import ZookeeperClient, IndexAllocator
from gevent import ssl, monkey
monkey.patch_all()
import gevent
import gevent.event
from gevent.queue import Que... |
#!/usr/bin/python3
import argparse
import json
import sys
import requests
from es2json import esgenerator,isint,litter,eprint,esidfilegenerator
from rdflib import Graph
def enrichrecord(record,hit):
record["sameAs"]=litter(record.get("sameAs"),hit.get("_id"))
if 'http://www.w3.org/2002/07/owl#sameAs' in hit.g... |
import fire
from scripts import plot_results
from scripts import run_experiments
from scripts import tabular_test
class Experiments:
def test(self):
tabular_test.main()
def plot_experiments(self):
plot_results.main()
def run_experiments(self):
run_experiments.main()
... |
from typing import Union, List, Dict, Optional
from skdecide.builders.solver.policy import DeterministicPolicies, UncertainPolicies
from skdecide.builders.scheduling.scheduling_domains_modelling import State, SchedulingAction, SchedulingActionEnum
from skdecide.builders.scheduling.scheduling_domains import SchedulingDo... |
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import sys
import pyp11
print('\tРабота с функциями pyp11.parsecert:')
#cert_der_hex = '3082069d30820648a00302010202021016300c06082a8503070101030205003081e2310b3009060355040613025255312c302a06035504080c23d09cd0bed181d0bad0bed0b2d181d0bad0b0d18f20d0bed0b1d0bbd0b0d181d182d18c... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('Page')
class TestPage(unittest.TestCase):
def test_naming(self):
self.assertRaises(frappe.NameError, frappe.get_doc(d... |
import logging
import multiprocessing
import os
import psutil
import re
import signal
import subprocess
import sys
from patroni import PATRONI_ENV_PREFIX, KUBERNETES_ENV_PREFIX
# avoid spawning the resource tracker process
if sys.version_info >= (3, 8): # pragma: no cover
import multiprocessing.resource_tracker
... |
# qubit number=4
# total number=38
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
import json
from functools import namedtuple
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam
from torch.utils.data import Dataset, DataLoader
import pytorch_lightning as pl
from omegaconf import DictConfig
from cpc.dataset import AudioRawDataset
class Co... |
import asyncio
from pathlib import Path
from secrets import token_bytes
import pytest
from mogua.simulator.simulator_protocol import FarmNewBlockProtocol
from mogua.types.peer_info import PeerInfo
from mogua.util.ints import uint16, uint64
from mogua.wallet.cc_wallet.cc_wallet import CCWallet
from mogua.wallet.trade_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Custom filters for use in openshift-ansible
"""
# Disabling too-many-public-methods, since filter methods are necessarily
# public
# pylint: disable=too-many-public-methods
class FilterModule(object):
""" Custom ansible filters """
@staticmethod
def oo_cert_e... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import textwrap
import pytest
from pants.core.goals import tailor
from pants.core.goals.tailor import (
AllOwnedSources,
DisjointSourcePutativeTarget,
EditBuildFilesRequest,
... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
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... |
"""
Allow null group.creator
Revision ID: 21b1ce37e327
Revises: 9389d52b037d
Create Date: 2017-04-13 16:49:16.218511
"""
from alembic import op
revision = "21b1ce37e327"
down_revision = "9389d52b037d"
def upgrade():
op.alter_column("group", "creator_id", nullable=True)
def downgrade():
op.alter_column("g... |
from flask import Flask
from flask_restx import Api
from flask_cors import CORS
# ROUTES
from routes.ipfs import api as ipfs_api
app = Flask(__name__)
cors = CORS(app, supports_credentials=True)
api = Api()
api = Api(version = '0.9.1',
title = 'hesychasm',
description= 'A serverless API for ... |
# coding: utf-8
"""
Hydrogen Proton API
Financial engineering module of Hydrogen Atom # noqa: E501
OpenAPI spec version: 1.9.2
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pypolarmap.ui'
#
# Created by: PyQt5 UI code generator 5.13.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Mai... |
import weakref
import Queue
from walky.serializer import SystemMessage
ms_count = 0
def id_next():
global ms_count
ms_count += 1
return ms_count
class MessengerSubscriber(object):
_messenger = None
def __init__(self,messenger,filter_op):
self.messenger(messenger)
self.queue = Que... |
# from napari_microscopy_image_denoising import napari_get_writer, napari_write_image
# add your tests here...
def test_something():
pass
|
import tensorflow as tf
def sample_random_seq(model_input, num_frames, num_samples):
batch_size = tf.shape(model_input)[0]
frame_index_offset = tf.tile(tf.expand_dims(tf.range(num_samples), 0),
[batch_size, 1])
max_start_frame_index = tf.maximum(num_frames - num_samples, 0)... |
"""
This module contains all the beekeeper classes that are used on the front end
to directly interface between the developer and the remote API.
"""
from __future__ import division
import copy
from functools import partial
from keyword import iskeyword
from beekeeper.comms import Request
from beekeeper.hive import ... |
"""school URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
#!/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 requir... |
"""
GENARATES A MACHINE READABLE CODE THAT CAN STORE A USER'S USERNAME, TO EFFICIENTLY FIND
THIER PROFILES AND SOCIAL MEDIA LINKS. FORMAT THE DATA WILL BE STORED IN IS MORSE CODE.
THEN WILL USE THE HELP BINARY FORMAT TO ASSIST WITH THE DECODING.
MORSE CODE FORMATTING RULES FOR THE FACE CODE: (NAME :=> SIZE :=> MEANING... |
import pytest
from anyio import (
create_task_group, create_event, wait_all_tasks_blocked, get_running_tasks, get_current_task)
@pytest.mark.anyio
async def test_get_running_tasks():
async def inspect():
await wait_all_tasks_blocked()
new_tasks = set(await get_running_tasks()) - existing_task... |
# -*- coding: utf-8 -*-
#
# 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
... |
## Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
import json
import m2c2_globals as var
import logging
import os
import m2c2_post_handler as post
import m2c2_globals as var
import m2c2_protocol_converter as build
import m2c2_utils as utils
logger = log... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nicira, 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
#
#... |
import pytest
from smartsim.error import SmartSimError
# retrieved from pytest fixtures
if pytest.test_launcher not in pytest.wlm_options:
pytestmark = pytest.mark.skip(reason="Not testing WLM integrations")
try:
from smartredis import Client
config_setter = Client.config_set
except AttributeError:
... |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
# Copyright 2013 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.
{
'targets': [
{
'target_name': 'brotli',
'type': 'static_library',
'include_dirs': [
'dec',
],
'sources': [
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-22 14:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('images', '0008_auto_20171120_1056'),
]
operations ... |
from .estimator import *
from .perceptron import *
from .adaline import *
from .kmeans import *
|
import os
root_path = os.path.dirname(os.path.abspath('__file__'))
import sys
sys.path.append(root_path)
from tools.plot_utils import plot_pacf
plot_pacf(
file_path=root_path+'/Huaxian_modwt/data/db10-2/PACF.csv',
save_path=root_path+'/Huaxian_modwt/graph/',
) |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
""" PyTorch EfficientNet Family
An implementation of EfficienNet that covers variety of related models with efficient architectures:
* EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/AdvProp/NoisyStudent weight ports)
- EfficientNet: Rethinking Model Scaling for CNNs - https://arxiv.org/abs/1905.119... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
###############################################################################
# PURPOSE:
# Lambda function to check the status of a Rekognition job and save that job's
# data to the MIE dataplane when ... |
class Nomina:
def __init__(self,nom="",ruc=0,dire="",tele=0,ciud="",tipEmpr="", email="",estado="",profe=""):#3
self.nombre=nom
self.ruc=ruc
self.direccion=dire
self.telefono=tele
self.ciudad=ciud
self.tipoEmpresa=tipEmpr
self.correo=email
self.estado... |
import openal
from .coordinates_transformer import CoordinatesTransformer
class Source(openal.Source):
def __init__(self, buffer, destroy_buffer, coordinates_divider, coordinate_decimal_places, coordinate_system, origin):
super().__init__(buffer, destroy_buffer)
self._transformer = Coordinate... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import numpy as np
from pathlib import Path
from MiniFramework.EnumDef_3_0 import *
class WeightsBias_1_0(object):
def __init__(self, n_input, n_output, init_method... |
'''
Created on Nov 13, 2015
@author: Vlad
'''
class GenericRepository:
'''
GenericRepository, which is a base class for all other repositories
'''
def __init__(self):
self._storage = []
def add(self, obj):
'''
Function to handle the add for every repository
:param obj:
:return:
'''
if obj in ... |
"""
WSGI config for tourist_attractions project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('... |
from os import path
from setuptools import setup, find_packages
this_dir = path.abspath(path.dirname(__file__))
with open(
path.join(this_dir, "utils", "setup", "README.pypi.md"), encoding="utf-8"
) as f:
long_description = f.read()
setup(
name="smarts",
description="Scalable Multi-Agent RL Training S... |
# 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... |
from __future__ import print_function
import sys
import string
from random import choice, randint
from perfect_hash import generate_hash
def flush_dot():
sys.stdout.write('.')
sys.stdout.flush()
def random_key():
return ''.join(choice(string.printable) for i in range(randint(1, 4)))
def main():
... |
import argparse
import datetime
import os
import pickle
import random
import sys
import numpy as np
import matplotlib.pyplot as plt
from acs.objective import fitness, multi_fitness
from acs.instance import Instance
from utils.multiobjective import fitness_sch
from utils.misc import evaluate_population_fixed, evaluat... |
from unittest import mock
import click
import io
import pytest
from pathlib import Path
from elisctl.common import schema_content_factory
from elisctl.schema.xlsx import XlsxToSchema
def file_decorator(*_args, **_kwargs):
def test_decorator(f):
def test_wrapped(*args, **kwargs):
return f(*ar... |
# Copyright (c) 2020 Red Hat, 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 require... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import timedelta
from django.db import models
from django.conf import settings
from django.db.models import F
from django.utils import timezone
from django.dispatch import receiver
from django.contrib.contenttypes.fields import GenericForeig... |
# Module that defines the strategies defined for the handling of missing values.
#
# Author: Fernando García <ga.gu.fernando@gmail.com>
#
# External dependencies
import numpy as np
# Module dependencies
from ..interface.imputation import ImputationStrategy
class DynamicValue(ImputationStrategy):
"""
Imputatio... |
from ee.kafka_client.topics import KAFKA_SESSION_RECORDING_EVENTS
from posthog.settings import CLICKHOUSE_CLUSTER, CLICKHOUSE_DATABASE
from .clickhouse import KAFKA_COLUMNS, REPLACING_MERGE_TREE, kafka_engine, table_engine, ttl_period
SESSION_RECORDING_EVENTS_TABLE = "session_recording_events"
SESSION_RECORDING_EVEN... |
# Copyright 2020-2022 OpenDR European Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
from locust import HttpLocust, TaskSet, task
import json, uuid, io, random, string
class UserBehavior(TaskSet):
def on_start(self):
global token, headers, getId
#---------- Configurations
#user token
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0d... |
import os
import time
import numpy as np
import torch
from megatron import get_args, get_tokenizer, mpu, print_rank_0
from megatron.data.dataset_utils import create_masked_lm_predictions, \
pad_and_convert_to_numpy
from megatron.data.data_samplers import MegatronPretraining... |
"""Test the helper method for writing tests."""
import asyncio
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from unittest.mock import M... |
#!/usr/bin/env vpython3
# Copyright 2020 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 __future__ import print_function
import copy
import sys
import unittest
if sys.version_info[0] == 2:
import mock
else:
imp... |
# mysql/mysqlconnector.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql+mysqlconnector
:name: MySQL Connector/Python
... |
#!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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... |
r"""Hodgkin-Huxley (HH) benchmark.
HH is a widespread non-linear mechanistic model of neural dynamics.
References:
A quantitative description of membrane current and its application to conduction and excitation in nerve
(Hodgkin et al., 1952)
https://link.springer.com/article/10.1007/BF02459568
Train... |
#!/usr/bin/env python2
# coding: utf-8
from collections import OrderedDict
from pykit.p3json.test import PyTest
from pykit import ututil
dd = ututil.dd
class TestS2Cases(object):
def test_loads_dumps(self):
cases = [
('""', ''),
('"it168/\xb6\xd4.exe"', 'it168/\xb6\xd4... |
"""
Implementation of non-negative matrix factorization for GPU
"""
from datetime import datetime
from nimfa.methods.seeding import nndsvd
import numpy as np
import torch
import torch.nn
from torch import nn
class NMF:
def __init__(self, V, rank, max_iterations=100000, tolerance=1e-8, test_conv=1000, gpu_id=0, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.