text stringlengths 2 999k |
|---|
from .models import *
from django import forms
from django.forms import widgets
from django.forms import ModelForm
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from functools import partial
def userid(request):
data = request.user.id
return data
class UserFo... |
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P':'.--.', 'Q':'--.-',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# the LI... |
# encoding:utf-8
'''
@Author: catnlp
@Email: wk_nlp@163.com
@Time: 2018/5/2 15:02
'''
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
START_TAG = -2
STOP_TAG = -1
def log_sum_exp(vec, m_size):
_, idx = torch.max(vec, 1)
max_score = torch.g... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from multiprocessing import cpu_count
import numpy as np
from scipy.stats import mode, pearsonr
from sklearn.metrics import (
conf... |
import numpy as np
import mxnet as mx
import matplotlib.pyplot as plt
#-----------------------------------------------------------------------------
class StateModel(mx.gluon.Block):
def __init__(self,config):
super(StateModel, self).__init__()
self.config = config
x = mx.nd.array(self.con... |
# Copyright (C) 2021 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 in wri... |
from datetime import datetime
import sqlalchemy as sa
from celery import states
from celery.db.session import ResultModelBase
# See docstring of a805d4bd for an explanation for this workaround ;)
if sa.__version__.startswith('0.5'):
from celery.db.dfd042c7 import PickleType
else:
from celery.db.a805d4bd impor... |
"""
Optuna
Wandb
Backend GPU Stuff?
"""
|
from insights.tests import context_wrap
from insights.parsers.sysconfig import SshdSysconfig
SSHD_SYSCONFIG = """
# Configuration file for the sshd service.
# The server keys are automatically generated if they are missing.
# To change the automatic creation, adjust sshd.service options for
# example using systemctl... |
"""Streams API error event model."""
from typing import Optional
from dataclasses import dataclass
from marshmallow import fields, validate
from proglove_streams.models.event import (
StreamsAPIEventSchema,
StreamsAPIEvent)
from proglove_streams.models.event_type import EventType
@dataclass
class ErrorEvent(... |
#!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
from collections import defaultdict
import json
import os
import pandas as pd
import tenkit.stats as tk_stats
import cellranger.h5_constants as h5_constants
import cellranger.library_constants as lib_constants
import cellranger.utils... |
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
from flask_mongoengine import MongoEngine
db = MongoEngine()
def initialize_db(app):
db.init_app(app) |
import bitwise as bw
class TestMultiplexer8To1:
def test_Multiplexer8To1(self):
enable = bw.wire.Wire()
select_1 = bw.wire.Wire()
select_2 = bw.wire.Wire()
select_3 = bw.wire.Wire()
input_1 = bw.wire.Wire()
input_2 = bw.wire.Wire()
input_3 = bw.wire.Wire()
... |
"""Things involving data, variables, and typesin x-python."""
try:
import vmtest
except ImportError:
from . import vmtest
from xdis.version_info import PYTHON_VERSION_TRIPLE
class TestData(vmtest.VmTestCase):
def test_constant(self):
self.do_one()
def test_attributes(self):
self.sel... |
# Copyright 2015-2021 Espressif Systems (Shanghai) 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 ... |
import json
import falcon
class requireJSON(object):
def process_request(self, req, resp):
if not req.client_accepts_json:
raise falcon.HTTPNotAcceptable(
'This API only supports responses encoded as JSON.',
href='http://docs.examples.com/api/json')
if... |
##### 10 - Game over ####
import pygame, random
from pygame.locals import *
# Helper func
def on_grid_random():
x = random.randint(0, 59)
y = random.randint(0, 59)
return (x * 10, y * 10)
# Collision
def collision(c1, c2):
return (c1[0] == c2[0]) and (c1[1] == c2[1])
# Snake movemen... |
from tensorflow import keras
import numpy as np
import pidash
import os
#import gc
PATH = os.path.dirname(__file__)
# This is a prototype implementation of the sensor AI deployment.
#This is not final code and should not be reguarded as a best practices.
# get_exposed() is a simple pixel count routine. It establi... |
from rest_framework import routers
from lifenet.views import LNCheckViewSet
v2router = routers.DefaultRouter()
v2router.register("lncheck", LNCheckViewSet)
|
############################################################
#
# Autogenerated by the KBase type compiler -
# any changes made here will be overwritten
#
############################################################
try:
import json as _json
except ImportError:
import sys
sys.path.append('simplejson-2.3.3')... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 14 15:20:25 2022
@author: SimenLab
"""
def extract_interleaved(input_folder, save_dir, output_folder, crop, **kwargs): # output_folder
"""
Script for running Suite2p analysis on .tiffs with interleaved planes
E.g., every n-th frame is from the n-th plane.... |
import sys, json
#card object
class Card(object):
def __init__(self, faction, name, strength, row, ability, location, owned, hero, primaryInfo, secondaryInfo):
self.faction = faction
self.name = name
self.strength = strength
self.row = row
self.ability = ability
self.location = location
self.owned = owne... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import flags
sys.path.append("../")
from nmutant_model.model_operation import mod... |
class DataPlane:
"""Helper Class for interacting with the dataplane"""
def __init__(self):
self.dataplane_function_name = os.environ["DataplaneEndpoint"]
self.lambda_client = boto3.client('lambda')
self.lambda_invoke_object = {
# some api uri
"resource": "",
... |
import sys
import click
import importlib
import os
import pkg_resources
from pathlib import Path
from typing import Optional, Any, Callable, List
from .environment import Environment
from .palm_config import PalmConfig
from .plugin_manager import PluginManager
from .utils import is_cmd_file, cmd_name_from_file, run_on... |
from setuptools import find_packages
from setuptools import setup
package_name = 'ros2node'
setup(
name=package_name,
version='0.14.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages',
... |
#!/usr/bin/env python3
# Read out the ANIM.BIN offsets for a model
import os
import os.path
import sys
import struct
import zlib
def main():
discRoot = sys.argv[1]
dirName = sys.argv[2]
modelId = int(sys.argv[3], 0)
# get the model's offset from MODELS.TAB
with open('%s/%s/MODELS.tab' % (discRo... |
"""Deals with creating the initiliazer class.
Copyright (C) 2013, Joshua More and Michele Ceriotti
This program 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... |
from __future__ import unicode_literals
from distutils.version import StrictVersion
from itertools import chain
import io
import os
import socket
import sys
import threading
import warnings
try:
import ssl
ssl_available = True
except ImportError:
ssl_available = False
from redis._compat import (xrange, im... |
# Constellation Control Server
# A centralized server for controlling museum exhibit components
# Written by Morgan Rehnberg, Fort Worth Museum of Science and History
# Released under the MIT license
# Standard modules
from http.server import HTTPServer, SimpleHTTPRequestHandler
from socketserver import ThreadingMixIn... |
import os
import util.pixiv_auth
from core.caches import api_cache
from core.structures.Entry import Entry
from core.structures.ImageProvider import ImageProvider
from util import utils
class PixivProvider(ImageProvider):
__tokens = None
__target = None
def __init__(self):
super(PixivProvider, s... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.17
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
'''
Created on 8 May 2021
@author: julianporter
'''
from .chunk import FLPChunk
class FLPHeader(FLPChunk):
def __init__(self,data=b''):
super().__init__(data)
try:
self.format = FLPChunk.getInt16(self.data[0:2])
self.nTracks = FLPChunk.getInt16(self.data[2:4])
... |
from . import test_ed25519
from . import test_address
from . import test_numbers
from . import test_seed
from . import test_transaction
from . import test_wallet
from . import test_offline
from . import test_jsonrpcwallet
|
from blog import app
from blog.blogDB import config_db_session
from werkzeug.contrib.fixers import ProxyFix
config_db_session()
# app.wsgi_app = ProxyFix(app.wsgi_app)
app.run() |
"""
本脚本有两个功能:
1.将voc数据集标注信息(.xml)转为yolo标注格式(.txt),并将图像文件复制到相应文件夹
2.根据json标签文件,生成对应names标签(my_data_label.names)
"""
import os
from tqdm import tqdm
from lxml import etree
import json
import shutil
# voc数据集根目录以及版本
voc_root = "/media/yhn/固态存储盘/机器学习数据/darkNet/VOCdevkit/"
voc_version = "VOC2012"
# 转换的训练集以及验证集对应txt文件
trai... |
import torch
import numpy as np
from torch.autograd import Variable
class loss_block:
def __init__(self):
super(loss_block, self).__init__()
self.criterion = torch.nn.NLLLoss(size_average=False)
cuda = True if torch.cuda.is_available() else False
if cuda:
self.criterion.... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-07 13:45
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import meta.models
class Migration(migrations.Migration):
initial = True
dependencies = ... |
# 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 ... |
#!/usr/bin/env python3
#
# This command requires HatSploit: https://hatsploit.netlify.app
# Current source: https://github.com/EntySec/HatSploit
#
from hatsploit.lib.commands import Commands
from hatsploit.lib.command import Command
class HatSploitCommand(Command):
commands = Commands()
details = {
... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
def eggholder(x):
return (-(x[1] + 47) * np.sin(np.sqrt(abs(x[0]/2 + (x[1] + 47))))
-x[0] * np.sin(np.sqrt(abs(x[0] - (x[1] + 47)))))
bounds = [(-512, 512), (-512, 512)]
x = np.arange(-512, 513)
y = np.arange(-512, 513)
... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... |
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType
from pyspark.sql.functions import explode
from pyspark.sql.functions import split
from pyspark.sql.functions import count
from pyspark.sql.functions import col
from pyspark.sql.functions import desc
spark = SparkSession \
.builder \
... |
from prettytoml.elements import abstracttable, factory
from prettytoml.elements.errors import InvalidElementError
from prettytoml.elements.common import Element
from prettytoml.elements.metadata import CommentElement, NewlineElement, WhitespaceElement
from . import common
class TableElement(abstracttable.AbstractTabl... |
#!/usr/bin/env python2
'''
This file is intended to be used to configure PETSc for dynamite.
It should be run in the PETSc root source directory.
To see all possible options, run "./configure --help" in the PETSc root directory.
You may want to pipe to "less"; it is a big help page ;)
'''
configure_options = [
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" creating subdomains"""
import json
from atpbar import atpbar
from auxiliars.constants import tlds_json
def subdomains(base, tlds, possibilities):
with open(tlds_json, encoding='utf-8') as file:
options = json.load(file)
for i in atpbar(range(0, len(... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Group.name'
db.alter_column('groups_group', 'name', se... |
# (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import os
from subprocess import PIPE, Popen
import time
# 3p
import memcache
from nose.plugins.attrib import attr
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest
... |
# SPDX-FileCopyrightText: 2021 Jose David M.
#
# SPDX-License-Identifier: MIT
#############################
"""
This is a simple example of the use of the arrowline function.
"""
import displayio
import board
from CircuitPython_ArrowLine.arrowline import line_arrow
display = board.DISPLAY
my_group = displayio.Group... |
#!/usr/bin/env python3
# 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 "Lic... |
# Author Michele Mattioni
# Fri Oct 23 15:41:58 BST 2009
import pylab
import numpy as np
from numpy import sin, exp
import matplotlib.pyplot as plt
from helpers.loader import Loader
class FitHandler(object):
"""Fit the data with a polynomial"""
def fit(self, data, terms):
polycoeffs = np.po... |
import os
import re
from setuptools import setup, find_packages
here = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(here, 'README.rst')) as f:
readme = f.read()
with open(os.path.join(here, 'torchcrf', '__init__.py')) as f:
version = re.search(r'__version__ = (["\'])([^"\']*)\1', f.read()... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2020 Rapptz
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 u... |
import discord, datetime, time
from discord.ext import commands
start_time = time.time()
class Uptime:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def uptime(self):
"""
Get the time the bot has been active
"""
current_time = time.time()
... |
# Copyright (c) 2012-2018 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... |
from paramak import RotateStraightShape
class VacuumVessel(RotateStraightShape):
"""A cylindrical vessel volume with constant thickness.
Arguments:
height (float): height of the vessel.
inner_radius (float): the inner radius of the vessel.
thickness (float): thickness of the vessel
... |
#! /usr/bin/env python
"""
FISS -- (Fi)reCloud (S)ervice (Selector)
This module provides a command line interface to FireCloud
For more details see https://software.broadinstitute.org/firecloud/
"""
from __future__ import print_function
import json
import sys
import os
import time
from inspect import getsourcelines
fr... |
import ssl
from notifly import tf_notifier
import tensorflow as tf
from dotenv import load_dotenv
import os
load_dotenv()
ssl._create_default_https_context = ssl._create_unverified_context
token = os.getenv('TOKEN')
notifier = tf_notifier.TfNotifier(token=token, platform='discord')
class TestCallback(tf.keras.call... |
import torch
from models import BaseVAE
from torch import nn
from torch.nn import functional as F
from .types_ import *
class VanillaVAE(BaseVAE):
def __init__(self,
in_channels: int,
latent_dim: int,
hidden_dims: List = None,
**kwargs) -> None... |
import torch
from sklearn.preprocessing import LabelEncoder
from torch.utils.data import Dataset, DataLoader
class JobsDataset(Dataset):
def __init__(self, X, y, tokenizer, max_len=512):
self.len = len(X)
self.data = X
self.y = y
self.tokenizer = tokenizer
self.max_len = ma... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Cisco Systems, Inc. and others. 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... |
"""
Django settings for deploy project on Heroku. For more info, see:
https://github.com/heroku/heroku-django-template
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/... |
#!/usr/bin/env python3
import os
import kong_pdk.pdk.kong as kong
Schema = (
{"message": {"type": "string"}},
)
version = '0.1.0'
priority = 0
# This is an example plugin that add a header to the response
class Plugin(object):
def __init__(self, config):
kong.log.err("saying hi from init phase")
... |
from version_checking import _assert_py_version, PythonVersion
_assert_py_version(PythonVersion(3, 10))
import abc
import warnings
import boto3
from botocore.client import BaseClient
from botocore import exceptions as aws_exceptions
from cloud.amazon.common.exception_handling import ExceptionLevels
from cloud.amazo... |
################################################################################
# #
# This file is part of the Morphomatics library #
# see https://github.com/morphomatics/morphomatics ... |
import copy
from components.episode_buffer import EpisodeBatch
from modules.mixers.vdn import VDNMixer
from modules.mixers.qmix import QMixer
import torch as th
import numpy as np
from torch.optim import RMSprop
# learning for 6h_vs_8z scenario
class QLearner_6h_vs_8z:
def __init__(self, mac, scheme, logger, args)... |
import os
import subprocess
import uuid
import click
from celery.utils.nodenames import default_nodename, host_format
from dagster import check
from dagster.config.post_process import post_process_config
from dagster.config.validate import validate_config
from dagster.core.errors import DagsterInvalidConfigError
from... |
# This is an ISAPI extension purely for testing purposes. It is NOT
# a 'demo' (even though it may be useful!)
#
# Install this extension, then point your browser to:
# "http://10.0.0.7/pyisapi_test/test1"
# This will execute the method 'test1' below. See below for the list of
# test methods that are acceptable.
fro... |
file = open("example.txt", 'r')
print(type(file))
content = file.read()
print(content)
content = file.readlines()
print(content)
file.seek(0)
content = file.readlines()
print(content)
contentNew = [i.rstrip("\n") for i in content]
print(contentNew)
file.close()
with open("Writer.txt", 'a+') as file:
file.write("A... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
"""fujitsu_ipcom_config module.
Send configuration commands to the remote node.
Takamitsu IIDA (@takamitsu-iida)
"""
ANSIBLE_METADATA = {'metadata_version': '0.1', 'status': ['preview'], 'supported_by': 'community'}
DOCUMENTATION = """
--... |
#!/usr/bin/env python
"""
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");... |
# -*- coding: utf-8 -*-
def create_database():
from app import db
def _store_topics(session):
session.add_all(MetadataPopulator.get_topics())
session.flush()
def _store_languages(session):
session.add_all(MetadataPopulator.get_languages())
session.flush()
def _store_... |
#
# 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... |
"""Shared code among the dish_grpc_* commands
Note:
This module is not intended to be generically useful or to export a stable
interface. Rather, it should be considered an implementation detail of the
other scripts, and will change as needed.
For a module that exports an interface intended for gener... |
#
# Copyright (c) 2021 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
import json
import seaborn as sbn
from scipy import stats
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.colors as mcolors
import pandas as pd
import arch.bootstrap
import math
import qcfractal.interface as ptl
from fragmenter.utils import HARTREE_2_KJMOL
from fragmenter import chemi
from openeye ... |
# Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
from typing import Protocol
from tvsched.application.interfaces import ILogger
from tvsched.application.models.episode import EpisodeUpdate
class IUpdateEpisodeUseCaseRepo(Protocol):
""""""
async def update(self, episode: EpisodeUpdate) -> None:
"""Updates episode in repo.
Args:
... |
import numpy
import suspect.basis
def hsvd(data, rank, L=None):
if L is None:
L = data.np // 2
# start by building the Hankel matrix
hankel_matrix = numpy.zeros((L, data.np - L), "complex")
for i in range(int(data.np - L)):
hankel_matrix[:, i] = data[i:(i + L)]
# perform the sing... |
import behave
import json
import time
import os
@behave.when(u'I push and deploy package with param "{on_reset}" in "{package_directory_path}"')
def step_impl(context, package_directory_path, on_reset):
package_directory_path = os.path.join(os.environ['DATALOOP_TEST_ASSETS'], package_directory_path)
package_j... |
## Graphite local_settings.py
# Edit this file to customize the default Graphite webapp settings
#
# Additional customizations to Django settings can be added to this file as well
import os
#####################################
# General Configuration #
#####################################
#
# Set this to a long, rand... |
"""Schema proposal.
TODO - resources for info/schema/data:
https://en.wikipedia.org/wiki/Glossary_of_botanical_terms
https://en.wikipedia.org/wiki/Dehiscence_(botany)
https://en.wikipedia.org/wiki/Dendrology
https://plants.usda.gov/charinfo.html
Ways to organize information:
1. Giant document
- ... |
import asyncio
import typing as t
def gather_and_execute(*awaitables: t.Awaitable[t.Any]) -> t.List:
eloop = asyncio.get_event_loop()
tasks = asyncio.gather(*awaitables)
eloop.run_until_complete(tasks)
|
import board #Modul, zur Kennzeichnung von Pins.
import digitalio #Modul, zur Kommunikation über einzelene Pins.
import busio #Modul, zur Kommunikation über das IO.
import adafruit_pcd8544 #Modul, zur Kontrolle des benutzten Displays.
from PIL import Image, ImageDraw, ImageFont #Module, zum Zeichen von Formen und Texte... |
# Generated by Django 2.2.5 on 2019-12-05 12:12
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Order',
fields=[
('id', models.AutoField(au... |
class TestDict():
def test_dict_1(self, return_dict):
cost = return_dict.get('банан')
assert cost == 1, 'Некорректная цена'
def test_dict_2(self, return_dict):
products = return_dict.keys()
assert 'яблоко' in products, 'Продукта нет в списке'
def test_dict_3(self, return_di... |
from rest_framework import authentication
from payment.models import Services
from .serializers import ServicesSerializer
from rest_framework import viewsets
class ServicesViewSet(viewsets.ModelViewSet):
serializer_class = ServicesSerializer
authentication_classes = (
authentication.SessionAuthenticat... |
import sys
import numpy as np
import tensorflow as tf
import tf_encrypted as tfe
config = tfe.get_config()
if len(sys.argv) > 1:
#
# assume we're running as a server
#
player_name = str(sys.argv[1])
server = config.server(player_name)
server.start()
server.join()
else:
#
# as... |
# -*- coding:utf-8 -*-
# author:Anson
# @Time : 2020/9/23 11:05
# @File : __init__.py.py
from __future__ import unicode_literals
|
def divide (divid, divis):
if divis ==0:
raise ZeroDivisionError("Divisor cannot be 0")
# This error has a message attached to it
return divid / divis
# divide(15,0)
grades = [78,99,85,100]
average = divide (sum(grades), len(grades))
print(f"The average grade is {average}")
# if there ar... |
# coding=utf-8
# Copyright 2019 The TensorFlow Datasets 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 appl... |
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laborat... |
# import unittest
# import json
# from cloudsplaining.output.findings import Finding, Findings
# from cloudsplaining.scan.policy_document import PolicyDocument
# from cloudsplaining.scan.assume_role_policy_document import AssumeRolePolicyDocument
#
#
# class TestFindings(unittest.TestCase):
# def test_finding_attri... |
from django.conf.urls import url
from . import views
app_name = 'documents'
urlpatterns = [
url(r"revert$", views.revert, name='revert'),
url(r"search$", views.search, name='search'),
url(r"preview$", views.preview, name='preview'),
url(r"attachment/create$", views.create_attachment, name='create_attachment'),
... |
from __future__ import division
from __future__ import print_function
|
import numpy as np
import pytest
from sympy import simplify, diff, cos, sin, Float
from devito import (Grid, Function, TimeFunction, Eq, Operator, NODE,
ConditionalDimension, left, right, centered, div, grad)
from devito.finite_differences import Derivative, Differentiable
from devito.finite_differ... |
#
# The Python Imaging Library.
# $Id$
#
# standard mode descriptors
#
# History:
# 2006-03-20 fl Added
#
# Copyright (c) 2006 by Secret Labs AB.
# Copyright (c) 2006 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#
# mode descriptor cache
_modes = {}
class ModeDescriptor(ob... |
''' Prepare KITTI data for 3D object detection.
Author: Charles R. Qi
Date: September 2017
'''
from __future__ import print_function
import os
import sys
import numpy as np
import cv2
from PIL import Image
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.