text stringlengths 1 927k |
|---|
"""
Contains class that runs inferencing
"""
import torch
import numpy as np
from networks.RecursiveUNet import UNet
from utils.utils import med_reshape
class UNetInferenceAgent:
"""
Stores model and parameters and some methods to handle inferencing
"""
def __init__(self, parameter_file_path='', mode... |
import unittest
from passwords import Password
class TestAccount(unittest.TestCase):
def setUp(self):
"""
Set up method to run before each test cases
"""
self.new_password = Password("Instagram", "yahyanoor", "1234")
# The first test
def test_init(self):
... |
# coding=utf-8
r"""
Alphabet
AUTHORS:
- Franco Saliola (2008-12-17) : merged into sage
- Vincent Delecroix and Stepan Starosta (2012): remove classes for alphabet and
use other Sage classes otherwise (TotallyOrderFiniteSet, FiniteEnumeratedSet,
...). More shortcut to standard alphabets.
EXAMPLES::
sage: bui... |
from __future__ import print_function
from sys import argv
from pprint import pformat
from twisted.internet.task import react
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
def cbRequest(response):
print('Response version:', response.version)
print('Response code... |
""" Tests `core.framework` """
import pytest
from sap.cf_logging.core.context import Context
from sap.cf_logging.core.request_reader import RequestReader
from sap.cf_logging.core.response_reader import ResponseReader
from sap.cf_logging.core.framework import Framework
# pylint: disable=abstract-method
CONTEXT = Conte... |
# BOJ 2293
import sys
si = sys.stdin.readline
n, k = map(int, si().split())
coins = []
for _ in range(n):
coins.append(int(si()))
coins.sort()
def solve(n, k):
dp = [0] * (k + 1)
dp[0] = 1
for i in range(n):
for j in range(coins[i], k + 1):
if j - coins[i] >= 0:
... |
from .backbones import * # noqa: F401,F403
from .necks import * # noqa: F401,F403
from .roi_extractors import * # noqa: F401,F403
from .rroi_extractors import * # noqa: F401, F403
from .anchor_heads import * # noqa: F401,F403
from .shared_heads import * # noqa: F401,F403
from .bbox_heads import * # noqa: F401,F40... |
import numpy as np
import pandas as pd
from tqdm import tqdm
import os
import sys
import hashlib
def generateId(image_url, prefix, exisiting_ids):
id = f"{prefix}:{hashlib.md5(image_url.encode()).hexdigest()}"
# while id in exisiting_ids:
# print(f"id {id} exists!")
# image_url = image_url + "1... |
import unittest
from datetime import datetime, timedelta
from .EventBridgeClient import EventBridgeClient, date_of_requested_weekday_in_month
class ScheduleRuleTests(unittest.TestCase):
real_ingestion_rule = {
'Arn': 'arn:aws:events:eu-central-1:612888738066:rule/taiwan-taiwan-ingestor-prod',
'Des... |
from pprint import pprint
from django.http import QueryDict
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from django.urls import reverse_lazy
from django.views import generic
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators imp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework_jwt.settings import api_se... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Karsten Kaj Jakobsen <kj@patientsky.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
autho... |
from second.second import checkLinkedList, linked_list
import pytest
def test_1(list1):
actual = checkLinkedList(list1)
expected = False
assert actual == expected
def test_2(list2):
actual = checkLinkedList(list2)
expected = True
assert actual == expected
@pytest.fixture
def list1():
l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
#! /usr/bin/env python3
import sys
import click
from scipy.spatial.distance import pdist, squareform
from scipy.stats import gmean, entropy
from numpy.linalg import norm
import numpy as np
from math import sqrt
from json import dumps as jdumps
import pandas as pd
class LevelNotFoundException(Exception):
pass
... |
from datetime import timedelta
# Default process group wide timeout, if applicable.
# This only applies to the gloo and nccl backends
# (only if NCCL_BLOCKING_WAIT is set to 1). To make an attempt at
# backwards compatibility with THD, we use an extraordinarily high default
# timeout, given that THD did not have timeo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# connectivity.py
# definitions of connectivity characters
import math
import warnings
import networkx as nx
import numpy as np
from tqdm import tqdm
__all__ = [
"node_degree",
"meshedness",
"mean_node_dist",
"cds_length",
"mean_node_degree",
"pro... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module for Kafka information
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
from kafk... |
#
# yjDateTime.py, 200506
#
from ctypes import *
from modules.windows_jumplist.lib import Filetimes
import datetime
def filetime_to_datetime(filetime, inchour = 0):
''' v = filetime_to_datetime(ft, 9).isoformat() '''
if __debug__: assert type(filetime) is int
try:
return Filetimes.filetime_to_dt(filetime) + ... |
from actions.action import AbstractAction, CombinedAction, WrappedAction, SequenceAction
def COMBINE(*actions: list[AbstractAction]):
return CombinedAction(actions)
def WRAP(outer_action: AbstractAction, inner_action: AbstractAction):
return WrappedAction(outer_action, inner_action)
def SEQUENCE(*actions: l... |
# Copyright (c) 2022 PaddlePaddle 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 appli... |
import insightconnect_plugin_runtime
from .schema import SendResolveEventInput, SendResolveEventOutput
# Custom imports below
import pypd
class SendResolveEvent(insightconnect_plugin_runtime.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="send_resolve_event",
... |
# -*- 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
# "... |
# -*- coding: utf-8 -*-
"""Volumes of raw image and labeled object data."""
from __future__ import division
from collections import namedtuple
import csv
import logging
import os
import re
import h5py
import math
import numpy as np
from PIL import Image
import pytoml as toml
import requests
from scipy import ndimag... |
# -*- coding: utf-8 -*-
'''
Module for gathering and managing network information
'''
# Import salt libs
import salt.utils
try:
import salt.utils.winapi
HAS_DEPENDENCIES = True
except ImportError:
HAS_DEPENDENCIES = False
# Import 3rd party libraries
try:
import wmi # pylint: disable=W0611
except Im... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, omar jaber and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class OKRPerformanceProfile(Document):
def validate(self):
self.validate_... |
from django.contrib import admin
from .models import User
from .models import UserInfo
class UserAdmin(admin.ModelAdmin):
list_display = ('email', 'date_joined', 'user_info')
class UserInfoAdmin(admin.ModelAdmin):
list_display = ('name', 'qq', 'mobile')
admin.site.register(User, UserAdmin)
admin.site.regi... |
from panda3d.core import PandaNode
from CommonValues import *
import math
class Door():
def __init__(self, modelNP = None):
self.root = render.attachNewNode(PandaNode("obj"))
self.isOpen = False
self.movementTimer = 0
self.movementDuration = 0
self.movementSpeed = 1.5
... |
import argparse
from src.formula import Formula, Assignment
from src.solver.utils import Falselist
from src.solver.gsat import gsat_distribution, GSATContext
from src.solver.walksat import walksat_distribution, DefensiveContext
from src.solver.probsat import probsat_distribution
parser = argparse.ArgumentParser()
grp ... |
import stanpy as stp
import numpy as np
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
def test_multiple_w0():
EI = 32000 # kN/m2
l = 3 # m
hinged_support = {"w": 0, "M": 0}
roller_support = {"w": 0, "M": 0, "H": 0}
fixed_support = {"w": 0, "phi": 0}
s1 = {"EI": EI, "l": ... |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class YAxis(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout"
_path_str = "layout.yaxis"
_valid_props = {
"anchor",
"automargin"... |
# encoding: utf-8
"""
@version: v1.0
@author: Richard
@license: Apache Licence
@contact: billions.richard@qq.com
@site:
@software: PyCharm
@file: map.py
@time: 2019/2/4 11:16
"""
from pprint import pprint as pp
import sys
import re
for line in sys.stdin:
for raw_word in line.split():
words = r... |
# Copyright 2015-2017 Capital One Services, 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 ... |
import pytest
from django.urls import reverse
from webdev.produtos.models import Produto, Categoria
from django.contrib.auth.models import User
# Novo Produto
@pytest.fixture
def resposta_novo_produto(client, db):
usr = User.objects.create_user(username='TestUser', password='MinhaSenha123')
client.login(userna... |
# --------------------------------
# CodingGears.io
# --------------------------------
# tempfile — Generate temporary files and directories
# TODO: Imports
import tempfile
# TODO: Create a temporary file
temp_file = tempfile.NamedTemporaryFile()
# TODO: Display temp file info
print("File created : {}".format(te... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 02 03:42:20 2016
@author: JUSTIN
"""
#Test github push
print('Hello Lambda.') |
"""Auto-generated file, do not edit by hand."""
# Copyright (C) 2010-2013 The Libphonenumber 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/LICENS... |
import logging
from hdx.location.adminone import AdminOne
from hdx.location.country import Country
from hdx.scraper.configurable.aggregator import Aggregator
from hdx.scraper.outputs.update_tabs import (
get_regional_rows,
get_toplevel_rows,
update_national,
update_regional,
update_sources,
upd... |
"""Support for Overkiz lock."""
from homeassistant.components.lock import DOMAIN as LOCK, LockEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_LOCKED
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from ... |
from dialogKit import *
class CheckBoxDemo(object):
def __init__(self):
self.w = ModalDialog((200, 120), 'CheckBox Demo')
self.w.checkBox1 = CheckBox((10, 10, 180, 20), 'CheckBox 1', callback=self.checkBox1Callback, value=True)
self.w.checkBox2 = CheckBox((10, 40, 180, 20), 'CheckBox 2... |
import re
import os
import time
import shlex
import logging
import subprocess
import threading
TIMEOUT = 5
def wait_for(success, timeout=TIMEOUT):
start_time = time.time()
interval = 0.25
while not success() and time.time() < start_time + timeout:
time.sleep(interval)
interval *= 2
... |
"""
Forest of trees-based ensemble methods for Uplift modeling on Classification
Problem. Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``UpliftRandomForestClassifier`` base class implements different
variants of uplift models based on random forest... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright 2019 Julian Betz
#
# 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 requi... |
#!/usr/bin/python
#
# Generate a varnishtest script to validate the preclassified
# U-A strings in the control set.
#
import sys
HEADER="""varnishtest "automatic test of control set"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
include "${projectdir}/../devicedetect.vcl";
s... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from .managers import TopicPrivateQuerySet
class TopicPrivate(models.Model):
user = models.For... |
#!/usr/bin/env python3
"""
Author : Christian Ayala <cayalaortiz@email.arizona.edu>
Date : 2021-04-10
Purpose: Program to run MetaboDirect scripts
"""
import argparse
import os
import sys
import pandas as pd
import py4cytoscape as p4c
from metabodirect import preprocessing, r_control, transformations
# ----------... |
# Copyright 2020 The Couler 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 applicable law or... |
# Crie um programa que peça um valor em metros e o exiba em centímetros e milímetros
print('='*20)
print('Conversor de medidas')
print('='*20)
medida = float(input('Informe um valor em metros: '))
centimetros = medida * 100
milimetros = medida * 1000
print(f'Você informou {medida}m \n{medida}m corresponde a {centime... |
# encoding: UTF-8
'''
实盘策略范例,接口用法见注释及范例代码
'''
import talib
from futu.examples.tiny_quant.tiny_quant_frame.TinyStrateBase import *
from futu.examples.tiny_quant.tiny_quant_frame.TinyQuantFrame import *
class TinyStrateSample(TinyStrateBase):
"""策略名称, setting.json中作为该策略配置的key"""
name = 'tiny_strate_sample'... |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Audit RBAC Factory."""
from ggrc.models import all_models
from integration.ggrc import Api
from integration.ggrc.models import factories
from integration.ggrc_workflows.models import factories as wf_facto... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Tests of i18n scripts.
#
# Copyright 2013 Google Inc.
# https://blockly.googlecode.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... |
# 11/25/14: a simple script to "flip" all probabilities
import sys
from numpy import *
narg = len(sys.argv)
if narg != 2:
print("usage: %s <file>" % sys.argv[0])
exit(1)
path = sys.argv[1]
f = open(path)
X = f.readlines()
f.close()
N = len(X)
for n in range(N):
xcsv = X[n].split(',')
assert( len(xcsv) ==... |
import os
import base64
from django.conf import settings
from django.contrib.gis.geoip2 import GeoIP2
from geoip2.errors import AddressNotFoundError
from pyotp import TOTP
from KlimaKar.email import mail_managers, get_email_message
def report_user_login(user_session):
country = "-"
if os.path.exists(os.pat... |
def get_matching_paren(exp: str) -> int:
""" Returns the index of the right parenthesis which matches the first left parenthesis.
exp[0] should be a left parenthesis
"""
if exp[0] != '(':
raise ValueError('Given string must begin with \'(\' character')
left = 1
right = 0
i = 1
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import unhexlif... |
import os
import time
import cv2
import numpy as np
import matplotlib.pyplot as plt
def video_read(file_path):
if(os.path.exists(file_path)):
cv2_video = cv2.VideoCapture(file_path)
else:
cv2_video = cv2.VideoCapture(0)
i=0
print(cv2_video.isOpened())
# 获得码率及尺寸
while True:
... |
# 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 torch
from torch.utils.data import DataLoader
from configs.train_config import SpectConfig
from loader.data_loader import SpectrogramDataset, collate_fn
from models.model import Conformer, get_conv_output_sizes
if __name__ == "__main__":
spect_cfg = SpectConfig()
songs_dset = SpectrogramDataset('/home/... |
# 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 ... |
# Copyright (c) 2018-2019, NVIDIA CORPORATION.
from utils import assert_eq
import nvstrings
def test_cat():
strs = nvstrings.to_device(
["abc", "def", None, "", "jkl", "mno", "accént"]
)
got = strs.cat()
expected = ["abcdefjklmnoaccént"]
assert_eq(got, expected)
# non-default separa... |
# -*- coding: utf-8 -*-
import os
import six
from django.conf import settings
from django.utils.encoding import smart_text
from django.core.files import temp
from django.core.files.base import File as DjangoFile
from django.test.utils import override_settings
from django.utils.http import urlquote
from unittest impor... |
#!/usr/bin/env python
from ritetag import RiteTagApi, read_env_file, get_env
read_env_file('.env')
access_token = get_env('ACCESS_TOKEN')
client = RiteTagApi(access_token)
result = client.company_name_to_domain('Google')
def log(message):
print(message)
[log(r) for r in result] |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... |
# Generated by Django 2.1.4 on 2019-01-03 18:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-05 01:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userregistration', '0001_initial'),
]
operations = [
migrations.AlterField(... |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras.layers import Dropout, GlobalMaxPooling2D
from tensorflow.keras.layers import Flatten, Conv2D, MaxPooling2D, ZeroPadding... |
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
# useful for handling different item types with a single interface
from itemadapter import is_item, ItemAdapter
class IntelProcessorsParserSpider... |
# encoding: utf-8
"""
pratt
~~~~~
:copyright: 2015 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst for details
"""
#: The library version as a string.
__version__ = '0.2.0'
#: The library version as a tuple ``(major, minor, patch)``.
__version_info__ = (0, 2, 0)
class PrattException(Exception):... |
"""solytics 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-base... |
#!/usr/bin/env python
#
# Copyright 2016 Cisco 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 applicab... |
from plotly_study.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# color
# -----
@property
def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#f... |
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.template import Template, Context, TemplateSyntaxError
from django.test import TestCase, override_settings
from .settings import FLATPAGES_TEMPLATES
@override_settings(
MIDDLEWARE_C... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2021 Thore Sommer
AST with parser and validator for IMA ASCII entries.
Implements the templates (modes) and types as defined in:
- https://elixir.bootlin.com/linux/latest/source/security/integrity/ima/ima_template.c
- https://www.kernel.org/doc/html/v5.12/security/IMA-... |
from flask import Flask
from threading import Thread
app = Flask(__name__)
@app.route("/")
def hello():
return '<h2>hello</h2>'
def run():
#app.run(host='127.0.0.1',port=5000)
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start() |
# Difficulty: Easy
# Problem Statement: https://leetcode.com/problems/sqrtx/
class Solution:
def mySqrt(self, x: int) -> int:
return int(x ** 0.5) |
# -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class BgpipQueryResourcesRequest(Request):
def __init__(self):
super(BgpipQueryResourcesRequest, self).__init__(
'bgpip', 'qcloudcliV1', 'BgpipQueryResources', 'bgpip.api.qcloud.com')
def get_region(self):
return s... |
# 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 agreed to in writing, ... |
"""Basic 'network'.
This code is based on example
http://docs.gym.derkgame.com/#neural-network-example
"""
import gym
from gym_derk.envs import DerkEnv
from gym_derk import ObservationKeys
import math
import numpy as np
import os.path
from models.network_v1 import Network
SEED = 137
np.random.seed(SEED)
NPZ_FILENAM... |
from copy import deepcopy
import datetime
import jsonpatch
import json
from common import originator_pb2 as common
import pyservices.generated.eventstore.service_pb2 as es
import pyservices.generated.eventstore.event_pb2 as esdata
import pyservices.generated.eventstore.service_pb2_grpc as esgrpc
class NotFoundError(... |
# Copyright 2014, Dell
#
# 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
#... |
r"""
各种文本分类模型的实现
"""
import os
import torch
import torch.nn.functional as F
from torch import nn
from torch.optim import AdamW
from torch.utils.data import DataLoader
from transformers import AutoModel
from transformers.models.bert.modeling_bert import BertModel
from transformers import DataCollatorWithPadding, get_li... |
"""This module implements a simple replay buffer."""
import numpy as np
from garage.misc.overrides import overrides
from garage.replay_buffer.base import ReplayBuffer
class SimpleReplayBuffer(ReplayBuffer):
"""
This class implements SimpleReplayBuffer.
It uses random batch sample to minimize correlation... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import ... |
#!/usr/bin/python
# 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
# d... |
from flask import Flask, render_template, request, redirect, url_for, jsonify, abort
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
import sys
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://sammymurray@localhost:5432/todoapp'
db = SQLAlchemy(app)
migrate = Migrate(... |
# Copyright 2019 the ProGraML authors.
#
# Contact Chris Cummins <chrisc.101@gmail.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/LICENSE-2.0
#
# ... |
# coding: utf-8
from __future__ import absolute_import
import datetime
import re
import importlib
import six
from huaweicloudsdkcore.client import Client, ClientBuilder
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcore.utils import http_utils
from huaweicloudsdkcore.sdk_stream_request imp... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Zcash developers
# Copyright (c) 20202 The groom developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import groomTestFramework
from test_fra... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Return a score for each of the given observables. The score is ranged between 0 and -100 (0 = observable unknown, -100 = super evil observable)"
class Input:
OBSERVABLES = "observables"
class Output:
... |
#!/usr/bin/env python3
import unittest
class MyTestSuite(unittest.TestCase):
def test_len_3(self):
self.assertTrue(is_palindrome("bob"))
def test_len_less_than_3_raises_ValueError(self):
with self.assertRaises(ValueError):
self.assertTrue(is_palindrome("aa"))
def test_basic(s... |
# -*- coding: utf-8 -*
# --------------------------------------------------------
# SNNformer Feature Extractor (SFE) - SNN branch
# --------------------------------------------------------
import torch.nn as nn
import torch
from videoanalyst.model.backbone.backbone_base import (TRACK_BACKBONES,
... |
import argparse
import json
from voc import parse_voc_annotation
argparser = argparse.ArgumentParser(description='train and evaluate YOLO_v3 model on any dataset')
argparser.add_argument('-c', '--conf', help='path to configuration file')
args = argparser.parse_args()
config_path = args.conf
with open(config_path... |
# -*- coding: utf-8 -*-
from os.path import join
import matplotlib.pyplot as plt
from numpy import array, pi, zeros
from pyleecan.Classes.Frame import Frame
from pyleecan.Classes.LamSlotWind import LamSlotWind
from pyleecan.Classes.LamSquirrelCage import LamSquirrelCage
from pyleecan.Classes.MachineDFIM import Machin... |
#!/usr/bin/env python3
"""
task3_most_common_sense.py - Task 3: Pun Interpretation using most common sense for sense2
Author: Dung Le (dungle@bennington.edu)
Date: 11/13/2017
"""
import xml.etree.ElementTree as ET
import nltk
from nltk.corpus import stopwords
from nltk.corpus import wordnet as wn
from nltk... |
from nose.tools import eq_
from mhctools import BindingPrediction, BindingPredictionCollection
def test_collection_to_dataframe():
bp = BindingPrediction(
peptide="SIINFEKL",
allele="A0201",
affinity=1.5,
percentile_rank=0.1)
collection = BindingPredictionCollection([bp])
df... |
from django.contrib import admin
from server.models import *
# Register your models here.
admin.site.register(Categorie)
admin.site.register(City)
admin.site.register(Country)
admin.site.register(Details)
admin.site.register(Image)
admin.site.register(Food)
admin.site.register(Restaurant)
admin.site.register(Order)
ad... |
# Generated by Django 2.2.7 on 2020-02-15 13:56
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('Ecommerce', '0023_auto_20200215_1728'),
]
operations = [
migrations.AlterField(
... |
from . import simple_backbone
__all__ = ['simple_backbone'] |
"""Utils for pipeline runners for TFleX pipelines."""
# 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/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.