text stringlengths 2 999k |
|---|
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@londonappdev.com',
... |
from zunzun import CommandRegister, Command
from unittest.mock import MagicMock
def test_add_commands():
class MyCommand(Command):
pass
class ModuleMock:
no_command = ""
command = MyCommand
injector = MagicMock()
injector.get = MagicMock(return_value="object_from_injector")
... |
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
class GetController(Controller):
def get(self):
p1 = self.get_argument('p1', default='empty')
p2 = self.get_argument('p2', default='None')
assert(self.render_string('tests/view/ui_methods/get.html', {'key': 'p1'... |
# 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! ***
# Export this package's modules as members:
from .get_industrial_pid_loops import *
from .get_industrial_pid_organizations import *
fro... |
from __future__ import print_function
import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
import torch.nn.functional as F
import torch.optim as optim
from PIL import Image
import matplotlib.pyplot as plt
from .losses import ContentLoss, StyleLoss, Norma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : simbert.
# @File : __init__.py
# @Time : 2021/3/30 7:27 下午
# @Author : yuanjie
# @WeChat : 313303303
# @Software : PyCharm
# @Description :
|
from typing import Generic, List, Optional, TypeVar
from pydantic import BaseModel, EmailStr
from fastapi_users import models
class CreateUpdateDictModel(BaseModel):
def create_update_dict(self):
return self.dict(
exclude_unset=True,
exclude={
"id",
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 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 mempool re-org scenarios.
Test re-org scenarios with a mempool that contains transactions
that sp... |
from flatland import (
Array,
Dict,
Integer,
MultiValue,
String,
)
from tests._util import eq_, assert_raises
def test_set_flat_pruned():
sub = String.named(u's')
pairs = [(u's', u'val0'), (u's', u''), (u's', u'val1'), (u's', u'')]
wanted = [u'val0', u'val1']
for schema in Ar... |
import numpy as np
def cofiCostFunc(params, Y, R, num_users, num_movies, num_features, Lambda):
"""returns the cost and gradient for the
"""
# Unfold the U and W matrices from params
X = np.array(params[:num_movies*num_features]).reshape(num_features, num_movies).T.copy()
Theta = np.array(params[... |
#!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE
|
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
import json
import re
import pytest
from raiwidgets import ResponsibleAIDashboard
from raiwidgets.cohort import Cohort, CohortFilter, CohortFilterMethods
from raiwidgets.dashboard import invalid_feature_flights_error
from responsibleai._interfac... |
__all__ = [
'__title__', '__description__', '__uri__', '__version__', '__author__',
'__email__', '__license__', '__copyright__'
]
__title__ = "slack-machine"
__description__ = "A sexy, simple, yet powerful and extendable Slack bot"
__uri__ = "https://github.com/DandyDev/slack-machine"
__version_info__ = (0, 1... |
# coding: utf-8
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = (
'tests.dummyapp',
'django_scripts',
)
SITE_ID = 1,
SECRET_KEY = 'secret'
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
... |
# -------------------------------------------------------------------------
# Copyright (c) albertomorales.eu
# ------------------------------------------------------------------------- |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2019-10-26 06:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contest', '0003_contestofgrade_is_contest'),
]
operations = [
migrations.AlterIndexT... |
import sys
import pytest
from django.urls import reverse
@pytest.mark.django_db
def test_checker_success(django_app, admin_user, demomodel2):
change_url = reverse('admin:demo_demomodel2_test_regex', args=[demomodel2.pk])
res = django_app.get(change_url, user=admin_user)
res.form['regex_0'] = '[0-9]*'
... |
# Copyright 2019 NEC 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... |
from enum import Enum, unique
@unique
class CJT188MeterType(Enum):
"""
国标GB-CJ/T188协议,水电表类型
"""
# 冷水表
Water = 0x10
# 热水表
HotWater = 0x11
# 直饮水表
DirectWater = 0x12
# 中水水表
IntermediateWater = 0x13
# 大口径水表
Woltex = 0x14
# 热量表(计热量)
HotHeat = 0x20
# 热量表(计冷量... |
from agents.base import BaseAgent
from graphs.models.classifier import Actvity_classifier
from data_loader.voc import VOCDataLoader
from tqdm import tqdm
from keras.callbacks import ModelCheckpoint, TensorBoard, LearningRateScheduler
from keras import metrics, optimizers
from keras.optimizers import SGD, Adam
from kera... |
# 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 ... |
# an implementation for "Learning Deep Generative Models of Graphs"
from main import *
class Args_DGMG():
def __init__(self):
### CUDA
self.cuda = 2
### model type
self.note = 'Baseline_DGMG' # do GCN after adding each edge
# self.note = 'Baseline_DGMG_fast' # do GCN only a... |
"""
Clusters Bob Ross paintings by features.
By Walter Hickey <walter.hickey@fivethirtyeight.com>
See http://fivethirtyeight.com/features/a-statistical-analysis-of-the-work-of-bob-ross/
"""
import csv
import math
import numpy as np
from scipy.cluster.vq import kmeans, whiten
def main():
# load data into vecto... |
# -*- coding: utf-8 -*-
from fastavro.validation import (
ValidationError,
ValidationErrorData,
validate,
validate_many,
)
from fastavro import parse_schema
import pytest
import numpy as np
from datetime import datetime
schema = {
"fields": [
{"name": "str_null", "type": ["null", "string"]}... |
from behave import then
from common import DEFAULT_WAIT
# Unique to Scenario: View applications
@then('I see a list of pending applications')
def impl(context):
assert context.browser.is_element_present_by_css('.review-app-table')
assert context.browser.is_text_present('Pending', wait_time=DEFAULT_WAIT)
a... |
"""
Module for viewing and modifying sysctl parameters
"""
import logging
import os
import re
import salt.utils.data
import salt.utils.files
import salt.utils.stringutils
import salt.utils.systemd
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
# Define the module's virtual name
... |
from enigma import eRect, eServiceReference, iServiceInformation, iPlayableService
from Screens.Screen import Screen
from Screens.ServiceInfo import ServiceInfoList, ServiceInfoListEntry
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Pixmap import Pixmap
from Components.Label import Label
f... |
import re
from hashlib import md5
from typing import List, Optional
# Input data loading
from aocd import get_data
prefix = get_data(year=2016, day=5)
regex = re.compile(r"^0{5}[0-7].")
INDEX: int = 0
FINAL: List[Optional[str]] = [None for _ in range(8)]
while None in FINAL:
while True:
HASH = md5(f"{p... |
## GraphSage aggregators
import logging
import numpy as np
import tensorflow as tf
from transformers.modeling_tf_utils import shape_list
logger = logging.getLogger(__name__)
class MeanAggregator(tf.keras.layers.Layer):
def __init__(self, config, out_dim, activation='relu', identity_act=False, **kwargs):
... |
"""
Capstone Project. Code to run on a LAPTOP (NOT the robot).
Displays the Graphical User Interface (GUI) and communicates with the robot.
Authors: Your professors (for the framework)
and Nasser Hegar.
Winter term, 2018-2019.
"""
import mqtt_remote_method_calls as com
import tkinter
from tkinter import... |
from mpi4py import MPI
import numpy as np
from pySDC.core.Errors import DataError
class pmesh_datatype(object):
"""
Mesh data type with arbitrary dimensions, will contain PMESH values and communicator
Attributes:
values (np.ndarray): contains the ndarray of the values
comm: MPI communica... |
"""Exception module for cluster classes.
Note:
It is intended that the lazycluster.exception.LazyclusterError should be the parent class of all defined exception
classes here.
"""
from lazycluster.exceptions import LazyclusterError
class MasterStartError(LazyclusterError):
"""Error indicating that the c... |
# coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License'). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'lice... |
from flask import Flask, render_template, request
from public import consumes
from public import datamanager
from public import app
|
import setuptools
with open('README.md', mode='r', encoding='utf-8') as readme_file:
long_description = readme_file.read()
setuptools.setup(
name="eml-analyzer",
version="1.0.3",
author="Florian Wahl",
author_email="florian.wahl.developer@gmail.com",
description="A cli script to analyze an E-... |
class User:
def __init__(self, username, password, full_name):
self.username = username # instance vars, can use _ for protected and __ for private
self.password = password
self.full_name = full_name
#def username(self): if we want to reference private instance variables self.__username
... |
"""
Author: Roman Slyusar (https://github.com/Roman-R2)
Сортировщик файлов (например фотографий)
Проблематика: скопилось много папок с фотографиями, в том числе и копий
фотографий на разных дисках, скопированных с нескольких независимых
источников в разное время.
Требования:
1. Отсортировать файлы по датам:
-. Опр... |
from django.contrib import admin
from .models import Player, PlayerInventory, Item, Team, Map, Room
# Register your models here.
admin.site.register(Player)
admin.site.register(PlayerInventory)
admin.site.register(Item)
admin.site.register(Team)
admin.site.register(Map)
admin.site.register(Room) |
import asyncio
import dataclasses
import time
from secrets import token_bytes
from typing import Callable, Dict, List, Optional, Tuple, Set
from blspy import AugSchemeMPL, G2Element
from bitchiabip158 import PyBIP158
import bitchia.server.ws_connection as ws
from bitchia.consensus.block_creation import create_unfinis... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import infra.network
import infra.e2e_args
import infra.proc
import infra.logging_app as app
import infra.utils
import infra.github
import infra.jwt_issuer
import cimetrics.env
import suite.test_requirements as reqs
imp... |
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
# 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... |
#!/usr/bin/python
# Author: @BlankGodd_
from setuptools import setup
with open('description.rst', 'r') as fh:
long_description = fh.read()
setup(
name="blyrics",
version="1.1",
author="Damilare Agbabiaka (AgbaD)",
author_email="blankgodd33@gmail.com",
description="Python client for the GENI... |
def splitting(arr, start, end):
pivot = arr[start]
low = start + 1
high = end
while True:
while low<= high and arr[high]>= pivot:
high = high - 1
while low<= high and arr[low]<= pivot:
low = low + 1
if low <= high:
arr[low],arr[high... |
from django.conf.urls import url, include
from . import views
urlpatterns = [
url('^dashboard/$',views.DashboardView.as_view(),name='dashboard'),
url('^logout/$',views.LogoutView.as_view(),name='logout'),
url('^signup/$',views.SignUpView.as_view(),name='signup'),
url('^', include('django.contrib.auth.ur... |
import datetime
def matches(actual, expected):
return {k: v for (k, v) in actual.items() if k in expected.keys()} == expected
def assert_session(envelope, extra_assertion=None):
session = None
for item in envelope:
if item.headers.get("type") == "session" and item.payload.json is not None:
... |
#!/usr/bin/env python2
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: op-test-framework/testcases/OpTestKernel.py $
#
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2017
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, V... |
# Copyright 2021 The Kubeflow 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... |
from __future__ import annotations
import asyncio
from asyncio import AbstractEventLoop
from collections import deque
from typing import TYPE_CHECKING, Any, Awaitable, Coroutine, Dict, Optional, Union
import functools
from ferris.types.base import Snowflake
from ferris.user import ClientUser
from .http import APIRo... |
import pandas as pd
import json
from pandas.io.json import json_normalize
def make_gbif_specimen_link(gbifID):
url = '<a target="_blank" href="https://www.gbif.org/occurrence/{0}">{0}</a>'.format(gbifID)
return url
def make_specimen_table(df):
columns = ['gbifID', 'scientificName', 'recordedBy', 'eve... |
# Copyright (c) 2016 IBM
# 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 os
from flask import Flask
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
if test_config is None:
app.config.from_pyfile('shhrink.cfg', silent=True)
else:
app.config.from_mapping(test_config)
app.config.update(
DATABASE_PATH... |
"""
Train an agent using a PPO2 based on OpenAI Baselines.
"""
import time
from mpi4py import MPI
import tensorflow as tf
from baselines.common import set_global_seeds
import coinrun.main_utils as utils
from coinrun import setup_utils, policies, wrappers, random_ppo2
from coinrun.config import Config
def main():
... |
# -*- coding: utf-8 -*-
# https://docs.microsoft.com/de-de/windows/uwp/design/style/segoe-ui-symbol-font
from __future__ import absolute_import
from math import ceil
import bkt
from bkt.library.powerpoint import PPTSymbolsGallery
segoe_symbols = [
(u"\uE700", "Global Navigation Button"),
(u"\uE701", "Wifi... |
"""
WSGI config for mobile_app_33660 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJA... |
from rel import *
from physics import *
from physics import ek
from rel import ek as rel_ek
print(ek(100, 10), rel_ek(100, 10))
|
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# rai... |
from flask_wtf import FlaskForm
from wtforms import StringField, FloatField, DateField, SubmitField, BooleanField, HiddenField
from wtforms.validators import DataRequired
class MemberEnquiryForm(FlaskForm):
code = StringField('Code', render_kw={"placeholder": "Code", "readonly": "readonly"})
first_name = Strin... |
from machine import I2C, Timer, Pin
from ina219 import INA219
from board import SDA, SCL
from mqttclient import MQTTClient
from plotclient import PlotClient
from oledfeather import OledFeather, BUTTON_A, BUTTON_B, BUTTON_C
from button import Button
import time, binascii, os
butA = Button(Pin(BUTTON_A, mode=Pin.IN, pu... |
import json
import os
from paprika.repositories.DatasourceRepository import DatasourceRepository
from paprika.system.Finder import Finder
import paprika
class DatasourceBuilder:
def __init__(self):
pass
@staticmethod
def build(filename):
properties = dict()
properties['agent.dir']... |
import streamlit as st
from global_covid_tracker.site_components import page_header
from global_covid_tracker.pages import introduction, testing, cases, deaths, growth
def main():
page_header()
st.sidebar.subheader('Global COVID Tracker')
view = st.sidebar.radio('Which data would you like to explore?',
... |
from playAudio import playOne, playMultiple
from makeAudioFiles import getAudioFile
import speech_recognition as sr
import subprocess
def captureSpeech():
#MIC_NAME = "Microsoft® LifeCam HD-3000: USB Audio (hw:1,0)"
MIC_NAME = "Built-in Microphone"
keyword = "hey pie"
# Set the device ID of the mic th... |
import fnmatch
import re
from urllib.parse import urlparse
# Hardcoded URL patterns where client is assumed to be embedded.
#
# Only the hostname and path are included in the pattern. The path must be
# specified; use "example.com/*" to match all URLs on a particular domain.
#
# Patterns are shell-style wildcards ('*'... |
r"""!\file
\ingroup evolvers
Identity transform.
"""
from .transform import Transform
class Identity(Transform):
r"""! \ingroup evolvers
Identity transform that returns the input configuration unchanged.
"""
def forward(self, phi, actVal):
r"""!
%Transform a configuration from propo... |
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
import os
import sys
from setuptools import setup, find_packages
from tethys_apps.app_installation import custom_develop_command, custom_install_command
### Apps Definition ###
app_package = 'wps_tester'
release_package = 'tethysapp-' + app_package
app_class = 'wps_tester.app:WpsTester'
app_package_dir = os.path.join(... |
from __future__ import unicode_literals
from ...tokens import Doc
from ...vocab import Vocab
def test_issue1834():
"""test if sentence boundaries & parse/tag flags are not lost
during serialization
"""
words = "This is a first sentence . And another one".split()
vocab = Vocab()
doc ... |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Caian Benedicto <caian@ggaunicamp.com>
#
# 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... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import backquotes
spam = `'for i in "s" "p" "a" "m"; do printf $$i; done'`
print(`'printf $spam | tr [a-z] [A-Z]'`)
|
from netket import legacy as nk
import numpy as np
# 1D Lattice
g = nk.graph.Hypercube(length=20, n_dim=1, pbc=True)
# Hilbert space of spins on the graph
# with total Sz equal to 0
hi = nk.hilbert.Spin(s=1 / 2, N=g.n_nodes, total_sz=0)
# Heisenberg hamiltonian
ha = nk.operator.Heisenberg(hilbert=hi)
# Symmetric RB... |
# -*- coding: utf-8 -*-
import re
from django.contrib.sites.models import SITE_CACHE, Site
from django.utils.timezone import get_current_timezone_name
from django.utils.translation import force_text
from .compat.dj import is_installed
SITE_VAR = "site__exact"
def find_placeholder_relation(obj):
return 'page'
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import logging
import pytest
from flask import Blueprint, abort
from flask.signals import got_request_exception
from werkzeug.exceptions import HTTPException, BadRequest, NotFound, Aborter
from werkzeug.http import quote_etag, unquote_etag
... |
#!/usr/bin/env python3
# Copyright (c) 2016-2020 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 the bumpfee RPC.
Verifies that the bumpfee RPC creates replacement transactions successfully when... |
# !/usr/bin/python
#a script to read in filepath and tags from a csv
# for each file, calc a hash and drop is into a new directory while updating tags and filename.
# keep a hash dictionary, if there is a dup file, do not copy it.
from mp3_tagger import MP3File, VERSION_1, VERSION_2, VERSION_BOTH
import os
import sys... |
#
# 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... |
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'aggregate'
CALLBACK_NAME = 'other_callback'
def v2_playbook_on_play_start(self, play):
pass
def v2_runner_on_ok(self, result):
pass
|
#!/usr/bin/env python
"""tvnamer - Automagical TV episode renamer
Uses data from www.thetvdb.com (via tvdb_api) to rename TV episode files from
"some.show.name.s01e01.blah.avi" to "Some Show Name - [01x01] - The First.avi"
"""
__version__ = (2, 2, 1)
__author__ = "dbr/Ben"
|
"""Tools to ease model training (like torch.ignite)"""
import torch
import torch.nn.functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
from nitorch.core.utils import benchmark, fold, unfold, rubiks_shuffle
from nitorch.core.py import make_tuple
from nitorch.nn.modules import Module
from nitorch.nn ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 27 19:19:38 2021
@author: tjweber
"""
import argparse, csv
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
METRICS = ["accuracy", "Cohen_kappa", "F-beta score", "sensitivity"]
PARAMS = ["k"]... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, UTI and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestSESIONES(unittest.TestCase):
pass
|
load(
"@io_bazel_rules_go//go:deps.bzl",
"go_wrap_sdk",
)
load(
"//nixpkgs:nixpkgs.bzl",
"nixpkgs_package"
)
def nixpkgs_go_configure(
sdk_name = "go_sdk",
repository = None,
repositories = {},
nix_file = None,
nix_file_deps = None,
nix_file_content = None,
nixopts = []):
... |
import numpy as np
import fitsio
import os, fnmatch
import jinja2
from jinja2 import select_autoescape
import bokeh
import desimodel.io
from bokeh.embed import components
from bokeh.layouts import gridplot, layout
import bokeh.plotting as bk
from bokeh.models import ColumnDataSource
from bokeh.models import Panel, Ta... |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 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 the RPC call related to the uptime command.
Test corresponds to code in rpc/server.cpp.
"""
impo... |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, Email, ValidationError
from blog.models import Email
class EmailSubscriptionForm(FlaskForm):
email = StringField('Email', validators=[DataRequired()], render_kw={"placeholder": "Email..."})
... |
from django.urls import path
from .views import *
app_name = 'lecture'
urlpatterns = [
path('',index, name='index'),
path('empty_page/',empty_page, name='empty_page'),
path('input_video/',input_video,name='input_video'),
# vote url
path('index/', vote_index, name='vote_index'),
path('<int... |
import sys
sys.path.insert(0,'..')
import os
import importlib
import dogqc.dbio as io
import schema.tpch
import subprocess
import random
from dogqc.util import loadScript
# algebra types
from dogqc.relationalAlgebra import Context
from dogqc.relationalAlgebra import RelationalAlgebra
from dogqc.relationalAlgebra impor... |
# Generated by Django 3.2.6 on 2021-12-11 04:27
from django.db import migrations
import phonenumber_field.modelfields
class Migration(migrations.Migration):
dependencies = [
('member', '0008_auto_20211211_0301'),
]
operations = [
migrations.AlterField(
model_name='user',
... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.core.management import call_command
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from django.utils.unittest import expectedFailure
from django.utils.six import PY3, StringIO
if connection... |
# Japanese Language Test
from seleniumbase.translate.japanese import セレニウムテストケース # noqa
class 私のテストクラス(セレニウムテストケース):
def test_例1(self):
self.を開く("https://ja.wikipedia.org/wiki/")
self.テキストを確認する("ウィキペディア")
self.要素を確認する('[title="メインページに移動する"]')
self.入力("#searchInput", "アニメ")
... |
# Generated by Django 3.2.7 on 2021-10-17 19:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('story', '0006_alter_story_api_response'),
]
operations = [
migrations.AlterField(
model_name='story',
name='api_resp... |
import torch
from all.core import State, StateArray
from ._body import Body
class FrameStack(Body):
def __init__(self, agent, size=4, lazy=False):
super().__init__(agent)
self._frames = []
self._size = size
self._lazy = lazy
self._to_cache = TensorDeviceCache()
def pro... |
# flake8: noqa
from .label import NormalLabel, EmphasisLabel
from .line import Line
from .axis import XAxisLabel, YAxisLabel, XAxis, YAxis
from .tooltip import Tooltip
|
import numpy as np
import pandas as pd
from pandas.plotting import parallel_coordinates
import matplotlib.pyplot as plt
import seaborn as sns
import json
import matplotlib.colors as mcolors
from matplotlib import cm
plt.style.use(['science', 'no-latex', 'grid', "ieee", 'muted'])
# %%
df = pd.read_csv("results_more.c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
flask 实现文件上传
"""
import os
from flask import Flask, request, redirect, url_for
from flask import send_from_directory
from werkzeug import secure_filename
from werkzeug import SharedDataMiddleware
UPLOAD_FOLDER = r'C:\\'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', '... |
__VERSION__ = "3.0.0"
|
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey('auth.user')
title = models.CharField(max_length=256)
text = models.TextField()
created_date = models.DateTimeField(default=timezone.now)
published_date = models.DateTimeField(blank=... |
from common import BaseRandom
from lab1 import BrvRandom
class FuncRandom(BaseRandom):
def __init__(self, seed, rand_class=BrvRandom):
super(FuncRandom, self).__init__(seed)
self._rand_obj = rand_class(seed)
@property
def rand_obj(self):
return self._rand_obj
def func(self)... |
import matplotlib.pyplot as plt
import random
from math import *
import Replymsg
import os
from mpl_toolkits.mplot3d import Axes3D
# 几个非线性函数
# 形式:(d/dt)^2x+a*(d/dt)x+sum(kn*x^n)+b*cos(c*x)
# 取值 -1<=a,kn,γ,b<=1 x=1,y=1 steps=0.002,times=200
def duffing_gain():
try:
x_l = []
y_l = []
... |
animal_adjectives = [
'agile',
'bashful',
'clever',
'clumsy',
'drowsy',
'fearful',
'graceful',
'hungry',
'lonely',
'morose',
'placid',
'ruthless',
'silent',
'thoughtful',
'vapid',
'weary'
]
animal_colours = [
'beige',
'black',
'blue',
'bri... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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 requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.