content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace.library
@dace.library.environment
class OpenBLAS:
cmake_minimum_version = "3.6"
cmake_packages = ["BLAS"]
cmake_variables = {"BLA_VENDOR": "OpenBLAS"}
cmake_includes = [] # For some reason, FindBLAS does not find... | python |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @auther:FelixFu
# @Date: 2021.10.1
# @github:https://github.com/felixfu520
from loguru import logger
import torch.multiprocessing
from core.modules.register import Registers
from core.modules.dataloaders.augments import get_transformer
from core.modules.dataloaders.util... | python |
# Generated by Django 3.1.6 on 2021-02-09 19:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dog_shelters', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='dog',
name='adoption_date',
... | python |
import click
from ranger_cli.utils import CONTEXT_SETTINGS
from ranger_cli.policy.commands import policy
from ranger_cli.service.commands import service
from ranger_cli.configure.commands import configure
from ranger_cli.servicedef.commands import servicedef
from ranger_cli.plugins.commands import plugins
from ranger_... | python |
import numpy as np
class Display:
def __init__(self, parent=None):
self.parent = parent
def raw_image(self, data):
_view = self.parent.ui.raw_image_view.getView()
_view_box = _view.getViewBox()
_state = _view_box.getState()
self.parent.state_of_raw = _state
... | python |
"""This files contains the tests for `main.py`."""
from unittest import TestCase
from PROJECT_NAME_UNS.main import main
def test_main():
assert main() == 0
class TestMain(TestCase):
def test_main(self):
assert main() == 0
| python |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import re
import json
import copy
from svtplay_dl.service import Service, OpenGraphThumbMixin
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.rtmp import RTMP
from svtplay_d... | python |
import io
import json
import asyncio
import gitlab.v4.objects as gl_objects
import urllib.parse
from aiohttp import ClientSession
class AioGitlab(object):
def __init__(self, gl, gitlab_url, gitlab_token):
self._gitlab_url = gitlab_url
self._gitlab_token = gitlab_token
self._gl = gl
de... | python |
import time
import logging
from math import floor
from os.path import getsize
from dtest import Tester
logger = logging.getLogger(__name__)
class TestSSTableSplit(Tester):
def test_split(self):
"""
Check that after running compaction, sstablessplit can succesfully split
The resultant s... | python |
# Copyright (C) 2019 YouCompleteMe contributors
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) ... | python |
import pytest
def test_announce_routes(fib_t0):
"""Simple test case that utilize fib_t0 to announce route in order to a newly setup test bed receive
BGP routes from remote devices
"""
assert(True)
| python |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from abc import ABCMeta, abstractmethod
# base implementation of state pattern
# 允许对象在内部状态改变时改变它的行为, 对象看起来好像修改了它的类.
# 当控制一个对象的状态转换的条件表达式过于复杂时,把状态的判断逻辑转移到表示不同状态的一系列类当中,可以把复杂的判断逻辑简化
# (当一个对象的行为取决于它的状态,并且它必须在运行时刻根据状态改变他的行为)... | python |
from bullets.portfolio import *
| python |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 13:49:48 2018
@author: 754672
"""
import numpy as np
import h5py
import os
from sklearn.preprocessing import StandardScaler
#load MIPAS files
def calculate_ci(x):
return x[137]/x[138]
# function to calculate the NI
def calculate_ni(x):
... | python |
import lxml.html
import urllib2
import re
import random
import time
from pushbullet import PushBullet
from time import sleep
import config
pb_api_key = config.pb_api_key
user_agent = config.user_agent
n6_gb_url = 'https://play.google.com/store/devices/details/Nexus_6_64GB_Cloud_White?id=nexus_6_white_64gb'
items = {
... | python |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... | python |
def task1():
c = 0
while 1:
try:
x = int(input())
except EOFError:
break
c += x // 3 - 2
return c
def task2():
c = 0
while 1:
try:
x = int(input())
except EOFError:
break
while x >= 6:
... | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pprint import pprint as pp
import sys
import os
import re
# merging two source directories into one
BASE1 = u'/apps/content/raw_files/UCM/LIJA'
BASE2 = u'/apps/content/raw_files/UCM/LIJA-no md/'
BASE3 = u'/apps/content/new_path/UCM/LIJA'
def main(argv=None):
fi... | python |
# coding: utf-8
"""
license:MIT
Copyright (c) 2016 DKZ
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... | python |
import sys
import os.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from kep_determination import lamberts_kalman
import numpy as np
import pytest
from numpy.testing import assert_array_equal
# The first test checks the fact that if we give to the kalman filter three ide... | python |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# 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:
#
# ... | python |
# Copyright 2017 ICON Foundation
#
# 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 writi... | python |
from win10toast import ToastNotifier
import pathlib
from backup import recompile
from utils import check_space_availability
def show_toast_task(title, message, path_image):
toaster = ToastNotifier()
toaster.show_toast(title,
message,
duration=10, icon_path=path_im... | python |
from rest_framework.urls import path
from rest_framework.routers import DefaultRouter
from .views import (
DecoratedTokenObtainPairView,
DecoratedTokenRefreshView,
UserViewSet,
FeedbackViewSet,
DashNewsViewSet,
)
router = DefaultRouter()
router.register(r'users', UserViewSet, basename='users')
rout... | python |
# Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
from fusesoc.capi2.generator import Generator
class MacroGenerator(Generator):
def run(self):
assert self.config["filename"]
self.add_files([self.config["fi... | python |
import datetime
from playhouse.test_utils import test_database
from peewee import *
from archive_db.models.Model import Archive, Upload, Verification, Removal, init_db
from archive_db.app import routes
from tornado.web import Application
from tornado.escape import json_encode, json_decode
from tornado.testing import... | python |
from math import sqrt
import argparse
import musicpd
def wilson_lower_bound(likes, dislikes, z=1.44):
total = likes + dislikes
if total < 1:
return 0
likes_rel = likes / total
denominator = 1 + z**2/total
centre_adjusted_probability = likes_rel + z*z / (2*total)
adjusted_standard_devia... | python |
##===============================================================================
# This file is part of TEMPy.
# It implements a genetic algorithm for the purpose of fitting multiple component into the assembly map
#
# TEMPy is a software designed to help the user in the manipulation
# and analys... | python |
from pypy.interpreter.gateway import unwrap_spec
from pypy.interpreter.pyparser import pygram
@unwrap_spec(tok=int)
def isterminal(space, tok):
return space.newbool(tok < 256)
@unwrap_spec(tok=int)
def isnonterminal(space, tok):
return space.newbool(tok >= 256)
@unwrap_spec(tok=int)
def iseof(space, tok):
... | python |
from .interface import Mmams
| python |
""" Faça um programa que leia o sexo de uma pessoa, mas só aceita os valores 'M' e 'F'. Caso esteja errado,
peça a digitação novamente até ter um valor correto. """
sexo = ''
while sexo != 'M' and sexo != 'F':
sexo = str(input('Digite seu sexo:[M]|[F]? ').strip().upper()[0])
print('OK')
| python |
#!/usr/bin/env python
########################################################################
##
## File:
## Author:
## Email:
## File Description:
##
## Ref: https://docs.python.org/2/library/xml.etree.elementtree.html
##
## Created: 4/07/2016
## Last Modified: 4/07/2016
##
#######################################... | python |
from string import Template
from graphene.test import Client
from django.test import TestCase
from virtualization.models import ClusterType
from netbox_graphql.schema import schema
from netbox_graphql.tests.utils import obj_to_global_id
from netbox_graphql.tests.factories.virtualization_factories import ClusterType... | python |
__all__: object = ['ImageRepositoryBase', 'S3ImageRepository', 'FSImageRepository', 'ImageRepositoryFactory']
| python |
import torch
from torchvision.models import vgg16
from .ops.deform_v2 import DCN
class VGG16(object):
def __init__(self, dilation=[1, 1, 1], fix_block1_2=True):
"""
Initializes a vgg16 network and extracts the backbone and classifier.
:param dilation: Integer. The dilation to use.
:param fix_block1_2: Bool.... | python |
# -*- coding=utf-8
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
from qcloud_cos import CosServiceError
from qcloud_cos import CosClientError
secret_id = 'COS_SECRETID' # 替换为用户的secret_id
secret_key = 'COS_SECRETKEY' # 替换为用户的secret_key
region = 'COS_REGION' # 替换为用户的region
token = None ... | python |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jeff Byrnes
# Based on SublimeLinter-rubocop, written by Aparajita Fishman
# Contributors: Francis Gulotta, Josh Hagins, Mark Haylock
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Apa... | python |
# Copyright 2014 Diamond Light Source 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 t... | python |
# Copyright (c) 2006-2012 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP software distribution.
#
# The ASKAP software distribution is free so... | python |
import numpy as np
import pandas as pd
from .BaseMatrix import BaseMatrix
class SudarshanIyengar(BaseMatrix):
''' Calculates Vulnerability Index using Sudarshan & Iyengar's method (1982)
Attributes:
df (DataFrame) takes a pandas dataframe containing Vulnerability Indicators for given ... | python |
from django.utils.text import slugify
def overlap_percent(geom1, geom2):
# How much of the area of geom2 is also inside geom1
# (expressed as a percentage)
g1 = geom1.transform(27700, clone=True)
g2 = geom2.transform(27700, clone=True)
intersection = g1.intersection(g2)
return (intersection.ar... | python |
"""
Imports all the useful stuff
"""
from .definitions import (
VicarEnum,
SystemLabel,
SpecialLabel,
NumberFormat,
IntFormat,
RealFormat,
DataType,
DataOrg
)
from .definitions import isRealFormat, isIntFormat, getSystemTypes, LABEL_ENCODING
from .types import *
| python |
# An attempt at a WaveToy using the NRPy+ infrastructure
# TODO: Parity on grid functions
import os, re
from datetime import date
from sympy import symbols, Function, diff
import grid
import NRPy_param_funcs as par
import finite_difference as fin
from outputC import indent_Ccode, add_to_Cfunction_dict, outCfunction, c... | python |
import sys
sys.path.append("../")
import Utilities
import plots
import numpy as np
import streamlit as st
from hydralit import HydraHeadApp
class TrajClass(HydraHeadApp):
def __init__(
self,
data,
how_speed,
geometry_wall,
transitions,
geominX,
geomaxX,
... | python |
from cloud.permission import Permission, NeedPermission
# Define the input output format of the function.
# This information is used when creating the *SDK*.
info = {
'input_format': {
'start_key?': 'str',
'limit?': 'int',
'show_system_user?': 'bool',
'query?': 'list'
},
'o... | python |
import unittest
from ascetic.databases import databases
from ascetic.mappers import Mapper, mapper_registry
from ascetic.contrib.tree import MpMapper, MpModel
Location = None
class TestMpTree(unittest.TestCase):
maxDiff = None
create_sql = {
'postgresql': """
DROP TABLE IF EXISTS asceti... | python |
from django import forms
from .models import SignUp
class SignUpForm(forms.ModelForm):
email = forms.EmailField(
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "Enter your email",}
),
label="",
)
class Meta:
model = SignUp
fields... | python |
import json
import unittest
from rest_framework import status
from django.test import TestCase
from django.urls import reverse
from ..models import Client
from .token import get_token
class CreateNewClientTest(TestCase):
""" Test module for inserting a new Client """
def setUp(self):
self.client.defa... | python |
import caelum
caelum.start_game()
| python |
# coding: utf-8
# Copyright (c) Materials Virtual Lab.
# Distributed under the terms of the BSD License.
"""
This package contains various command line interfaces for common
pymatgen functionality such as file conversion, etc. Entry points to these
interfaces are defined in setup.py.
""" | python |
from dataclasses import dataclass
@dataclass
class TempFile:
def __enter__(self):
pass
def __exit__(self):
pass
pass
def download(media):
"""Download the given Media Object immediately in the user’s browser."""
pass
def from_file(filename, mime_type, name):
"""Creates a M... | python |
__author__ = "Kiriti Nagesh Gowda"
__copyright__ = "Copyright 2018, AMD NeuralNet Model Profiler"
__license__ = "MIT"
__version__ = "0.9.0"
__maintainer__ = "Kiriti Nagesh Gowda"
__email__ = "Kiriti.NageshGowda@amd.com"
__status__ = "Alpha"
import os
import getopt
import sys
import subproces... | python |
from setuptools import setup
setup(name='gym_pigchase_topdown',
version='0.1',
url="",
author="Federico Rossetto",
license="MIT",
packages=["gym_pigchase_topdown", "gym_pigchase_topdown.envs"],
install_requires=['gym', 'numpy', 'pygame', 'random']
) | python |
import random
xings_str = "李,王,张,刘,陈,杨,黄,赵,周,吴,徐,孙,朱,马,胡,郭,林,何,高,梁,郑,罗,宋,谢,唐,韩,曹,许,邓,萧,冯,曾,程,蔡,彭,潘,袁,于,董,余,苏,叶,吕,魏,蒋,田,杜,丁,沈,姜,范,江,傅,钟,卢,汪,戴,崔,任,陆,廖,姚,方,金,邱,夏,谭,韦,贾,邹,石,熊,孟,秦,阎,薛,侯,雷,白,龙,段,郝,孔,邵,史,毛,常,万,顾,赖,武,康,贺,严,尹,钱,施,牛,洪,龚"
mings_str = "大,二,三,四,五,六,七,八,九"
add_score_things = "点赞,赞美,打电话,帮助,送礼物"
reduce_score_things = ... | python |
from abc import ABC, abstractmethod
from collections import deque
from enum import Enum, IntEnum
from random import shuffle
from secrets import choice
from typing import Deque, List, NamedTuple
class Suit(IntEnum):
SPADE = 0
DIAMOND = 13
HEART = 26
CLUB = 39
def __repr__(self) -> str:
ret... | python |
import logging
import os
import socket
import sys
import uuid
from leapp.dialogs import RawMessageDialog
from leapp.exceptions import CommandError, MultipleConfigActorsError, WorkflowConfigNotAvailable
from leapp.messaging.answerstore import AnswerStore
from leapp.messaging.inprocess import InProcessMessaging
from lea... | python |
import libnum
import os
import requests
plugin_name = "rsa自动解题"
plugin_version = "v1.1"
plugin_author = "1me"
plugin_time = "20200505"
plugin_test_in='''
n=920139713
e=19
c=704796792
'''
plugin_test_out="None"
plugin_info = '''输入n,e,d,p,q,c,m等自动解题
需要 os,libnum,requests三个包
目前实现了几个简单计算
比如通过pq计算n
通过pqe计算d
n查factordb.com等等... | python |
#alist = [1,2,3,4,5,]
#def func(a):
# a = a**2
# return a
#blist = map(func,alist)
#res = [i for i in blist if i >= 16]
#print(res)
#print(list(i for i in blist if i >= 16))
import random
import time
def dec(fun):
def obj(*args,**kwargs):
star = time.time()
fun()
end = time.time()
tim = end ... | python |
#!/usr/local/bin/python
import requests
import traceback
import re
import time
import datetime
import getpass
import os
from PIL import Image
from json import loads,load,dump
from bs4 import BeautifulSoup
from http import cookiejar
from urllib import parse
from urllib.parse import quote, unquote
from requests.package... | python |
import os
import csv
import pandas as pd
from typing import List
from stork_a import StorkA, Classifier, Metadata, BlastocystScore, BlastocystGrade, Morphokinetics, InputImage, Result
def main():
stork_a = StorkA()
path = os.path.dirname(os.path.realpath(__file__))
classifier_base_path = os.path.join(path... | python |
# -*- coding: utf-8 -*-
import unittest
from driftconfig.util import get_drift_config
from drift.core.extensions.apikeyrules import get_api_key_rule
from drift.tests import DriftTestCase
from drift.systesthelper import setup_tenant
class ApiKeyRulesTest(DriftTestCase):
@classmethod
def setUpClass(cls):
... | python |
from objects.seismic.waves import OWT
import numpy as np
from objects.seismic.boundaries.refl_boundary_up import PDownPUpReflection, PDownPUpWaterReflection
from objects.seismic.boundaries.trans_boundary_down import PDownPDownTransmission, PDownPDownWaterTransmission
from objects.seismic.boundaries.trans_boundary_up im... | python |
import os
from lib import status
from src import video
from src import extract
import threading
import time
#limit max threads
max_threads = 5
#function to register a thread
#wait until a new thread is avaible, then start a new thread
def thread_get(FILE, PATH):
while True:
if threading.active_count() <= m... | python |
from typing import Tuple
import scipy.spatial
import numpy as np
def compute_distance_matrix(embeddings: np.array) -> np.array:
condensed = scipy.spatial.distance.pdist(embeddings, "euclidean")
matrix = scipy.spatial.distance.squareform(condensed)
return matrix
def compute_knn_confusions(distance_matri... | python |
#Importing libraries
import cv2
import pytesseract
import numpy as np
import os
import sys
sys.path.append(os.path.join(".."))
import argparse
def main(inpath):
# Loading image using OpenCV
img = cv2.imread(inpath)
# Creating the blue rectangle box of the region of interest, which contains the ... | python |
# standard library
from datetime import datetime
# third party
import requests
from cmath import nan
# this package
from health.data_models import BodyCompData
from health.exceptions import UnknownBehavior
class WeightGurus:
def __init__(self, username, password):
self.login_data = {"email": username, "... | python |
# -*- coding: utf-8 -*-
import redis
import os
import telebot
# import some_api_lib
# import ...
# Example of your code beginning
# Config vars
token = os.environ['TELEGRAM_TOKEN']
# some_api_token = os.environ['SOME_API_TOKEN']
# ...
# If you use redis, install this add-on https://elements.hero... | python |
#encoding:utf-8
import cv2
import numpy as np
#读取图片
src = cv2.imread('scenery.png')
rows, cols = src.shape[:2]
print rows, cols
#图像缩放
result = cv2.resize(src, None, fx=0.3, fy=0.3)
#显示图像
cv2.imshow("src", src)
cv2.imshow("result", result)
#等待显示
cv2.waitKey(0)
cv2.destroyAllWindows()
| python |
#!/usr/bin/env python
'''
This module creates archive_users_%projectid.cfg. It maker
sure the few users that is essential for the project is imported
even if they have not created any session that will be imported later.
'''
import os
from leginon import projectdata, leginondata
import sinedon
def checkSinedon():
i... | python |
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from tinymce.models import HTMLField
class BaseProfile(models.Model):
user = models.OneToOneF... | python |
class BuildableProductRunnable(object):
def __init__(self, entry_item):
self.contents = entry_item; | python |
# Copyright (c) 2012, Adam J. Rossi. All rights reserved. See README for licensing details.
import Chain, Common, FeatureExtraction
import os, math
class Surf(Chain.StageBase):
def __init__(self,
inputStages=None,
hessianThreshold=500,
numOctaves=3,
... | python |
import os
import torch
import argparse
import datetime
import numpy as np
from tqdm import tqdm
import torch.nn as nn
from math import floor
from apex import amp
import librosa
from contextlib import redirect_stdout
from configs import cfg
from dataset.util import *
import torch.optim as optim
from models.y_net import ... | python |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 28 12:16:33 2020
@author: danie
"""
import numpy as np
np.set_printoptions(legacy='1.13')
n, m = map(int,input().split())
print(np.eye(n, m)) | python |
from unittest import TestCase
from unittest.mock import MagicMock, patch
from app import create_app
from tests.request import check_status_code, solve_get_request, solve_post_request
class SolveGetTest(TestCase):
def setUp(self):
self.client = create_app(test=True).test_client()
@patch('view.solve.... | python |
__author__ = 'Igor Nikolaev'
from pytest_bdd import given, when, then
from model.contact import Contact
import random
import time
# Add new contact
@given('a contact list', target_fixture='contact_list')
def contact_list(db):
return db.get_contact_list()
@given('a contact with <firstname>, <lastname> and <midd... | python |
from Crypto.Util.number import getPrime
def int_to_bytes(n):
"""Converts the given int n to bytes and returns them."""
return n.to_bytes((n.bit_length() + 7) // 8, 'big')
def gcd(a, b):
"""Computes the greatest common divisor between a and b using the Euclidean algorithm."""
while b != 0:
a,... | python |
"""
--- Ångström ---
Tests reading xyz trajectory.
"""
from angstrom import Trajectory, Molecule
import numpy as np
import os
benzene_xyz = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'benzene.xyz')
def test_trajectory_from_molecule():
"""Tests converting Molecule to Trajectory object"""
benzen... | python |
from http import ClickatellClient, ClickatellException
| python |
import hypernetx as hnx
import math
import matplotlib.pyplot as plt
import matplotlib
from scipy.io import loadmat
import numpy as np
from matplotlib.collections import RegularPolyCollection
def init():
"""
134 126 246 123 346 345 456 256
:return:
"""
# 7
edges1 = [['1', '2', '4'], ['2', '3', ... | python |
#--- Exercicio 2 - Variávies e impressão com interpolacão de string
#--- Crie um menu para um sistema de cadastro de funcionários
#--- O menu deve ser impresso com a função format() para concatenar os números da opções, que devem ser números inteiros
#--- Alem das opções o menu deve conter um cabeçalho e um rodapé
#--... | python |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | python |
from django.db import models
from django.urls import reverse
# Create your models here.
class User(models.Model):
"""docstring for Farmer"""
auto_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=30)
email = models.EmailField(max_length=30,unique=True)
pwd = models.CharField(max_length=1... | python |
from typing import Any, Dict, List, Optional, Union, cast
from rich.console import Console, ConsoleOptions, RenderResult
from rich.tree import Tree as RichTree
from .protocol import TrioNursery, TrioTask
""" Generate Identical Fake data for developing & test
Provide a simpler interface for constructing trio task tre... | python |
from .erd_remote_status import ErdRemoteStatus
from .remote_status import RemoteStatus
REMOTE_STATUS_MAP = {
ErdRemoteStatus.DISABLE: RemoteStatus.STATUS_DISABLE,
ErdRemoteStatus.ENABLED: RemoteStatus.STATUS_ENABLED,
ErdRemoteStatus.NOT_SUPPORTED: RemoteStatus.STATUS_NOT_SUPPORTED
}
| python |
"""
Usage:
merge_gradient_by_day.py <grad_no> <day> <sub_dir> <grad_dir> <merged_dir>
Arguments:
<grad_no> Gradient number
<day> Day
<sub_dir> Directory of all subjects' directories
<grad_dir> Directory of day1 and day2 gradients in dscalar.nii format
<merged_dir> director... | python |
"""MXNet and NNVM model zoo."""
from __future__ import absolute_import
from . import mlp, resnet, vgg, dqn, dcgan, squeezenet
import nnvm.testing
__all__ = ['mx_mlp', 'nnvm_mlp', 'mx_resnet', 'nnvm_resnet', 'mx_vgg', 'nnvm_vgg',
'mx_squeezenet', 'nnvm_squeezenet']
_num_class = 1000
# mlp fc
mx_mlp = mlp.g... | python |
from PDSUtilities.plotly import ColorblindSafeColormaps
def test_get_count():
colormaps = ColorblindSafeColormaps()
assert isinstance(colormaps.get_count(), int)
assert colormaps.get_count() > 0
def test_get_names():
colormaps = ColorblindSafeColormaps()
assert isinstance(colormaps.get_names(), li... | python |
import numpy as np;
import matplotlib.pyplot as plt;
license="""
Copyright (C) 2014 James Annis
This program is free software; you can redistribute it and/or modify it
under the terms of version 3 of the GNU General Public License as
published by the Free Software Foundation.
More to the points- thi... | python |
from installed_clients.specialClient import special as special
import json
import os
import shutil
def wdl(callback_url, token, params):
sr = special(callback_url, token=token)
src = '/kb/module/workflow.wdl'
wdl_file = 'workflow.wdl'
shutil.copy(src, '/kb/module/work/tmp/' + wdl_file)
input_file ... | python |
# Copyright 2022 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
#
# Unless required by applicable law or agreed to in writing... | python |
"""
author: ouyangtianxiong
date: 2019/12/23
des: this algorithm package implements my personal innovation for my master thesis
"""
__author__ = 'ouyangtianxiong.bupt.edu.cn'
import sys
sys.path.append('../') | python |
import logging
logger = logging.getLogger("bogi")
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger.addHandler(ch)
| python |
# flake8: noqa F401
# modules in this package are expected to implement a function `prepare` which
# takes the arguments workdir and component. this function prepares a directory
# in workdir for a terraform command and returns the version of terraform that
# should be used to run that command
from . import (
null,... | python |
from tapiriik.payments import *
from .totp import *
from tapiriik.database import db
from tapiriik.sync import Sync
from tapiriik.services import ServiceRecord
from tapiriik.settings import DIAG_AUTH_TOTP_SECRET, DIAG_AUTH_PASSWORD
from datetime import datetime, timedelta
from pymongo.read_preferences import Rea... | python |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | python |
#!/usr/bin/env python3
import requests
import structlog
import pkg_resources
from requests.auth import HTTPBasicAuth
from datetime import datetime
# Calls all wrappers and updates their health_check and capacities in the database.
def filename(name):
""" Obtain filepath for the resource.
:param name: Path ... | python |
"""
**pyavia.aero** provides functions relating to aerodynamics, thermodynamics
and fluid dynamics in general.
"""
# All sub-modules define __all__.
from ._atmosphere import *
from ._foil import *
from ._gasflow import *
| python |
import tkinter as tk
root=tk.Tk()
f1 = tk.Frame(width=200, height=200, background="red")
f2 = tk.Frame(width=100, height=100, background="blue")
f1.pack(fill="both", expand=True, padx=20, pady=20)
f2.place(in_=f1, anchor="c", relx=.5, rely=.5)
root.mainloop()
| python |
# https://en.wikipedia.org/wiki/High-dynamic-range_imaging
import cv2
import numpy as np
from glob import glob
#* 1. Loading exposure images into a list
images = glob("./images/hdr*")
images = [cv2.imread(image) for image in images]
exposure_times = np.array([15.0, 2.5, 0.25, 0.0333], dtype=np.float32)
#* 2. Mer... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.