content stringlengths 5 1.05M |
|---|
from django.apps import AppConfig
class LearningRestFrameworkConfig(AppConfig):
name = 'learning_rest_framework'
|
import PySimpleGUI as sg
import os.path
import const
import sysSettings
sg.theme("SystemDefaultForReal")
sg.set_options(button_color=('#000000','#cecece'), auto_size_buttons=False, button_element_size=(10,1))
# noinspection PySimplifyBooleanCheck
def popCharge(batteryLevel=20, currentLimit=16, file=const.C_DEF... |
import sys
import struct
import time
from i2cdriver import I2CDriver, EDS
if __name__ == '__main__':
i2 = I2CDriver(sys.argv[1])
d = EDS.Magnet(i2)
while 1:
print(d.measurement())
|
# Copyright (c) 2021 Zenqi
# 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, copy, modify, merge, publi... |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
' a test module ' # 表示模块的文档注释,任何模块代码的第一个字符串都被视为模块的文档注释
__author__ = 'yang' # 使用__author__变量把作者写进去,这样当你公开源代码后别人就可以瞻仰你的大名;
# from LYFibonacci import module1, module2
from collections import * # 这提供了一个简单的方法来导入一个模块中的所有项目。然而这种声明不该被过多地使用。
# import ly_sum
# from ly_sum import s... |
from REST_WebFramework import core, http
class RequestValidator:
def get_response_or_none (request):
scheme = request['header']['scheme']
method = request['header']['method']
host = request['header']['Host']
port = int(request['header']['Port'])
if (scheme != core.configuration... |
# -*- coding:utf-8 -*-
from enum import Enum
def get_enum(enumclass: Enum, value) -> Enum:
for en in enumclass:
if en.value == value:
return en
return None
class ColorTableType(Enum):
GLOBAL = 1
LOCAL = 2
class BlockType(Enum):
EXTENTION = 0x21
IMAGE_DESC = 0x2C
E... |
from armulator.armv6.opcodes.abstract_opcodes.stm_user_registers import StmUserRegisters
from armulator.armv6.opcodes.opcode import Opcode
class StmUserRegistersA1(StmUserRegisters, Opcode):
def __init__(self, instruction, increment, word_higher, registers, n):
Opcode.__init__(self, instruction)
S... |
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class BucketsNotPublic(BaseResourceCheck):
def __init__(self):
name = "Bucket should not be public"
id = "CKV_GCP_997"
supported_resource... |
import itertools
import pytest
import requests_cache
class DumbConnection(object):
def __init__(self, parent):
self.parent = parent
def close(self):
self.parent.close()
class DumbCachedSession(requests_cache.CachedSession):
"""
Spotipy calls connection.close() after an API request
... |
from datetime import datetime
'''
from app import db
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.String, nullable=False, primary_key=True)
created = db.Column(db.DateTime, default=datetime.utcnow, nullable=False)
updated = db.Column(db.DateTime, default=datetime.utcnow, nullable=F... |
import marshmallow
class BaseSchema(marshmallow.Schema):
class Meta:
unknown = marshmallow.EXCLUDE
|
from . import test_audio
from . import test_dataframe
from . import test_dataframe
|
from skyfield.api import Topos, load
from skyfield.constants import ERAD
from skyfield.framelib import itrs, true_equator_and_equinox_of_date
from skyfield.positionlib import Geocentric
def test_frame_rotation():
# Does a frame's rotation and twist get applied in the right
# directions? Let's test whether the... |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 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... |
import dropbox
class transferData:
def __init__(self,access_token):
self.access_token = access_token
def uploadfiles(self,filefrom,fileto):
dbx = dropbox.Dropbox(self.access_token)
f = open (filefrom,"rb")
dbx.files_upload(f.read(),fileto)
def main():
access_token="s... |
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from users.validators import validate_facebook_url
class OwnerProfile(AbstractUser):
is_information_confirmed = models.BooleanField(default=False)
facebook = models.URLField(max_lengt... |
from discord.ext import commands
from apscheduler.schedulers.asyncio import AsyncIOScheduler
import asyncio
import datetime
class Break(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.scheduler= AsyncIOScheduler({'apscheduler.timezone': 'Europe/Helsinki'})
self.scheduler.start... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
#!/usr/bin/env python
import os
import os.path
import zipfile
configs_zip_name = 'Configs.zip'
script_dir = os.getcwd() #os.path.dirname(os.path.realpath(__file__))
exclude_files = ['idchecker.py', 'genconfigszip.py', 'blockids.py', 'biomeids.py', 'itemids.py', configs_zip_name]
exclude_dirs = ['options_gen']
dircon... |
from torch.utils.data import Dataset # 데이터로더
from kogpt2.utils import download, tokenizer, get_tokenizer
from gluonnlp.data import SentencepieceTokenizer
import gluonnlp
import numpy as np
def sentencePieceTokenizer():
tok_path = get_tokenizer()
sentencepieceTokenizer = SentencepieceTokenizer(tok_path)
return ... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: prediction_service.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflectio... |
import numpy as np
def orthoTrans(params, trans, etc):
"""
This function uses principal component analysis to modify parameter values.
Parameters
----------
params: Array of params to be modified, length is npars for 1D
If 2D, shape is npars x nsteps
invtrans: Inverse tr... |
"""Test simple stdout (and stderr) hookup in spawning a child process."""
import os
import sys
import time
import pprint
import unittest
import process
class RetvalTestCase(unittest.TestCase):
def _assertRetvalIs(self, expected, actual):
if sys.platform.startswith("win"):
self.failUnless(act... |
#!/usr/bin/python
#===============================================================================
#
# FILE: sevcleanup.py
#
# USAGE: sevcleanup.py [--ef fermi_level] aims_dir(s) > STDOUT
#
# DESCRIPTION: Takes "Sorted_Eigenvalues.dat" file and sums it up such that each
# energy ... |
import pyautogui as py
import time
import random
py.FAILSAFE = True
#indefinite loop MAKE SURE FAILSAFE IS ON /
#end of script is "x += 1"
x = 1
while True:
#drop inventory
#row 1
py.moveTo(1643, 615, duration=.44)
py.PAUSE = .2
py.keyDown('shift')
py.PAUSE
py.click(button='left')
py.keyUp('... |
from .pygoko import CoverTree, PyBayesCovertree
__all__ = ["CoverTree", "PyBayesCovertree"]
|
def sol():
N = 3
mal = ["E", "A", "B", "C", "D"]
while N:
N -= 1
yut = list(map(int, input().split()))
num_of_zero = yut.count(0)
print(mal[num_of_zero])
if __name__ == "__main__":
sol()
|
import spacy
from markovconstraints.markov_chain import MarkovProcess, parse_sequences
from markovconstraints.suffix_tree import get_suffix_tree
from datetime import datetime
from random import shuffle
import pickle
nlp = spacy.load("en_core_web_md")
def get_similarity(w1, w2):
return nlp.vocab[w1.lower()].simi... |
# -*- coding=utf-8
# SCSD-PY001
# hi-windom/ColorThemeAnalyse
# https://gitee.com/hi-windom/color-theme-analyse
'''
# ---------------------------------
# 创建于 2021-7-20
# 更新于 2021-7-20 02:08:57
# ---------------------------------
# Need help ? => [email protected]
# ---------------------------------
# 作者很懒,还没想... |
import pytest
from minus80 import Accession
from minus80 import Cohort
from minus80 import CloudData
from minus80.Tools import *
@pytest.fixture(scope='module')
def simpleCloudData():
return CloudData()
@pytest.fixture(scope='module')
def simpleAccession():
# Create a simple Accession
return Accession(... |
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2012 Isaku Yamahata <yamahata at valinux co jp>
#
# 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://... |
import hek
# stop monitor mode
result = hek.net.monitor_stop(name="wlan0mon")
# Output
print(result) |
#!/usr/bin/env python3
# Copyright (C) 2019-2021 All rights reserved.
# FILENAME: middleware.py
# VERSION: 0.0.1
# CREATED: 2021-08-31 16:10
# AUTHOR: Aekasitt Guruvanich <[email protected]>
# DESCRIPTION:
#
# HISTORY:
#*************************************************************
### Third-Party Packages ###
from ... |
import unittest
import url_decoder
from url_decoder_test import UrlDecoderTestCase
from url_decoder_github import GitHubRepositoryUrlDecoder, GitHubCommitUrlDecoder, GitHubGistUrlDecoder
class _GitHubTestClient:
def __init__(self):
self.get_repository_args = []
self.get_commit_args = []
def _get_reposit... |
#!/usr/bin/env
import logging
_LOG = logging.getLogger(__name__)
def error_return(msg):
_LOG.debug(msg)
return False
VERSION = '0.0.4a'
class SeverityCodes(object):
"""An enum of Warning/Error severity."""
ERROR, WARNING = range(2)
facets = ['ERROR', 'WARNING']
numeric_codes_registered = ... |
class Stacks:
def __init__(self):
self._stack = []
def is_empty(self) -> bool:
if self._stack is None:
return True
else:
return False
def pop(self) -> None:
self._stack.pop()
def push(self, g) -> None:
self._stack.a... |
import numpy as np
import os
from PIL import Image
def read_image(path):
"""Reads an image located at `path` into an array.
Arguments:
path (str): Path to a valid image file in the filesystem.
Returns:
`numpy.ndarray` of size `(height, width, channels)`.
"""
full_path = os.path.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module contains various experimental environments used for testing
human behavior.
Created on Thu Feb 22 14:50:01 2018
@author: Dimitrije Markovic
"""
import torch
from torch import zeros, ones
from torch.distributions import Categorical, Multinomial, Dirichle... |
for i in range(1, 10000):
for j in range(2, i//2):
if (i % j == 0):
break
else:
print(i)
|
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the duecredit package for the
# copyright and license terms.
#
# ## ### ... |
## API for testing matrix instructions of core - MVM-f/b/d, CRS - with one matrix per core only
## Set config file to following IMA hyperparameters
#xbar_bits = 2
#num_matrix = 1 # each matrix is 8-fw xbars, 8-bw xbars and 16-delta xbars
#xbar_size = 128
#dac_res = 1
#adc_res = 8
#num_adc = 2 * num_matrix
#num_ALU = 1
... |
# -*- coding: utf-8 -*-
"""
Datalog extraction tool using VISA for Agilent 34410A Digital Multimeter
Matthew Sharpe 10-12-18
"""
import sys
import xlsxwriter
import visa
rm = visa.ResourceManager()
inst = rm.list_resources()
picked = 'x'
clear = ''
deviceDict = {}
#build device dictionary
for item in in... |
import platform
import pickle
import os
import numpy as np
def load_pickle(f):
version = platform.python_version_tuple()
if version[0] == '2':
return pickle.load(f)
elif version[0] == '3':
return pickle.load(f, encoding='latin1')
raise ValueError('invalid python version: {}'.format(ver... |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes 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
#
# Unle... |
from mc2p import MC2PClient as MC2PClientPython
__title__ = 'MyChoice2Pay Django'
__version__ = '0.1.3'
__author__ = 'MyChoice2Pay'
__license__ = 'BSD 2-Clause'
__copyright__ = 'Copyright 2017 MyChoice2Pay'
# Version synonym
VERSION = __version__
# Header encoding (see RFC5987)
HTTP_HEADER_ENCODING = 'iso-8859-1'
... |
"""API Discovery api.
The AXIS API Discovery service makes it possible to retrieve information about APIs supported on their products.
"""
import attr
from .api import APIItem, APIItems, Body
URL = "/axis-cgi/apidiscovery.cgi"
API_DISCOVERY_ID = "api-discovery"
API_VERSION = "1.0"
class ApiDiscovery(APIItems):
... |
import unittest
import os
import mock
import handler as sut
class TestHomeRequestWithNoPermission(unittest.TestCase):
def setUp(self):
os.environ['SKILL_ID'] = "TEST_SKILL_ID"
self.context = {
}
self.event = {
'session': {
'sessionId': 'unittest',
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from tap.problemae.solucion import puede_hallar_secuencia
class TestProblemaE:
def test_puede_hallar_secuencia(self):
assert puede_hallar_secuencia(
[(3, 2), (3, 1), (2, 1)]
) == 'S'
assert puede_hallar_secuencia... |
import xarray as xr
import panel as pn
from xrviz.dashboard import Dashboard, find_cmap_limits
import pytest
from . import data
from ..utils import _is_coord
from ..compatibility import has_cartopy, has_crick_tdigest
@pytest.fixture(scope='module')
def dashboard(data):
return Dashboard(data)
@pytest.fixture(sco... |
from flask import Blueprint, jsonify, request
from project.api.models import User
users_blueprint = Blueprint('users', __name__, template_folder='./templates')
@users_blueprint.route('/users/ping', methods=['GET'])
def ping_pong():
return jsonify({
'status': 'success',
'message': 'pong!'
})... |
import dtcv
import matplotlib.pyplot as plt
import numpy as np
from shapely import wkt
def grid_shape(i, max_x=4):
"""Return a good grid shape, in x,y, for a number if items i"""
from math import sqrt, ceil
x = round(sqrt(i))
if x > max_x:
x = max_x
y = ceil(i / x)
return x, y
def ... |
import torch
from torchvision import models, datasets, transforms
from torch import nn, optim
import torch.nn.functional as F
from workspace_utils import active_session
import argparse
from load_and_preprocess_data import load_preprocess_data
from PIL import Image
import numpy as np
import json
# Create the parser
my... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'conversion_dialog.ui'
#
# Created: Wed Oct 3 15:38:47 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_conversi... |
from unittest import TestCase
import responses
from tamr_unify_client import Client
from tamr_unify_client.auth import UsernamePasswordAuth
from tamr_unify_client.models.attribute_configuration.collection import (
AttributeConfigurationCollection,
)
class TestAttributeConfigurationCollection(TestCase):
def ... |
import multiprocessing
import threading
import traceback
from daphne.testing import _reinstall_reactor
from pytest_django.plugin import _blocking_manager
class DaphneThread(threading.Thread):
def __init__(self, host, application, kwargs=None, setup=None, teardown=None):
super().__init__()
self.ho... |
from . import client, aioclient, parse
__all__ = [
'client',
'aioclient',
'parse'
]
|
# -*- coding: utf-8 -*-
"""
Created on Tue May 25 14:03:27 2021
@author: asus
"""
import pandas as pd
import streamlit as st
from sklearn.linear_model import LogisticRegression
from pickle import dump
from pickle import load
st.title('Model Deployment: Logistic Regression')
st.title("authour-prathames... |
import json
import hmac
import hashlib
from quart import url_for
from ecdsa import SECP256k1, SigningKey # type: ignore
from lnurl import encode as lnurl_encode # type: ignore
from typing import List, NamedTuple, Optional, Dict
from sqlite3 import Row
from lnbits.settings import WALLET
class User(NamedTuple):
... |
from lib import actions
__all__ = [
'GetNetworkDomainByNameAction',
]
class GetNetworkDomainByNameAction(actions.BaseAction):
def run(self, region, network_domain_name):
driver = self._get_compute_driver(region)
networkdomains = driver.ex_list_network_domains()
networkdomain = list(f... |
#!/usr/bin/env python
import argparse
import json
import sys
import os
try:
from osmgeocoder import Geocoder
except ImportError:
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from osmgeocoder import Geocoder
parser = argparse.ArgumentParser(description='OSM Address sear... |
from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import url, include
from custom.aaa.views import (
AggregationScriptPage,
LocationFilterAPI,
ProgramOverviewReport,
ProgramOverviewReportAPI,
UnifiedBeneficiaryReport,
UnifiedBeneficiaryReportAP... |
countries[countries['capital'].str.len() > 7] |
from dagster import pipeline, solid, execute_pipeline, LocalFileHandle
from dagster.core.storage.file_manager import local_file_manager
from dagster.utils.temp_file import get_temp_dir, get_temp_file_handle_with_data
def test_basic_file_manager_copy_handle_to_local_temp():
foo_data = 'foo'.encode()
with get_t... |
"""Tests of classes that represent NEI models"""
|
def fib_list(max):
nums = []
a, b = 0, 1
while len(nums) < max:
nums.append(b)
a, b = b, a + b
return nums
def fib_gen(max):
count = 0
a, b = 0, 1
while count < max:
yield b
a, b = b, a + b
count += 1
for n in fib_list(10000):
print(n... |
# from .derivative import Derivative
from .checkerboard import Checkerboard
# from .structuralFeatures import StructuralFeatures
# from .olda import OLDA |
import pygame
import random
from algorithms import rectangles
from algorithms import bubble_sort
from algorithms import quick_sort
from algorithms import heap_sort
from algorithms import merge_sort
from algorithms import selection_sort
from algorithms import insertion_sort
from algorithms import timsort
from algorithms... |
from typing import List, Optional
from .EditorCommon import ComponentSpec
# noinspection PyUnreachableCode
if False:
# noinspection PyUnresolvedReferences
from _stubs import *
class EditorViews:
def __init__(self, ownerComp):
self.ownerComp = ownerComp # type: COMP
self.customHolder = ownerComp.op('customView... |
import os
analysis_process_path = os.path.join(
os.path.dirname(__file__),
"analysis_process/14438140-4f0f-4dd8-b9c4-00212f112a99_2021-05-24T12:00:00.000000Z.json",
)
analysis_protocol_path = os.path.join(
os.path.dirname(__file__),
"analysis_protocol/61223a2e-a775-53f4-8aab-fc3b4ef88722_2021-05-24T12... |
# -*- coding:utf-8 -*-
from imutils.perspective import four_point_transform
from imutils import contours
import numpy as np
import imutils
import cv2 as cv
ANSWER_KEY_SCORE = {0: 1, 1: 4, 2: 0, 3: 3, 4: 1}
ANSWER_KEY = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E"}
# 加载一个图片到opencv中
img = cv.imread('E:\\tmp\\t1.png')
cv... |
from django.contrib import admin
from .models import Chat, Message
admin.site.register(Chat)
admin.site.register(Message)
|
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLe... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cms.utils import get_current_site
from cms.utils.page import get_page_from_path
from django.core.urlresolvers import reverse
from filer.models.imagemodels import Image
from rest_framework import serializers
class CMSPagesField(serializers.Field):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" ib.ext.cfg.EWrapperMsgGenerator -> config module for EWrapperMsgGenerator.java.
"""
from java2python.config.default import modulePrologueHandlers
modulePrologueHandlers += [
'from ib.ext.AnyWrapperMsgGenerator import AnyWrapperMsgGenerator',
'from ib.ext.EClien... |
from tests_utils.abstract_model_test_mixin import AbstractModelTestMixin
from stack_it.contents.abstracts import ModelBaseContentMixin
from stack_it.models import Page
class ModelBaseContentMixinUnitTest(AbstractModelTestMixin):
"""
Testing ModelBaseContentMixin
Model is created by AbstractModelTestMixin... |
from django.http import HttpResponse
from rest_framework_tracking.mixins import LoggingMixin
from app.views import AnonymousAPIView
from tinkoff.api.serializers import PaymentNotificationSerializer
class TinkoffPaymentNotificationsView(LoggingMixin, AnonymousAPIView):
def post(self, request, *args, **kwargs):
... |
import numpy as np
from htm_rl.envs.biogwlab.environment import Environment
from htm_rl.envs.biogwlab.generation.food import FoodPositionsGenerator, FoodPositions, FoodPositionsManual
from htm_rl.envs.biogwlab.module import Entity, EntityType
from htm_rl.envs.biogwlab.view_clipper import ViewClip
def add_food(env, t... |
import requests
from uuid import UUID
# Version: 0.0.1
class AuthorityCredentialsGetter():
"""
All calls to your Aerobridge instance requires credentials from a oauth server, in this case this is Flight Passport OAUTH server, this class gets the token and the associated public key.
...
Attributes
----------
cli... |
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as T
import torchvision.transforms.functional as TF
import clip
class CLIPLoss:
def __init__(self, device, name='ViT-B/16'):
self.device = device
self.name = name
self.clip_model... |
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import render
from .forms import ProductModelForm
from products.models import Product
# # This is the WRON... |
# *****************************************************************
# (C) Copyright IBM Corp. 2020, 2021. 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://w... |
import argparse
import os
import shutil
import numpy as np
import torch
from trixi.util import Config, GridSearch
def check_attributes(object_, attributes):
missing = []
for attr in attributes:
if not hasattr(object_, attr):
missing.append(attr)
if len(missing) > 0:
return Fal... |
from transducer._util import UNSET
from transducer.infrastructure import Reduced
# Transducible processes
def transduce(transducer, reducer, iterable, init=UNSET):
r = transducer(reducer)
accumulator = r.initial() if init is UNSET else init
for item in iterable:
accumulator = r.step(accumulator, ... |
# -*- coding: utf-8 -*-
description = 'Setup for the Saphire Filter in primary beam'
includes = ['monoturm']
group = 'optional'
devices = dict(
saph_mot = device('nicos.devices.vendor.ipc.Motor',
description = 'Motor to move the saphire filter',
bus = 'bus5',
# addr = 66, #old rack, old ... |
from .application import *
from .static import *
from .database import *
from .auth import *
|
import os
from pathlib import Path
# import dbl
from dotenv import load_dotenv
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from apollo import *
from apollo.checks import *
from apollo.commands import *
from apollo.embeds import *
from apollo.events import *
from apollo.input import *
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 15 14:42:15 2019
@author: Zhiyu Ye
Email: [email protected]
In London, the United Kingdom
"""
import os
import json
import cv2
import numpy as np
from PIL import Image
from tools.sub_masks_annotations import create_sub_masks, create_sub_mask_an... |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sys.exit()
# Hackishly synchronize the version.
version = r"0.1.0"
setup(
name="EchelleJSON",
version=version,
author="Ian Czekala",
author_email="i... |
"""Tests for neurodocker.interfaces.FreeSurfer"""
from neurodocker.interfaces.tests import utils
class TestFreeSurfer(object):
def test_docker(self):
specs = {
'pkg_manager': 'apt',
'instructions': [
('base', 'ubuntu:16.04'),
('freesurfer', {'versi... |
from django.contrib import admin
from events.models import Event, Attendance
admin.site.register(Event)
admin.site.register(Attendance) |
r"""
Poisson equation with source term.
Find :math:`u` such that:
.. math::
\int_{\Omega} c \nabla v \cdot \nabla u
= - \int_{\Omega_L} b v = - \int_{\Omega_L} f v p
\;, \quad \forall v \;,
where :math:`b(x) = f(x) p(x)`, :math:`p` is a given FE field and :math:`f` is
a given general function of space.
... |
from __future__ import absolute_import
import pytest
from django.test.utils import override_settings
from tests.testapp.models import Thing
pytestmark = pytest.mark.django_db
def test_simple_query(client, caplog):
client.get('/test_orm_create/', HTTP_X_REQUEST_ID='foo')
assert ' -- request_id=foo' in caplog... |
import pytest
from pincell import config as pincell_config
def pytest_addoption(parser):
parser.addoption('--exe')
parser.addoption('--build-inputs', action='store_true')
def pytest_configure(config):
opts = ['exe', 'build_inputs']
for opt in opts:
if config.getoption(opt) is not None:
... |
from classes.map_class import Map
from unittest import TestCase
class TestMap(TestCase):
def setUp(self):
self.map_object = Map(['link1', 'link2', 'link3'])
def tearDown(self):
self.setUp()
|
a = int(input())
b = int(input())
c = int(input())
n = int(input())
d = max((a+1)//2, b, c)
m = 4*d-a-b-c
if n < m:
print(0)
exit(0)
w = (n-m)//4
print(2*d - a + 2*w)
print(d - b + w)
print(d - c + w)
|
import flopy.mt3d as mt
class GcgAdapter:
_data = None
def __init__(self, data):
self._data = data
def validate(self):
# should be implemented
# for key in content:
# do something
# return some hints
pass
def is_valid(self):
# should be im... |
import numpy as np
from matplotlib import patches
from common.world import World
from pursuit.agents.ad_hoc.adhoc import AdhocAgent, ACTIONS
from pursuit.agents.handcoded.teammate_aware import TeammateAwareAgent
from pursuit.reward import get_reward_function
from pursuit.state import PursuitState
from pursuit.transiti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Yizhong
# created_at: 07/25/2017 上午10:33
import tensorflow as tf
import tensorflow.contrib as tc
def rnn(rnn_type, inputs, length, hidden_size, layer_num=1, dropout_keep_prob=None, concat=True):
if not rnn_type.startswith('bi'):
cell = get_cell(rnn_... |
'''
Created on Jan 5, 2020
@author: ballance
'''
from pyucis.source_file import SourceFile
class StatementId():
def __init__(self, file : SourceFile, line : int, item : int):
self.file = file
self.line = line
self.item = item
def getFile(self) -> SourceFile:
retur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.