text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
"""
scraper manager module.
"""
import requests
from bs4 import BeautifulSoup
import pyrin.configuration.services as config_services
from pyrin.core.structs import Manager
from pyrin.processor.request.enumerations import RequestHeaderEnum
from charma.scraper import ScraperPackage
class Sc... |
# coding: utf-8
#行业龙头股均线
#股票池需要如下:
#沪深300池,
#当前不停牌的股票池,
#有历史数据的股票池,
#两者的交集得到可用股票池
#持仓股票池
#可用股票池中剔除持仓股票得到的股票池(可以进行买入操作的股票池)
#将要买入的股票池:即上述股票池中发出买入信号得到的股票池
#将要卖出的股票池:持仓股票池中,没有停牌的,发出卖出信号的股票池
enable_profile()
import random
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import scipy.stats as sta... |
# Updated 2018
# This module is based on the below cited resources, which are all
# based on the documentation as provided in the Bosch Data Sheet and
# the sample implementation provided therein.
#
# Final Document: BST-BME280-DS002-15
#
# Authors: Paul Cunnane 2016, Peter Dahlebrg 2016
#
# This module borrows from th... |
"""The sample class"""
from datamodel.submittable import AccessionedSubmittable
class Sample(AccessionedSubmittable):
"""
:param alias: string, unique sample name in the experiment
:param accession: string, BioSamples accession
:param taxon: string, latin species name
:param taxonId: ... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import matplotlib.pyplot as plt
from matplotlib import colors
import subprocess
import sys
def create_colormap(file_data, numRows, numCols, gen_number):
data = []
for i in range(0, numRows):
temp = []
for j in range(0, numCols):
if file_data[i][j] == '0':
temp.a... |
"""
Define facilities for automatically upgrading databases.
"""
# NOTE: This code is written slightly to be more generic than we currently
# use. In particular, we maintain multiple migration lists based on a 'schema
# version'. This was done in case we need to add some kind of migration
# functionality for the indiv... |
# coding: utf-8
"""
Cisco Intersight OpenAPI specification.
The Cisco Intersight OpenAPI specification.
OpenAPI spec version: 1.0.9-1461
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class StorageFlexUtilPh... |
import os
import pytest
import six
MAX_ALLOWED_LINKS_COUNT = 10
@pytest.fixture
def metrics(request):
class Metrics(object):
@classmethod
def set(cls, name, value):
assert len(name) <= 128, "Length of the metric name must less than 128"
assert type(value) in [int, float]... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJellyfish(PythonPackage):
"""a library for doing approximate and phonetic matching of s... |
"""
This is an implementation of Function Secret Sharing
Useful papers are:
- Function Secret Sharing- Improvements and Extensions, Boyle 2017
Link: https://eprint.iacr.org/2018/707.pdf
- Secure Computation with Preprocessing via Function Secret Sharing, Boyle 2019
Link: https://eprint.iacr.org/2019/1095
Note tha... |
"""Helpers for config validation using voluptuous."""
from datetime import timedelta
import jinja2
import voluptuous as vol
from homeassistant.loader import get_platform
from homeassistant.const import (
CONF_PLATFORM, CONF_SCAN_INTERVAL, TEMP_CELSIUS, TEMP_FAHRENHEIT,
CONF_ALIAS, CONF_ENTITY_ID, CONF_VALUE_T... |
"""pixel.py: Contains pixel class."""
# pylint: disable=E1101,R0902,C0103
__author__ = "Rajiv Giridharagopal"
__copyright__ = "Copyright 2021"
__maintainer__ = "Rajiv Giridharagopal"
__email__ = "rgiri@uw.edu"
__status__ = "Development"
import numpy as np
from scipy import signal as sps
from scipy import integrate as ... |
""" Python Character Mapping Codec generated z 'VENDORS/MICSFT/PC/CP862.TXT' przy gencodec.py.
"""#"
zaimportuj codecs
### Codec APIs
klasa Codec(codecs.Codec):
def encode(self,input,errors='strict'):
zwróć codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
... |
import sys
# Let's do some dep checking and handle missing ones gracefully
try:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.Qt import Qt
import PyQt4.QtCore as QtCore
except ImportError:
print "You need to have PyQT installed to run Electrum-RADC in graphical mode."
print "... |
#!/usr/bin/env python
from typing import Tuple
from redbot.message import headers
from redbot.syntax import rfc7230, rfc7231
from redbot.type import AddNoteMethodType
class keep_alive(headers.HttpHeader):
canonical_name = "Keep-Alive"
description = """\
The `Keep-Alive` header is completely optional; it is ... |
"""
A simple test for LightGBM based on scikit-learn.
Tests are not shipped with the source distribution so we include a simple
functional test here that is adapted from:
https://github.com/Microsoft/LightGBM/blob/master/tests/python_package_test/test_sklearn.py
"""
import unittest
import lightgbm as lgb
from... |
#!/usr/bin/env python3
import mock
import pytest
from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport
@mock.patch("gql.transport.requests.RequestsHTTPTransport.execute")
def test_retries(execute_mock):
expected_retries = 3
execute_mock.side_effect = Exception("fail")
clie... |
import heterocl as hcl
import numpy as np
def test_partition_before_streaming():
hcl.init()
A = hcl.placeholder((10, 10), "A", dtype=hcl.UInt(8))
def kernel(A):
B = hcl.compute(A.shape, lambda *args : A[args] + 1, "B", dtype=hcl.UInt(8))
return B
target = hcl.platform.zc706
s = hcl... |
import numpy as np
import pandas as pd
import os
LOCAL_PATH = os.getcwd()
SIMULATIONS_PATH = '../../simulations'
LOG_PATH = '../../log'
FIG_PATH = '../../fig'
os.makedirs(SIMULATIONS_PATH, exist_ok=True)
os.makedirs(LOG_PATH, exist_ok=True)
os.makedirs(FIG_PATH, exist_ok=True)
parameters = {}
default_params = {
'... |
"""
tests.unit.test_virtualname
~~~~~~~~~~~~~~~~~~~~
"""
import importlib.util
import logging
import os
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase
log = logging.getLogger(__name__)
class FakeEntry:
def __init__(self, name, path, is_file=True):
self.n... |
from .action_v1 import (
check_parse_error,
check_str_enum,
convert_date,
convert_enum_str,
convert_str_enum,
)
from .helpers import STR2PY, PY2STR, INSP_STR, issub_safe
from datetime import date
from enum import Enum
from functools import partial
"""
As JSON requires string keys, unless dicts ar... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... |
"""
This module handles initial database propagation, which is only run the first
time the game starts. It will create some default channels, objects, and
other things.
Everything starts at handle_setup()
"""
import django
from django.conf import settings
from django.contrib.auth import get_user_model
from src.server... |
#!/usr/bin/env python
import sys, os, re
try:
import chardet
except ImportError:
print "You need universal encoding detector for this script"
print " http://chardet.feedparser.org or apt-get install python-chardet"
sys.exit()
regexp_language = re.compile("\* +(.+) +translation", re.IGNORECASE)
js_tem... |
from binance_f import RequestClient
from binance_f.constant.test import *
from binance_f.base.printobject import *
from binance_f.model.constant import *
request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key)
result = request_client.get_order(symbol="BTCUSDT", orderId=534333508)
# PrintBasic.print_... |
#!/usr/bin/env python3
"""Base58 encoding
Implementation of Base58 and Base58Check, originally from
https://github.com/keis/base58, with the following modifications:
- type annotated python3
- using native python3 int.from_bytes() and i.to_bytes()
- added length check functionalities to decode and deco... |
# -- 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
# "Li... |
#!/usr/bin/env python
# Copyright 2021 Spanish National Research Council (CSIC)
#
# 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 re... |
#!/usr/bin/env python
import os, sys
BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tests')
sys.path.insert(0, BASE_DIR)
try:
from django.conf import settings
from django.core.management import call_command
from django.test.utils import get_runner
except ImportError:
import trac... |
# -*- coding: utf-8 -*-
# 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... |
"""Transform a roidb into a trainable roidb by adding a bunch of metadata."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datasets
import numpy as np
from model.utils.config import cfg
from datasets.factory import get_imdb
import PIL
def prepare... |
%matplotlib notebook
import time
import numpy as np
from matplotlib import pyplot as plt
from reachy import Reachy, parts
#Change this for USB port
reachy = Reachy(
#right_arm=parts.RightArm(io='/dev/ttyUSB*', hand='force_gripper'),
right_arm=parts.RightArm(io='ws', hand='force_gripper'),
)
for m in reachy... |
from rest_framework import serializers
from goods.models import SPUSpecification
class SpecModelSerializer(serializers.ModelSerializer):
spu = serializers.StringRelatedField()
spu_id = serializers.IntegerField()
class Meta:
model = SPUSpecification
fields = ['id', 'name', 'spu', 'spu_id... |
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from test.lib.testing import eq_, AssertsExecutionResults, assert_raises
from test.lib import testing
from test.lib import fixtures
from sqlalchemy.orm.attributes import instance_state
from sqlalchemy.orm.exc ... |
#array 2 dimensi
a = [
['linux', 'open source'],
['windows', 'licence'],
['mac', 'licence']
]
#untuk mengakses array 2 dimensi caranya adalah baris, kolom
#untuk linux, windows, mac itu adalah kolom
#untuk linux, open source itu adalah kolom
print(a[0][0])#akan menghasilkan linux
print(a[... |
import numpy as np
from numpy.typing import ArrayLike
from numpy.random import choice
import numba
@numba.njit(fastmath=True)
def isin(val, arr):
for i in range(arr.shape[0]):
if arr[i] == val:
return True
return False
@numba.njit
def tournament(fitness_array:ArrayLike, n_selection:int) ->... |
import re
import html
import logging
import pandas as pd
import os
import random
import torch
from pathlib import Path
import pickle
import shutil
import itertools
import more_itertools
from sklearn.model_selection import train_test_split
from torch.utils.data import (
TensorDataset,
DataLoader,
RandomSam... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
from json import dumps
import smartpy as sp
FA2 = sp.io.import_script_from_url("https://smartpy.io/dev/templates/FA2.py")
class FundingCerti(FA2.FA2):
def __init__(self, config, metadata, admin):
if config.assume_consecutive_token_ids:
self.all_tokens.doc = """
This view is specif... |
import random
import os
import tarfile
from time import time
from IPython.display import set_matplotlib_formats
from matplotlib import pyplot as plt
import mxnet as mx
from mxnet import autograd, gluon, image, nd
from mxnet.gluon import nn, data as gdata, loss as gloss, utils as gutils
import numpy as np
# Set defau... |
$NetBSD: patch-setup.py,v 1.1 2019/06/17 15:01:45 adam Exp $
Enable 'test' command.
--- setup.py.orig 2019-06-17 08:28:08.000000000 +0000
+++ setup.py
@@ -65,6 +65,7 @@ SETUPTOOLS_COMMANDS = {
'bdist_wininst', 'install_egg_info', 'build_sphinx',
'egg_info', 'easy_install', 'upload', 'bdist_wheel',
'--s... |
# Generated by Django 4.0 on 2022-03-13 19:26
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('paginas', '0010_remove_publicacao_descricao_remove_publicacao_hora_and_more'),
]
operati... |
import torch
import torch.nn as nn
import torch.optim as optim
from a2c_ppo_acktr.algo.kfac import KFACOptimizer
class A2C_ACKTR():
def __init__(self,
actor_critic,
value_loss_coef,
entropy_coef,
lr=None,
eps=None,
... |
import abc
import logging
from collections import defaultdict
from typing import Any, Dict, List, Optional, Set, Tuple, Union
import networkx
import openff.fragmenter
from openff.fragmenter.chemi import (
assign_elf10_am1_bond_orders,
extract_fragment,
find_ring_systems,
find_stereocenters,
)
from open... |
# Copyright 2015 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from parserator import data_prep_utils
from lxml import etree
import unittest
class Mock(object):
pass
class TestList2XML(unittest.TestCase):
def setUp(self):
mock_module = Mock()
mock_module.GROUP_LABEL = 'Collec... |
import json
from copy import deepcopy
import pytest
from json_graph_lite.jgf import Graph
from json_graph_lite.jgf import Graphs
GRAPH1 = {
'directed': True,
'edges': [{
'directed': True,
'metadata': {'w': 3},
'relation': 'edge AB',
'source': 'a',
'target': 'b'}],
... |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Classes to connect a plugin to the shell widgets in the IPython console.
"""
|
import pickle
# import dill
from .decorators import cache
@cache
def unpickle(fpath):
"""Unpickle path (but only if it's not done yet)."""
with open(fpath, 'rb') as f:
return pickle.load(f)
# @cache
# def undill(fpath):
# """Undill path (but only if it's not done yet)."""
# with open(fpath,... |
import asyncio
from aiogram import Bot, Dispatcher, executor
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from config import BOT_TOKEN
loop = asyncio.get_event_loop()
bot = Bot(BOT_TOKEN, parse_mode="HTML")
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage, loop=loop)
if __name__ == '__m... |
import numpy as np
from share import *
def xor_data(num_points):
X_xor = np.random.randn(num_points, 2)
y_xor = np.logical_xor(X_xor[:, 0] > 0, X_xor[:, 1] > 0)
y_xor = np.where(y_xor, 1, -1)
return X_xor, y_xor
def circle_data(num_points, radius):
X = np.random.randn(num_points, 2)
y = X[... |
# Generated by Django 2.2.13 on 2020-11-10 16:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('majora2', '0133_auto_20201105_1507'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='revoked_r... |
from tests.fixtures import *
import torch.nn as nn
from numpy.testing import assert_array_equal
# class TestAtomisticModel:
# def test_model_types(self, atomistic_model):
# assert type(atomistic_model.output_modules) == nn.ModuleList
#
# def test_forward_pass(self, atomistic_model, dataloader, result_sha... |
'''
Purpose: Generate train and test data files for the VAR model.
'''
import pandas as pd
import numpy as np
# Open full dataset with shape (510, 448, 304, 10) corresponding to (months, height, width, # of predictors).
with open("/umbc/xfs1/cybertrn/reu2021/team1/research/preprocessing/whole_data.npy", "rb") as f:
w... |
#
# Copyright 2017 the original author or 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... |
# -*- 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
#... |
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import ast
import logging
import optparse
import re
import sys
from collections import Counter
from collections.abc import Container, Iterable, Iterator, Sequence
from contextlib import contextmanager
from copy import deepcopy
from dataclasses i... |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/L... |
import random
import socket
import threading
import unittest
import telethon.network.authenticator as authenticator
from telethon.extensions import TcpClient
from telethon.network import Connection
def run_server_echo_thread(port):
def server_thread():
with socket.socket(socket.AF_INET, socket.SOCK_STREA... |
import datetime
import re
import time
from functools import partialmethod
import jdatetime
from django.core import exceptions
from django.db import models
from django.conf import settings
import warnings
from django.utils import timezone
from django.utils.encoding import smart_str, smart_text
from django.utils.transla... |
import logging
import click
import click_log
import pandas as pd
from linkml_runtime.utils.schemaview import SchemaView
from sheets_and_friends.converters.linkml2dataharmonizer import (
LinkML2DataHarmonizer,
# ValidationConverter,
)
from sheets_and_friends.converters.sheet2linkml import Sheet2LinkML
import ... |
# -*- coding: utf-8 -*-
from unittest.mock import MagicMock, patch
from chaosgcp.gke.nodepool.actions import create_new_nodepool, delete_nodepool, \
swap_nodepool
import fixtures
@patch('chaosgcp.gke.nodepool.actions.wait_on_operation', autospec=False)
@patch('chaosgcp.build', autospec=True)
@patch('chaosgcp.Cr... |
import os, sys, operator
from step3fcn import *
# must rpovide the dict file and the project name
dictfile = sys.argv[1]
proj = sys.argv[2]
ppath = "../../proj/"+proj+"/"
ptKey = "../../proj/"+proj+"/ptselection/ptkey.txt"
noteMdata = "../../res/corpus/testnotemdata.txt"
# target classes #
target_class = ["mbc","dre... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Package setup."""
import os
from codecs import open
from setuptools import setup
from setuptools import find_packages
here = os.path.abspath(os.path.dirname(__file__))
version_path = os.path.join(here, "tantrum", "version.py")
about = {}
with open(version_path, "r",... |
# Copyright 2014 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 recipe_engine.types import freeze
DEPS = [
'depot_tools/git',
'recipe_engine/json',
'recipe_engine/path',
'perf_dashboard',
'recipe... |
"""Runs inference on the model that was build by reconstruct_mind.py."""
import random
from ai_replica.utils.files import read_json
from ai_replica.utils.nlp import get_bag_of_words, similarity_score_of_word_bags
def load_model(load_path):
"""
>>> res0 = load_model("ai_replica/resources/mock_data/mock_person... |
from flask_mail import Message
from flask import render_template
from . import mail
def welcome_message(subject,template,to,**kwargs):
sender_email = "stephenremmi21@gmail.com"
email = Message(subject, sender=sender_email, recipients=[to])
email.body = render_template(template + ".txt",**kwargs)
email... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-26 14:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0015_auto_20170326_1250'),
]
operations = [
migrations.AlterField(... |
"""
This file offers the methods to automatically retrieve the graph Methanobrevibacter gottschalkii.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein... |
# -*- coding:utf-8 -*-
"""
feature factory web application api route
"""
from django.conf.urls import patterns, url
from apps.interface.views.featureconfig import *
# from apps.interface.views.featureprocess import *
urlpatterns = patterns(
'',
url(r'^common_conf/show/(?P<featurename>\w+)/(?P<page>\d+)/... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : No2MaxWater.py
@Time : 2021/02/04 20:59:23
@Author : kangqing
@Contact : kangqing.37@gmail.com
@Software: VS Code
@Desc : 盛最多水的容器,双指针
'''
from typing import List
# here put the import lib
class Solution:
def maxArea(self, height: Lis... |
from rsp1570serial.commands import encode_command, encode_volume_direct_command
import unittest
class RotelTestCommands(unittest.TestCase):
def test_encode_power_toggle(self):
self.assertEqual(encode_command("POWER_TOGGLE"), b"\xfe\x03\xa3\x10\x0a\xc0")
def test_encode_mute_toggle(self):
self... |
def mystery():
num = 10 * 3
if num == 10:
print("Condition 10")
num = num * 10
elif num == 30:
print("Condition 30")
num = num * 30
print(f'num was {num}')
return num
print(mystery())
|
#!/usr/bin/python
# Copyright (c) 2014 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.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the following... |
from gears import Gear
import os
OUTPUT_DIR = 'output'
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
gList = range(3,200+1) + range(220,500+10,10) + range(550,1050,50)
for i in gList:
try:
print "Generating %i tooth gear..." % i
g = Gear(numTeeth = i)
fname = './output/gear%i.dxf' % i
g.ren... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from django.contrib import admin
from .models import *
from translations.admin import TranslatableAdmin, TranslationInline
admin.site.register(Numero)
admin.site.register(Aliado)
admin.site.register(Programa)
admin.site.register(Promocion)
admin.site.register(Alumni)
admin.site.register(Prensa)
admin.sit... |
import logging
import numpy
import pytest
from allennlp.common.checks import ConfigurationError
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data.fields import MultiLabelField
from allennlp.data.vocabulary import Vocabulary
class TestMultiLabelField(AllenNlpTestCase):
def test_as_tensor_re... |
# -*- coding: utf-8 -*-
# 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... |
from unittest import mock
import pytest
from laim import Laim
from laim.laim import TaskArguments
pytestmark = pytest.mark.integration
def test_handler(temp_config):
class Handler(Laim):
def handle_message(self, sender, recipients, message):
self.stop()
with mock.patch('laim.laim.drop_... |
import sys
import numpy as np
import matplotlib.pyplot as plt
sys.path.append("..")
from utils import *
from linear_regression import *
from svm import *
from softmax import *
from features import *
from kernel import *
#######################################################################
# 1. Introduction
#########... |
__all__ = ["normal_platform"]
|
from .integration import *
from .integration_account import *
from .integration_application import *
from .integration_detail import *
from .utils import *
__all__ = (
*integration.__all__,
*integration_account.__all__,
*integration_application.__all__,
*integration_detail.__all__,
*utils.__all__,
... |
""" __init__ """
from .legal_entity_name_generator2 import LegalEntityNameGenerator2
from .lei_generator import LeiGenerator
from .sic_range_generator import SicRangeGenerator
from .sic_code_generator import SicCodeGenerator
from .country_code_generator import CountryCodeGenerator
from .fund_name_generator import FundN... |
# 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.
{
'includes': [
'audio_receiver/audio_receiver.gypi',
'video_receiver/video_receiver.gypi',
],
'targets': [
{
'target_name': 'cast_... |
"""
next dashboard.py
author: Lalit Jain, lalitkumarj@gmail.com
last updated: 9/16/15
Flask controller for dashboards.
"""
import os
import json
import yaml
from flask import Blueprint, render_template, url_for, request, jsonify
from jinja2 import Environment, PackageLoader, ChoiceLoader
import requests
import next.b... |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.common.exceptions import WebDriverException
from selenium import webdriver
import os
import time
from datetime import date
MAX_WAIT = 20
def wait(fn):
def modified_fn(*args, **kwargs):
start_time = time.time()
w... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... |
"""Primitive dict ops."""
from mypyc.ir.ops import ERR_FALSE, ERR_MAGIC, ERR_NEVER, ERR_NEG_INT
from mypyc.ir.rtypes import (
dict_rprimitive, object_rprimitive, bool_rprimitive, int_rprimitive,
list_rprimitive, dict_next_rtuple_single, dict_next_rtuple_pair, c_pyssize_t_rprimitive,
c_int_rprimitive
)
fro... |
#!/idgo_venv/bin/python3
# Copyright (c) 2017-2019 Neogeo-Technologies.
# 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... |
#!/usr/bin/env python2
#encoding: UTF-8
import json
import sys;sys.path.append('./')
import zipfile
import re
import sys
import os
import codecs
import traceback
import numpy as np
def order_points_clockwise(pts):
rect = np.zeros((4, 2), dtype="float32")
s = pts.sum(axis=1)
rect[0] = pts[np.argmin(s)]
... |
# coding=utf-8
"""Try to access the parameters page. feature tests."""
from functools import partial
from pytest_bdd import (
given,
scenario,
then,
when,
)
from pbraiders.pages.options.parameters import ParametersPage # pylint: disable=import-error
from pbraiders.pages.options.parameters.actions impo... |
# coding=utf-8
import random
import re
import requests
from .base import Music
from .exception import MusicDoesnotExists
from mozart import config
__all__ = ["QQ"]
def get_guid():
return str(random.randrange(1000000000, 10000000000))
def operate_vkey(guid):
"""计算vkey"""
params = {"guid": guid, "format"... |
import cx_Oracle
import pandas as pd
import numpy as np
import calendar
import datetime
#==================================================================================================================
def add_months(sourcedate, months):
"""Función que permite sumar o restar 'months' meses a una fecha 'sou... |
"""
Author: Dustin Hines
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
This module implements 3 classes:
1. Narrator -
the entity that maintains the story knowledge such as setting and
characters and keeps track of other meta data as the narrati... |
x = [True, 1, 1.0, [True], (1,), dict(a = 1)]
print all([])
print all(x)
print all(x + [0])
try:
print all()
except TypeError, E:
print "Fail", E
|
# dataset settings
dataset_type = 'MGSDataset'
data_root = 'data/mgs'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (512, 512)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', reduce_zero_label=False),
dict(type=... |
# -*- coding: utf-8 -*-
# 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 o... |
#!/usr/bin/env python2
import numpy as np
class Network(object):
def __init__(self, sizes):
"""The list ``sizes`` contains the number of neurons in the
respective layers of the network. For example, if the list
was [2, 3, 1] then it would be a three-layer network, with the
first l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.