text stringlengths 2 999k |
|---|
'''
Using parameters
=================
'''
import matplotlib.pyplot as plt
import numpy as np
import pyant
beam = pyant.Airy(
azimuth=[0, 45.0, 0],
elevation=[89.0, 80.0, 60.0],
frequency=[930e6, 230e6],
I0=10**4.81,
radius=np.linspace(10,23.0,num=20),
)
k = np.array([0,0,1.0]).T
#This is the sha... |
from models import modifyresnet18, UNet, Synthesizer
import torch
import torch.optim as optim
import torch.nn as nn
from util.datahelper import load_all_training_data, sample_from_dict #正确性未经验证
import itertools
import numpy as np
import librosa.display
import matplotlib.pyplot as plt
import os
from torch.auto... |
# Copyright 1999-2021 Alibaba Group Holding 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 _plotly_utils.basevalidators
class ShowbackgroundValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="showbackground", parent_name="layout.scene.zaxis", **kwargs
):
super(ShowbackgroundValidator, self).__init__(
plotly_name=plotly_name,
... |
#!/usr/bin/env python3
import os
import numpy as np
# import kitti.tracklet_parser as tracklet_parser
# import kitti.tracklet_parser as tracklet_parser
import collections
import pandas as pd
KittiObject = collections.namedtuple('KittiObject', ['type',
'truncated',
... |
from ..errormessage import render_error
from icemac.addressbook.person import person_entity
from zope.i18n import translate
def test_errormessage__render_error__1(zcmlS):
"""It is able to render an error which does not belong to a field."""
message = render_error(
person_entity, field_name='', exc=Run... |
#!/usr/bin/env python
# vim:ts=4:sw=4:et:
# This script is roughly equivalent to the configure script that is
# generated from configure.ac.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# no unicode literals
import argparse
import os
import re
import shu... |
from __future__ import division, print_function
from threading import Thread
import os
import ConfigParser
import logging
import numpy as np
import pandas as pd
from atrial_fibrillation import AtrialFibrillation
from ventricular_tachycardia import VentricularTachycardia
from apc_pvc_helper import APC_helper
from pvc... |
import random
from flask import request, redirect, Flask, render_template
import time
app = Flask(__name__)
card_group = ["spade", "plum", "square", "heart"]
card_number = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "K", "Q"]
cards = []
for g in card_group:
for n in card_number:
cards... |
# Generated by Django 2.1.7 on 2019-03-29 08:07
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('e_secretary', '0004_auto_20190329_1002'),
]
operations = [
migrations.AddField(
model_name='announcement',
... |
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from rest_framework.parsers import JSONParser
from rest_framework import generics
# Create your views here.
from .serializers import *
class CarOwnershipView(generics.ListAPIView):
serializer_class = CarOwnershipSerializer
... |
from .whatlang import detect_language
|
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import webapi_login_required
from reviewboard.webapi.resources import resources
from reviewboard.webapi.resources.diff import DiffResourc... |
from django.test import TestCase
from products.models import Category, Product
from users.models import User
class CategoryModelTest(TestCase):
@classmethod
def setUpClass(cls):
super(CategoryModelTest, cls).setUpClass()
Category.objects.create(category_name="Sodas")
def test_category_na... |
import argparse
import os
import shutil
import sys
from pathlib import Path
from typing import Any, Callable, Dict, Optional, Union
import pkg_resources
import yaml
from chia.util.path import mkdir
import chia.util.flora
def initial_config_file(filename: Union[str, Path]) -> str:
return pkg_resources.resource_s... |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2014 Red Hat, 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
#
# Unl... |
def problem340():
pass
|
db = DAL('sqlite://storage.sqlite')
from gluon.tools import *
auth = Auth(db)
auth.define_tables()
crud = Crud(db)
db.define_table('anuncio',
Field('title'),
Field('body', 'text'),
Field('price', 'decimal(5, 2)'),
Field('negociacion', 'boolean', default=Fals... |
# Copyright The OpenTelemetry 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 agreed to in ... |
# Copyright 2019 PerfKitBenchmarker 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 facebook, urllib3, requests
'''Demonstrate usage of Facebook graph API.
1. Create a Facebook developer account. See https://developers.facebook.com/docs/development/register.
2. Create a Facebook app. See https://developers.facebook.com/apps/.
- type: business
- display name: sql sith is all business
... |
import os
import requests
from getpass import getpass
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Get api token for user providing username/password"
def handle(self, *args, **options):
username = os.environ.get("USERNAME", "analytics")
obtain_tok... |
# 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': 'expat',
'type': 'none',
'link_settings': {
'libraries': [
'-lexpat',
],
... |
#!/usr/bin/env python
import sys
from setuptools import setup
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(
name='marathon',
version='0.8.2',
description='Marathon Client Library',
long_description="""Python interface to the Mesos Marathon REST API.""",
author='Mike B... |
words = ["donkey", "kaddu", "mote"]
with open("sample.txt") as f:
content = f.read()
for word in words:
content = content.replace(word, "$%^@$^#")
with open("sample.txt", "w") as f:
f.write(content) |
import asyncio
import time
import logging
import zmq
import zmq.asyncio
from collections import namedtuple
from gabriel_protocol import gabriel_pb2
from gabriel_server import cognitive_engine
from gabriel_server import network_engine
from gabriel_server.websocket_server import WebsocketServer
FIVE_SECONDS = 5
logge... |
# -*- coding: utf-8 -*-
class Taiyang(object):
def __init__(self):
pass
class ShouTaiyang(Taiyang):
def __init__(self):
pass
class ZuTaiyang(Taiyang):
def __init__(self):
pass
|
"""
Register an iFrame front end panel.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/panel_iframe/
"""
import voluptuous as vol
from homeassistant.const import (CONF_ICON, CONF_URL)
import homeassistant.helpers.config_validation as cv
DEPENDENCIES =... |
#!/usr/bin/env python
###################################################################
# uids_example_script.py : Demonstrate how to Execute/skip particular test
# By default is there is uids is not defined, everything is
# executed.
# If uids is defined, only what match true with uids will be executed
#############... |
__VERSION__ = '0.9.4' |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import requests
import base64
import email
import hashlib
from typing import List
from dateutil.parser import parse
from typing import Dict, Tuple, Any, Optional, Union
from threading import ... |
import pyblish.api
class CollectAnimatedOutputs(pyblish.api.InstancePlugin):
"""Collect transform animated nodes
This only collect and extract animated transform nodes,
shape node will not be included.
"""
order = pyblish.api.CollectorOrder + 0.2
label = "Collect Animated Outputs"
host... |
# Copyright (C) 2017-2018 GIG Technology NV and Contributors
#
# 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 applicabl... |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.ip_messaging import TwilioIpMessagingClient
# Your Account Sid and Auth Token from twilio.com/user/account
account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
token = "your_auth_token"
client = TwilioIpMessagingClient(account, token)
... |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... |
#!/usr/bin/env python
# coding=utf-8
"""Follow Reference Field tests."""
|
"""
Factual API driver
"""
import json
from functools import partial
from urllib import urlencode
import requests
from requests_oauthlib import OAuth1
from query import Resolve, Table, Submit, Insert, Facets, Flag, Geopulse, Geocode, Diffs, Match, Multi, Clear
API_V3_HOST = "http://api.v3.factual.com"
DRIVER_VERSIO... |
#!/usr/bin/env python3
# Copyright 2018 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... |
# 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, overload
from ... import _utilities
fro... |
import math
class TestModel:
def __init__(self, testFile):
self.testFile = testFile
def testModel(self, model):
getProbability, classProbabilities = model
finalResults = []
with open(self.testFile, 'r') as f:
for line in f:
maxP = ['', '', -math.in... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import sys
im... |
# Copyright 2018 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/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
import platform
import time
import cv2
import io
import socket
import struct
import time
import pickle
import numpy as np
import imutils
host = '192.168.0.4'
port = 1515
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.connect((host, port))
host_name = socket.gethostname()
host_ip = so... |
# 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... |
import sys
import json
def item_to_string(obj):
return '\t'.join(str(v) for v in [
obj["id"],
0,
obj["frame"],
obj["command"],
obj["param1"],
obj["param2"],
obj["param3"],
obj["param4"],
obj["coordinate"][0],
obj["coordinate"][1],
... |
import os
import re
import argparse
import csv
# ###############################################################
# Class for generating task directories, each containing
# a config.txt file
# ###############################################################
class GenTaskDirs():
#--------------------------
#construc... |
# Generated by Django 2.1.2 on 2018-10-04 16:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bulletin_board', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Category',
... |
from ..models import Animal
from django import template
register = template.Library()
@register.simple_tag
def list_animal_types():
pet_type_list = []
for type_code, pet_type in Animal.ANIMAL_TYPE_CHOICES:
URL = f"feeding_entry_{type_code}"
text = f"{pet_type} Feeding"
pet_type_list.a... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# ReCode by @mrismanaziz
# FROM Man-Userbot <https://github.com/mrismanaziz/Man-Userbot>
# t.me/SharingUserbot & t.me/L... |
import feedparser
def get_videos_from_feed(url):
NewsFeed = feedparser.parse(url)
videos = []
for entry in NewsFeed.entries :
video = { "title": entry.title, "link": entry['link'], "updated": entry['published'] }
videos.append(video)
channel = {"url": url, "videos": videos}
return c... |
"""
Functions for identifying peaks in signals.
"""
import math
import numpy as np
from scipy.signal._wavelets import cwt, ricker
from scipy.stats import scoreatpercentile
from ._peak_finding_utils import (
_local_maxima_1d,
_select_by_peak_distance,
_peak_prominences,
_peak_widths
)
__all__ = ['arg... |
from __future__ import absolute_import
from perses.utils.openeye import *
from perses.annihilation.relative import HybridTopologyFactory
from perses.rjmc.topology_proposal import PointMutationEngine
from perses.rjmc.geometry import FFAllAngleGeometryEngine
import simtk.openmm as openmm
import simtk.openmm.app as app
... |
import argparse
import subprocess as sp
import tensorflow as tf
cflags = " ".join(tf.sysconfig.get_compile_flags())
lflags = " ".join(tf.sysconfig.get_link_flags())
tf_inc = tf.sysconfig.get_include()
tf_lib = tf.sysconfig.get_lib()
parser = argparse.ArgumentParser()
parser.add_argument('ale_path', type=str, default=... |
"""Script showing several ways to launch things.
Note: never call set_launcher(launching, launched) if <launched> can be launched
by another element and <launching> is NOT in the same menu."""
import thorpy, pygame
application = thorpy.Application((500,500), "Launching alerts")
# ****************** First launcher : ... |
from big_ol_pile_of_manim_imports import *
import mpmath
mpmath.mp.dps = 7
def zeta(z):
max_norm = FRAME_X_RADIUS
try:
return np.complex(mpmath.zeta(z))
except:
return np.complex(max_norm, 0)
def d_zeta(z):
epsilon = 0.01
return (zeta(z + epsilon) - zeta(z))/epsilon
class ZetaT... |
from django.db import models
from django.utils import timezone
from datetime import date
import shared
# Create your models here.
## EP Project
class Project(models.Model):
jobnumber = models.CharField(max_length=15, default='', unique=True)
projectname = models.CharField(max_length=100, default='')
projectmanager ... |
#!/usr/bin/python
from __future__ import print_function
import sys
import rubrik_cdm
import getopt
import getpass
import urllib3
urllib3.disable_warnings()
def usage():
sys.stderr.write("Usage: rbk_share_grab.py [-h] [-c creds] [-p protocol] [-t token] [-o outfile] rubrik\n")
sys.stderr.write("-h | --help: P... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'breakpad_sender.gypi',
'breakpad_handler.gypi',
],
'conditions': [
# minidump_stackwalk and minidump_dump are tool-typ... |
import copy
import numpy as np
from dowhy.causal_refuter import CausalRefutation
from dowhy.causal_refuter import CausalRefuter
class PlaceboTreatmentRefuter(CausalRefuter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._placebo_type = kwargs["placebo_type"]
d... |
# Copyright The OpenTelemetry 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 agreed to in ... |
def fit(X_train, y_train):
from sklearn.metrics import accuracy_score
import pandas as pd
data = X_train.copy()
assert len(data) == len(y_train)
y_train = pd.DataFrame(list(y_train))
data.index = range(len(data))
concated_data = pd.concat([data,y_train],axis=1)
majority_dict = {}
list_majority_dict = ... |
"""
Pomice
~~~~~~
The modern Lavalink wrapper designed for discord.py.
:copyright: 2021, cloudwithax
:license: GPL-3.0
"""
import discord
if not discord.__version__.startswith("2"):
class DiscordPyOutdated(Exception):
pass
raise DiscordPyOutdated(
"You need the 'discord' library to use this ... |
from django.contrib import admin
from .models import Fixation, FixationAnswer, FixationQuestion, FixationSession, FixationSessionPlayer, FixationSessionSettings
# Register your models here.
admin.site.register(Fixation)
admin.site.register(FixationQuestion)
admin.site.register(FixationAnswer)
admin.site.register(Fixa... |
"""
PERIODS
"""
numPeriods = 180
"""
STOPS
"""
numStations = 13
station_names = (
"Hamburg Hbf", # 0
"Landwehr", # 1
"Hasselbrook", # 2
"Wansbeker Chaussee*", # 3
"Friedrichsberg*", # 4
"Barmbek*", # 5
"Alte Woehr (Stadtpark)", # 6
"Ruebenkamp (City Nord)", # 7
"Ohlsdorf*", # 8
"Kornweg", # 9
... |
import datetime
import os
from scrappers.scrappers.config.config import configuration
current_date = datetime.datetime.now().date()
def write_image(func):
"""A decorator definition that writes images to
a default directory.
"""
default_path = configuration.default_output_dir
def writer(self, data,... |
"""
Copyright (C) 2017-2020 Intel Corporation
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 i... |
from datetime import datetime
import pytest
from pygrocy.data_models.chore import AssignmentType, Chore, PeriodType
from pygrocy.data_models.user import User
from pygrocy.errors.grocy_error import GrocyError
class TestChores:
@pytest.mark.vcr
def test_get_chores_valid(self, grocy):
chores = grocy.ch... |
# coding: utf-8
"""
=======================================================
Feature Extraction for Denoising: Clean and Noisy Audio
=======================================================
Extract acoustic features from clean and noisy datasets for
training a denoising model, e.g. a denoising autoencoder.
To see how ... |
from busy_beaver.apps.upcoming_events.workflow import generate_upcoming_events_message
from busy_beaver.toolbox.slack_block_kit import Block, Divider, Section
APP_HOME_HEADER_INSTALLED = (
"*Welcome!* Busy Beaver is a community engagement bot.\n\n"
"Join <#{channel}> to see daily GitHub summaries for registere... |
#
# CSE.py
#
# (c) 2020 by Andreas Kraft
# License: BSD 3-Clause License. See the LICENSE file for further details.
#
# Container that holds references to instances of various managing entities.
#
import atexit, argparse, os, threading, time
from Constants import Constants as C
from AnnouncementManager import Announce... |
# https://github.com/andy-gh/prettyjson/blob/master/prettyjson.py
def prettyjson(obj, indent=2, maxlinelength=80):
"""Renders JSON content with indentation and line splits/concatenations to fit maxlinelength.
Only dicts, lists and basic types are supported"""
items, _ = getsubitems(obj, itemkey="", islas... |
# coding:utf-8
import requests
import re
headers = {
'user-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
}
r = requests.get('http://www.zhihu.com/explore', headers=headers)
pattern = re.compile('explore-feed.*?question_link.*?>(... |
"""
@author: Yifei Ji
@contact: jiyf990330@163.com
"""
import torch
import torch.nn as nn
__all__ = ['BatchSpectralShrinkage']
class BatchSpectralShrinkage(nn.Module):
r"""
The regularization term in `Catastrophic Forgetting Meets Negative Transfer:
Batch Spectral Shrinkage for Safe Transfer Learning (NI... |
import abc
from ofx2xlsmbr.reader.IReaderBankStatement import IReaderBankStatement
from ofx2xlsmbr.reader.IReaderCashFlow import IReaderCashFlow
class ReaderAbstractFactory(metaclass=abc.ABCMeta):
@abc.abstractmethod
def createReaderBankStatement(self) -> IReaderBankStatement:
pass
@abc.abstractm... |
# Codificar un script que cante las cartas de la lotería
# Deben presentarse en orden aleatorio
# Preguntando en cada iteración si ya hubo "buena"; en caso de ser así detenerse
# Si se agotan las cartas y nadie ha ganado, entonces anunciar el fin del juego
import random
print("Bienvenido(a)")
listaDeCartasDisponibles... |
# Generated by Django 3.2 on 2021-04-28 15:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('library', '0003_auto_20210428_1522'),
]
operations = [
migrations.RemoveField(
model_name='book',
name='color',
),
... |
# Scraper for Texas 9th Court of Appeals
# CourtID: texapp9
# Court Short Name: TX
# Author: Andrei Chelaru
# Reviewer: mlr
# Date: 2014-07-10
from juriscraper.opinions.united_states.state import tex
class Site(tex.Site):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
sel... |
#!/usr/bin/python3
import time
from web3 import Web3, KeepAliveRPCProvider, IPCProvider
web3 = Web3(KeepAliveRPCProvider(host='127.0.0.1', port='8545'))
# Global Declarations
global true
global false
global myst_account_0_a
global myst_account_1_a
global myst_account_2_a
global myst_account_3_a
global myst_... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 modif... |
# -*- coding: utf-8 -*-
# Copyright © 2018 Damir Jelić <poljar@termina.org.uk>
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PR... |
frase = 'Curso em Vídeo Python'
print(frase.replace('Python','Android'))
|
import statistics
from db_model import *
def get_user_by_id(user_id):
return User.get(User.id == user_id)
def get_movie_by_id(movie_id):
return Movie.get(Movie.id == movie_id)
def get_movie_rating_by_user(user_id):
return list(Rating.select().where(Rating.user_id == user_id))
def get_user_who_rate_... |
import pygame, sys, math, random
class Ball():
def __init__(self, image, speed=[5,5], startPos=[0,0]):
self.images= [
pygame.image.load("Ball/ball.png"),
pygame.image.load("Ball/ballA.png"),
pygame.image.load("Ball/ballB.png"),
... |
# 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 ... |
# pylint: disable-msg=E1101,W0612
import operator
from datetime import datetime
import nose
from numpy import nan
import numpy as np
import pandas as pd
dec = np.testing.dec
from pandas.util.testing import (assert_almost_equal, assert_series_equal,
assert_frame_equal, assert_panel_e... |
import pytest
import networkx as nx
from networkx.testing import assert_edges_equal
def test_union_attributes():
g = nx.Graph()
g.add_node(0, x=4)
g.add_node(1, x=5)
g.add_edge(0, 1, size=5)
g.graph['name'] = 'g'
h = g.copy()
h.graph['name'] = 'h'
h.graph['attr'] = 'attr'
h.nodes[... |
import string
import itertools
def chunker(seq, size):
it = iter(seq)
while True:
chunk = tuple(itertools.islice(it, size))
if not chunk:
return
yield chunk
def prepare_input(dirty):
"""
Prepare the plaintext by up-casing it
and separating repeated letters wit... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^login/$', views.Login),
url(r'^logout/$', views.Logout),
url(r'^home/$', views.Home),
url(r'^blog/$', views.Blog),
] |
"""
File to run AISTATS experiments from shell
"""
# Author: Alicia Curth
import argparse
import sys
from typing import Any
import catenets.logger as log
from experiments.experiments_AISTATS21.ihdp_experiments import do_ihdp_experiments
from experiments.experiments_AISTATS21.simulations_AISTATS import main_AISTATS
lo... |
import pytest
from fingan.wgan import WGAN
from fingan.TestData import SineData
import matplotlib.pyplot as plt
def testWGAN():
data = SineData(100, 400, [3, 10], [1, 5])
model = WGAN()
model.train(data, 20)
x = model.generate(1)
print(x.detach().numpy())
plt.plot(x.detach().numpy()[0])
pl... |
# pylint: disable=no-else-return, unidiomatic-typecheck, invalid-name, unused-argument
"""Convert an NNVM graph to Relay."""
import json
import numpy
from tvm import relay, nd
from tvm.relay import op, expr, var
from tvm.relay.frontend.common import StrAttrsDict
from tvm.relay.frontend.nnvm_common import _rename
from ... |
import pytest
# @pytest.mark.django_db
# def test_process_event_no_messages(subscription1, occurence1):
# channel = subscription1.channel
# channel.messages.all().delete()
# event = subscription1.event
# with pytest.raises(ObjectDoesNotExist):
# assert process_channel(channel.pk, event.pk, occu... |
def day8(fileName):
codeChars = 0
memoryChars = 0
encodedChars = 0
with open(fileName) as infile:
for line in infile:
encodedString = line.strip().replace('\\', '\\\\').replace('"', '\\"')
encodedChars += len(encodedString) + 2
lineCodeChars = len(line.strip()... |
from setuptools import setup, find_packages
import os
import shop
CLASSIFIERS = [
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'To... |
import logging
from multiprocessing import Pool
from tqdm import tqdm
log = logging.getLogger(__name__)
class Arena():
"""
An Arena class where any 2 agents can be pit against each other.
"""
def __init__(self, player1, player2, game, display=None):
"""
Input:
player 1,2:... |
#-------------------------------------#
# 创建YOLO类
#-------------------------------------#
import colorsys
import os
import time
import numpy as np
import torch
import torch.nn as nn
from PIL import Image, ImageDraw, ImageFont
from nets.yolo3 import YoloBody
from utils.utils import (DecodeBox, lette... |
# PACKAGE IMPORTS FOR EXTERNAL USAGE
from tests.unit_tests.dataset_interface_test import TestDatasetInterface
from tests.unit_tests.factories_test import FactoriesTest
from tests.unit_tests.load_checkpoint_from_direct_path_test import LoadCheckpointFromDirectPathTest
from tests.unit_tests.strictload_enum_test import St... |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... |
from __future__ import print_function
from __future__ import division
import pandas as pd
import numpy as np
from urbansim_defaults.randomfile import fixedrandomseed,seednum
class Developer(object):
"""
Pass the dataframe that is returned by feasibility here
Can also be a dictionary where keys are buildi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.