text stringlengths 2 999k |
|---|
"""DAgger (https://arxiv.org/pdf/1011.0686.pdf).
Interactively trains policy by collecting some demonstrations, doing BC, collecting more
demonstrations, doing BC again, etc. Initially the demonstrations just come from the
expert's policy; over time, they shift to be drawn more and more from the imitator's
policy.
"""... |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# 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... |
import datetime
import pytest
from responses import RequestsMock
from tests import loader
@pytest.fixture
def output_order_service(responses: RequestsMock):
responses.add(
responses.GET,
url="http://localhost:8946/",
json={
"swagger": "2.0",
"definitions": {
... |
from graph import RandomGraph
from graph_functions import BFS
from graph_functions import DFS_recursive
from graph_functions import DFS_iterative
import sys
G = RandomGraph( n_vertex=10, unconnected_probability=3 )
G.show_adj_matrix()
sys.stdout.flush()
print("\nObtaining random source S")
s = G.get_random_source_S()... |
import unittest
import numpy as np
import numpy.testing as npt
import scipy.sparse as _spsparse
from sparse_mkl import dot_product_mkl
from sparse_mkl._mkl_interface import _create_mkl_sparse, _export_mkl, sparse_matrix_t, set_debug_mode
from sparse_mkl._sparse_sparse import _matmul_mkl
from sparse_mkl.tests.test_mkl i... |
from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Article
class ArticleSerializer(serializers.ModelSerializer):
class Meta:
model = Article
fields = ('title', 'text', 'author','pk')
class UserSerializer(serializers.ModelSerializer):
class ... |
import sys
import TestInstance
from TestInstance import test_assert
def test(instance):
test_assert("Kernel image start timed out", instance.wait_for_line("OK43e6H", timeout=10))
instance.match_line(
"Init load timed out",
"Entering userland at 0x[0-9a-f]+ '([^']+)' '([^']+)'",
['/sysro... |
class FailureDefinition(object,IDisposable):
""" Defines persistent information about a failure. """
def AddResolutionType(self,type,caption,classOfResolution):
"""
AddResolutionType(self: FailureDefinition,type: FailureResolutionType,caption: str,classOfResolution: Type) -> FailureDefinition
Adds a... |
import GAN_Toy.tflib as lib
import numpy as np
import tensorflow as tf
_default_weightnorm = False
def enable_default_weightnorm():
global _default_weightnorm
_default_weightnorm = True
_weights_stdev = None
def set_weights_stdev(weights_stdev):
global _weights_stdev
_weights_stdev = weights_stdev
d... |
# Copyright DataStax, 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, softwa... |
#!/usr/bin/python -tt
# Project: pyats
from __future__ import absolute_import, division, print_function
__author__ = "hikarikumo"
__version__ = ": 1.0 $"
__date__ = "2022.03.04"
__copyright__ = "Copyright (c) 2022 hikarikumo"
__license__ = "Python"
from genie.testbed import load
import json
import os
import re
from... |
"""first migration.
Revision ID: 662295ac0be8
Revises:
Create Date: 2019-12-13 09:58:06.283741
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '662295ac0be8'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto g... |
# This sample tests the reportUnusedCoroutine diagnostic rule.
async def func1():
return 3
async def func2() -> str:
return "5"
async def func3():
await func1()
await func2()
# This should generate an error
func1()
# This should generate an error
func2()
... |
# BitBake Persistent Data Store
#
# Copyright (C) 2007 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will ... |
from ledfx.effects.audio import AudioReactiveEffect
from ledfx.effects.gradient import GradientEffect
import voluptuous as vol
import numpy as np
class WavelengthAudioEffect(AudioReactiveEffect, GradientEffect):
NAME = "Wavelength"
# There is no additional configuration here, but override the blur
# def... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
"""
Test basic std::vector<bool> functionality.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestBoolVector(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["libc++"])
@skipIf(compiler=no_match("clan... |
from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
import math
# Create your models here.
class Sezione(models.Model):
"""
le sezioni dividono il sito per categorie di discussione
ciascuna sezione contiene svariate Discussioni
create dagli amminis... |
import typing
import attr
import qts.util
@attr.mutable
class Execable:
call_count: int = 0
def exec(self) -> int:
self.call_count += 1
return 0
exec_ = exec
def test_exec() -> None:
execable = Execable()
assert execable.call_count == 0
qts.util.exec(execable=execable)
... |
from azureml.core import Run
input_file_ds_path = Run.get_context().input_datasets["file_dataset"]
with open(input_file_ds_path, "r") as f:
content = f.read()
print(content)
input_tabular_ds = Run.get_context().input_datasets["tabular_dataset"]
tabular_df = input_tabular_ds.to_pandas_dataframe()
prin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pymt_rafem documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... |
"""
@ Filename: TreeRegression.py
@ Author: Diogo Ribeiro
@ Create Date: 2019-05-11
@ Update Date: 2019-05-13
@ Description: Implement TreeRegression
"""
import numpy as np
import operator as op
import preProcess
import math
import pickle
class treeNode():
def __init__(self, index=-1, value... |
"""
Data structures for Enzo
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 12:45:07 2020
@author: mohsi
"""
# The idea is to read text file, recontextualize it and then save it as a json/
import json
with open('2019.json', 'r') as f:
plleague = json.load(f)
match_details_obj = plleague['data']
match_less={"matches":[]}
"""
[Type Di... |
import datetime as dt
import re
import string
import uuid
from contextlib import suppress
from urllib.parse import urlparse
import pytz
from django.db import models
from django.utils.functional import cached_property
from django_scopes import ScopedManager
from i18nfield.fields import I18nCharField
from pretalx.commo... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
from astropy.units import Quantity
from astropy.wcs import WCS
from ...utils.testing import requires_dependency, requires_data
from... |
# -*- coding: utf-8 -*-
'''Test requests' interaction with vcr'''
import pytest
import vcr
from assertions import assert_cassette_empty, assert_is_json
requests = pytest.importorskip("requests")
@pytest.fixture(params=["https", "http"])
def scheme(request):
'''Fixture that returns both http and https.'''
r... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Opensource Solutions Philippines and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ContainerType(Document):
pass
|
# coding: utf-8
import sys
from setuptools import setup, find_packages
NAME = "swagger_server"
VERSION = "1.0.0"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
REQUIRES = ["connexion"]
setup(
name=NAME,
version=V... |
#!/usr/bin/python
from sqlalchemy import create_engine, MetaData, exists
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import os
"""Initialize database"""
_path = os.path.dirname(os.path.abspath(__file__))
with open(_path + "/user.txt", "r") as user:
... |
#importing the Kratos Library
from Kratos import *
from KratosULFApplication import *
class ULFStrategyPython:
#######################################################################
def __init__(self,model_part,time_scheme,linear_solver,convergence_criteria,CalculateReactionsFlag,ReformDofSetAtEachStep,MoveMe... |
# qubit number=2
# total number=12
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from ... |
#!/usr/bin/python3
import numpy as np
import rospy
from votenet_catkin.srv import VotenetResponse, Votenet
from ros_numpy.point_cloud2 import pointcloud2_to_array, array_to_pointcloud2
from demo import point_cloud_to_detections
def votenet_callback(req):
points = pointcloud2_to_array(req.pc)
result_points, ... |
class MyTBError(Exception):
""" custom exception """
|
import praw, argparse, sys, json, re, os, time, traceback
from peewee import *
from logins import *
from var_dicts import *
user_agent = "StunfiskHelperBot v0.1.1 by /u/0ffkilter"
reddit = praw.Reddit(user_agent=user_agent)
reddit.login(bot_name, bot_password)
c_db = MySQLDatabase(database='stunbot', host='localhos... |
# -*- coding: utf-8 -*-
"""
mslib.msui.kmloverlay_dockwidget
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Control widget to configure kml overlays.
This file is part of mss.
:copyright: Copyright 2017 Joern Ungermann
:copyright: Copyright 2017-2021 by the mss team, see AUTHORS.
:license: APACHE-2.0,... |
__author__ = 'ipetrash'
"""Скрипт скачивает базу доменов в зоне ru и выводит ее в лог"""
if __name__ == '__main__':
from urllib.request import urlretrieve
from os.path import basename
url = 'https://partner.r01.ru/zones/ru_domains.gz'
file_name = basename(url)
# Скачиваем архив
urlretrieve(... |
from . import models
from rest_framework import serializers
class SesionSerializer(serializers.ModelSerializer):
class Meta:
model = models.Sesion
fields = (
'slug',
'nombre',
'created',
'last_updated',
'puntos',
'veloc... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 01 11:43:11 2013
@author: Martin Siggel <martin.siggel@dlr.de>
"""
class GeneratorException(Exception):
def __init__(self, errormsg, arg):
msg = errormsg + '\n'
msg += 'Argument was:\n'
msg += ' type : ' + arg.type + '\n'
ms... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the plusMinus function below.
def plusMinus(arr, precision='{:.6f}'):
negative, positive, zero = 0, 0, 0
for item in arr:
if item < 0:
negative += 1
elif item > 0:
positive += 1
e... |
from typing import Dict
from pydantic import BaseModel, Field
class DecomposedEnergy(BaseModel):
"""A class which stores the contribution of each SMIRNOFF parameter to the total
potential energy of a system."""
valence_energies: Dict[str, Dict[str, float]] = Field(
...,
description="The ... |
import os
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
import glob
import numpy as np
import torch
import yaml
import trimesh
import numbers
import pickle as pkl
from torch.utils import data
from scipy.spatial import cKDTree as KDTree
from scipy.spatial.transform import Rotation as R
# from human_body_prior.mesh impor... |
from ops import *
from utils import *
from glob import glob
import time
from tensorflow.contrib.data import prefetch_to_device, shuffle_and_repeat, map_and_batch
import numpy as np
class UGATIT(object) :
def __init__(self, sess, args):
self.light = args.light
if self.light :
... |
"""The WaveBlocks Project
This file contains some global defaults
all related to advanced plotting.
@author: R. Bourquin
@copyright: Copyright (C) 2010, 2011 R. Bourquin
@license: Modified BSD License
"""
import itertools
import matplotlib.pyplot
# Possible line colors, styles and markers
styles = ['--', ':', '-.',... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... |
# Originally created By KingMars ✅ Rain Sequence 2 {Updated}
import asyncio
from collections import deque
from telethon import events
@borg.on(events.NewMessage(pattern=r"\.km_rain2", outgoing=True))
async def _(event):
if event.fwd_from:
return
deq = deque(list("☁️⛈Ř/~\İŇ🌬⚡🌪"))
for _ in range(... |
# Copyright (c) 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, so... |
# coding:utf-8
import random
import torch
from torch.utils.data import Dataset
from torch.utils.data import sampler
import torchvision.transforms as transforms
import lmdb
import six
import sys
from PIL import Image
import numpy as np
import pdb
import os
import cv2
from abfn import abfn
class lmdbDataset(Dataset):
... |
"""Denon Zones"""
from .zone import Zone |
import asyncio
import contextvars
import functools
import io
import os
import queue
import socket
import traceback
import warnings
from array import array
from collections import deque
from time import sleep
import pytest
from tornado.ioloop import IOLoop
import dask
from distributed.compatibility import MACOS, WIND... |
import os
from flask import Flask, render_template, request, session, g, redirect
from magicsquare import app
import sqlite3
from contextlib import ExitStack
from pathlib import Path
from cqc.pythonLib import CQCConnection, qubit
from libmagicsquare import MagicSquare
import sqlite3
DB_FILE=os.environ.get("MAGICSQUAR... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'spartan/ui/ui_prefwindow.ui',
# licensing of 'spartan/ui/ui_prefwindow.ui' applies.
#
# Created: Tue Nov 5 19:32:03 2019
# by: pyside2-uic running on PySide2 5.13.0a1.dev1556284177
#
# WARNING! All changes made in this file will be lo... |
from django.contrib import admin
from .models import OrderModel, MenuItem, Category
class OrderAdmin(admin.ModelAdmin):
list_display = ['name', 'is_paid']
admin.site.register(OrderModel, OrderAdmin)
admin.site.register(MenuItem)
admin.site.register(Category)
|
# Copyright 2020. ThingsBoard
#
# 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 ... |
"""
Template for google drive operations like upload, download, search for files
"""
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from datetime import datetime
gauth = GoogleAuth()
gauth.LoadCredentialsFile("credentials.txt")
drive = GoogleDrive(gauth)
def list_files():
... |
from recipes.services.add_to_favorites_and_shopping_cart import (
AddToFavorites,
AddToShoppingCart,
)
from recipes.services.delete_from_favorites_and_shopping_cart import (
DeleteFromFavorites,
DeleteFromShoppingCart,
)
from recipes.services.recipe_creator_updater import (
RecipeCreator,
Recipe... |
from snovault import (
calculated_property,
collection,
load_schema,
)
from .base import (
SharedItem,
paths_filtered_by_status,
)
@collection(
name='genes',
unique_key='gene:geneid',
properties={
'title': 'Genes',
'description': 'Listing of genes',
})
class Gene(Sh... |
import pytest
from warhound import match_round
def test_mk_round_event(mocker):
round_event = match_round.mk_round_event()
assert type(round_event) is match_round.RoundEvent
def test_mk_death_event(mocker):
death_event = match_round.mk_death_event()
assert type(death_event) is match_round.DeathEv... |
from backend.app import db
from datetime import datetime
class User(db.Model):
__tablename__ = 'users'
user_id = db.Column(db.String(32), primary_key=True)
email = db.Column(db.String(80), unique=True, nullable=False)
name = db.Column(db.String(50), nullable=False)
password = db.Column(db.String(... |
# Generated by Django 2.0.3 on 2018-03-11 21:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('game', '0002_auto_20180311_2050'),
]
operations = [
migrations.AlterModelOptions(
name='game',
options={'permissions': (('st... |
###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... |
import numpy
import os
import inspect
import algo_test
from algo_test.solutions import exhaustive_solution, target_solution
def check_solution(testset_path):
print "- Checking", testset_path
A_npy = numpy.load(testset_path)
ok_guys = 0
ko_guys = 0
for i in range(len(A_npy)):
A = list(A_npy... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function, division, absolute_import
import numpy as np
import pytest
from .. import fetch, fetch_sci, fetch_eng
fetch_cxc = fetch
date1 = '2016:001:00:00:00.1'
date2 = '2016:001:00:00:02.0'
date3 = '2016:001:00:00:05.0'
da... |
# coding:utf-8
# 层次式encoder + SRL attention
# 同时预测sent分数和event分数
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
use_cuda = torch.cuda.is_available()
class Model3(nn.Module):
def __init__(self, args, embed=None):
super(Model3, self).__init__()
self.model_na... |
# -*- coding: utf-8 -*-
# (C) 2013-2018,2020 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
import unittest
from opentamiltests import *
from tamil.utf8 import get_letters
from transliterate import azhagi, jaffna, combinational, UOM, ISO, itrans, algorithm
class ReverseTran... |
"""
Yelp API v2.0 code sample.
This program demonstrates the capability of the Yelp API version 2.0
by using the Search API to query for businesses by a search term and location,
and the Business API to query additional information about the top result
from the search query.
Please refer to http://www.yelp.com/devel... |
#!/usr/bin/env python
import random
import pytest
import networkx as nx
from networkx.testing.utils import *
class TestFunction(object):
def setup_method(self):
self.G = nx.Graph({0: [1, 2, 3], 1: [1, 2, 0], 4: []}, name='Test')
self.Gdegree = {0: 3, 1: 2, 2: 2, 3: 1, 4: 0}
self.Gnodes = l... |
# model settings
temperature = 0.2
with_norm = True
query_dim = 128
model = dict(
type='SimSiamBaseSTSNTracker',
backbone=dict(
type='ResNet',
pretrained=None,
depth=18,
out_indices=(3, ),
# strides=(1, 2, 1, 1),
norm_cfg=dict(type='SyncBN', requires_grad=True),
... |
import os
from os import close
from tkinter import *
from tkinter import ttk
from tkinter import scrolledtext
import tkinter
from tkinter.font import BOLD
from tkinter.scrolledtext import ScrolledText
from tkinter.messagebox import showinfo
from typing import Iterable, Tuple
import pandas as pd
import PIL... |
#! /usr/bin/env python3
# Copyright (c) 2020, FADA-CATEC
# 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... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 'his script performs the Kolmogorov-Smirnov test for invariance on the
# parameter increments of SVI model.
# -
# ## For details, see [here](https://www.arpm.co/lab/redirect.php?permalink=exer-sviiid-copy-1).
# +
# ## Prepare the environment
# +
import os
import os.pa... |
__all__ = ['regular_cube_complex']
from scipy import rank,ones
import scipy
from pydec.mesh import regular_cube_mesh
from cube_array import cube_array_boundary
class regular_cube_complex(list):
"""
Represents the complex for a regular_cube_mesh
"""
class complex_data:
pass
def __init__(s... |
import os
import re
import sys
def main(path):
forced = {}
res = []
if os.path.isfile(path):
with open(path, "r") as f:
lines = [x.strip() for x in f.readlines()]
for line in lines:
name = ""
for letter in line:
if letter not in ("~", "="... |
# -*- coding: utf-8 -*-
# Scrapy settings for domain project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics... |
from .get_models import get_losses_with_opts, get_model_with_opts
from .losses.depthhints_loss import DepthHints_PhotoLoss
from .losses.epcdepth_loss import EPCDepth_PhotoLoss
from .losses.md2_photo_loss import MD2_PhotoLoss
from .losses.photo_loss import PhotoLoss
from .losses.smooth_loss import SmoothLoss
from .netwo... |
"""
Amatino API Python Bindings
Url Target Module
Author: hugh@amatino.io
"""
from typing import Type
from typing import TypeVar
from typing import List
T = TypeVar('T', bound='UrlTarget')
class UrlTarget:
"""Internal class handling individual url parameter components"""
def __init__(self, key: str, value: ... |
# model definition (canonical way)
import tensorflow as tf
class LogisticRegression(tf.keras.Model):
def __init__(self, num_classes):
super(LogisticRegression, self).__init__()
self.dense = tf.keras.layers.Dense(num_classes)
def call(self, inputs, training=None, mask=None):
output = se... |
MIT License
Copyright (c) 2017, XIO. https://github.com/Brandon-T/PyWallet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, cop... |
from typing import Any, Dict, List, Optional
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from acl.models import ACLBase
from airone.lib.acl import ACLType, ACLObjType
from entity.models import EntityAttr, Entity
from entry.models import Attribute, Entry
from group.model... |
import asyncio
from datetime import datetime
import inspect
import sys
import os
import json
import time
import csv
import decimal
from decimal import Decimal
from typing import Sequence, Optional
from aiorpcx.curio import timeout_after, TaskTimeout, TaskGroup
from . import util
from .bitcoin import COIN
from .i18n i... |
from framework.Classes import Testcase
tc1 = Testcase()
tc1.id = "1"
tc1.input = '23\n34'
tc1.timeout = 1
tc2 = Testcase()
tc2.id = "2"
tc2.input = """21 34"""
tc2.timeout = 1
java_source_code_with_input = """
import java.util.*;
class Solution{
p... |
from .helpers import report_model
from .options import args
from .trainer import Trainer
trainer = Trainer()
if args.validation_only or args.images:
if args.load_pretrained is None and args.load_checkpoint is None and not args.download_pretrained:
raise ValueError("For validation, please use --load-pretr... |
from .auto_init import (
instantiate_from_cls_name,
instantiate,
get_w_prefix,
)
from .savenload import (
save_file,
load_file,
atomic_write,
finish_all_writes,
atomic_write_group,
)
from .config import Config
from .output import Output
from .modules import find_first_of_type
from .misc ... |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.3648
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getf... |
import unittest
import sys
import py65.devices.mpu65c02
from py65.tests.devices.test_mpu6502 import Common6502Tests
class MPUTests(unittest.TestCase, Common6502Tests):
"""CMOS 65C02 Tests"""
def test_repr(self):
mpu = self._make_mpu()
self.assertTrue('65C02' in repr(mpu))
# ADC Zero Page... |
import warnings
import SimpleITK as sitk
import numpy as np
from wsireg.reg_images import RegImage
from wsireg.utils.im_utils import (
std_prepro,
guess_rgb,
)
class NumpyRegImage(RegImage):
def __init__(
self,
image,
image_res,
mask=None,
pre_reg_transforms=None,
... |
import cv2
import numpy as np
# Load Image
img = cv2.imread("C:/Users/wogza/Downloads/New folder (2)/A/rectangle.png", 0)
# Find width and height of image
row = img.shape[0]
column = img.shape[1]
# Create an zeros array
image = np.zeros((row, column), dtype=np.uint8)
# min and max range
min_range = 70
max_range = 9... |
# -*- coding: utf-8 -*-
import json, os
from burney_data import BurneyDB
ARCHIVE = "/datastore/burneyjson"
AREASARCHIVE = "/datastore/burneyareas"
def papertopath(newspaper, year = None, month = None, day = None, archive = ARCHIVE):
if year == None:
return os.path.join(archive, newspaper)
elif day ==... |
import re
from datetime import date, datetime
from django.db import transaction
from django.db.models import Q
from django.conf import settings
from rest_framework import serializers
from bs4 import BeautifulSoup
from review.models import Pros, Cons, CompanyReview, Interview, ReviewComment, InterviewComment
from revi... |
# encoding: utf-8
"""
Test suite for opc.oxml module
"""
from docx.opc.constants import RELATIONSHIP_TARGET_MODE as RTM
from docx.opc.oxml import (
CT_Default, CT_Override, CT_Relationship, CT_Relationships, CT_Types
)
from docx.oxml.xmlchemy import serialize_for_reading
from .unitdata.rels import (
a_Defaul... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 08:50:53 2021
@author: Edson cilos
"""
#Standard Packages
import numpy as np
#Sklearn API
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import Rand... |
from __future__ import absolute_import
import os
import time
import pytest
import datarobot as dr
BASE_FIXTURE_DIR = "tests/fixtures"
ARTIFACT_DIR = "drop_in_model_artifacts"
CUSTOM_PREDICT_PY_PATH = os.path.join(BASE_FIXTURE_DIR, "custom.py")
CUSTOM_PREDICT_R_PATH = os.path.join(BASE_FIXTURE_DIR, "custom.R")
CUSTOM_... |
nums = [12,100,14,27,33]
for num in nums:
if num%5 == 0:
print(num)
break
else:
print("Not found")
|
from contextlib import suppress
from functools import partial
from distutils.version import LooseVersion
from .compression import compressions, default_compression
from .core import dumps, loads, maybe_compress, decompress, msgpack
from .cuda import cuda_serialize, cuda_deserialize
from .serialize import (
seriali... |
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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... |
#!/usr/bin/env python
def baits(path_to_file, created_baitset_id=None, build='GRCh37'):
"""Reads the bed-file and returns a list of dictionaries
Args:
path_to_file(): path tp temp file
Returns:
bait_dict_list(list): a list of dictionaries with the keys: chromosome, chr_start, chr_stop
... |
from setuptools import setup, Command
from setuptools.command.egg_info import egg_info
from subprocess import check_call
from distutils import log
import versioneer
import os
import sys
import platform
import json
here = os.path.dirname(os.path.abspath(__file__))
node_root = os.path.join(here, 'js')
is_repo = os.pat... |
# -*- coding: utf-8 -*-
import re
from datetime import datetime, time
from city_scrapers.constants import COMMISSION
from city_scrapers.spider import Spider
class ChiSsa14Spider(Spider):
name = 'chi_ssa_14'
agency_name = 'Chicago Special Service Area #14 Marquette Park'
timezone = 'America/Chicago'
a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.