text
stringlengths
2
999k
from django.shortcuts import render from django.http import JsonResponse # Create your views here. def index(request): return JsonResponse( { "message": "Api Home Page", "end-points": { "books": { "get": "books/", "post": "add-...
# 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 may ...
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2017 Susanna Maria Hepp # # 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 lim...
## # python-crisp-api # # Copyright 2018, Valerian Saliou # Author: Valerian Saliou <valerian@valeriansaliou.name> ## from crisp_api import Crisp client = Crisp() client.authenticate( "13937834-f6ce-4556-ae4f-9e0c54faf038", "eb6c3623245521d7a6c35f5b29f3fa756e893f034ed551d84518961c5ff16dec" ) # Message routi...
from __future__ import absolute_import, print_function, division import unittest from theano.compat import izip from six import iteritems import numpy as np import theano import theano.tensor as T from theano.tensor import TensorType from theano.tensor.basic import alloc # Don't import test classes otherwise they ge...
import unittest from GnomeSort import GnomeSort from InsertionSort import InsertionSort from SelectionSort import SelectionSort class OrdinationTest(unittest.TestCase): def setUp(self): self.oddSize = [9,8,7,6,5,4,3,2,1,0] self.evenSize = [9,8,7,6,5,4,3,2,1] self.empty = [] self.equal = [5,5,5,5,5,5] sel...
# -*- coding: utf-8 -*- """ @author: Olav M.S. Gran """ # Default tolerance for checking default_tol = 1e-14 # Default plate limits # we will use the plate [self._plate_limits[0], self._plate_limits[1]]^2 plate_limits = (0, 1) # Default rb grid rb_grid = (5, 5) # default pod mode pod_sampling_mode = "Uniform" implemen...
platform_name = "" if "Windows" == platform.system(): platform_name = "Windows" os.environ['KIVY_IMAGE'] = 'pil,sdl2' os.environ['KIVY_WINDOW'] = 'pil,sdl2' elif os.uname()[1] == 'raspberrypi': platform_name = "RaspberyPi" os.environ['KIVY_WINDOW'] = 'sdl2' # Necessary to RaspberryPi os.environ...
import torch x = torch.randn((1, 5, 5)) print(x) x = x.unsqueeze(1) print(x) # expand와 repeat은 특정 차원을 복제해서 반복시킨다. x = x.expand(-1, 2, -1, -1) # expand는 데이터 복사가 없음 #x = x.repeat(1, 2, 1, 1) repeat은 데이터를 복사함 print(x)
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule from mmcv.runner import load_checkpoint from torch.nn.parameter import Parameter from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN, flow_warp, make_layer) from mmedit...
import sys import os import pandas as pd import pytest # Avoid error module path sys.path.insert(0, os.path.abspath( # noqa: E402 - Avoid flake8 error 402 os.path.join(os.path.dirname(__file__), '..')) ) from pandasbt import calc_signal from pandasbt.calc_signal import calc_return from pandasbt import zscore @...
# -*- coding: utf-8 -*- ############################################################################### # # ListAllPlans # Returns a list of all plans. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exce...
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-04-27 05:07 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0002_auto_20170426_2328'), ] operations = [ migrat...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from esphome import pins, core from esphome.components import output import esphome.config_validation as cv import esphome.codegen as cg from esphome.const import CONF_ID, CONF_PIN, CONF_PERIOD slow_pwm_ns = cg.esphome_ns.namespace("slow_pwm") SlowPWMOutput = slow_pwm_ns.class_("SlowPWMOutput", output.FloatOutput, cg....
# coding: utf-8 __all__ = ["PyVideoEditorImprementationError"] class PyVideoEditorImprementationError(Exception): """ Warnings that developers will resolve. Developers are now solving in a simple stupid way. """ class KeyError(KeyError): def __str__(self): return ", ".join(self.args)
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Partially based on AboutMethods in the Ruby Koans # from runner.koan import * def my_global_function(a, b): return a + b class AboutMethods(Koan): def test_calling_a_global_function(self): self.assertEqual(5, my_global_function(2, 3)) # NOTE: ...
class Employee: def setName(self,myname): # Mutator method self.myname=myname def getName(self): # Accessor method return self.myname def setStaffNumber(self,StaffNumber): # Mutator method self.StaffNumber=StaffNumber def getStaffNumber(self): # Acces...
''' Copyright European Organization for Nuclear Research (CERN) 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 Authors: - Vincent Garonne, ...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/bigquery_v2/proto/encryption_config.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 imp...
from .BaseDoc import BaseDoc from random import sample from typing import List class TituloEleitoral(BaseDoc): """Classe referente ao Título eleitoral""" def __init__(self): self.digits = list(range(10)) self.first_check_digit_weights = list(range(2, 10)) self.second_check_digit_weigh...
# -*- coding: utf-8 -*- from __future__ import print_function import hashlib import os import time import warnings import requests from ._protos.public.common import CommonService_pb2 as _CommonCommonService from ._protos.public.modeldb import DatasetService_pb2 as _DatasetService from ._protos.public.modeldb impor...
import json import os import time import requests from tqdm import tqdm URL = 'https://api.biorxiv.org/details/biorxiv/2000-01-01/3000-01-01' def fetch(cursor=0): response = requests.get(f'{URL}/{cursor}') response.raise_for_status() decoded = response.json() total = decoded['messages'][0]['total'] ...
from kivy.properties import NumericProperty from kivy.uix.image import Image class Hero(Image): velocity = NumericProperty(0) def on_touch_down(self, touch): self.source = "assets/hero_jump.png" self.velocity = 150 super(Hero, self).on_touch_down(touch) def on_touch_up(self, touc...
import disnake from bot import VillagerBotCluster from disnake.ext import commands class Config(commands.Cog): def __init__(self, bot: VillagerBotCluster): self.bot = bot self.d = bot.d self.db = bot.get_cog("Database") @commands.group(name="config", aliases=["settings", "conf", "ga...
""" Define the names making up the domain specific language """ from pyshould.expectation import ( Expectation, ExpectationNot, ExpectationAll, ExpectationAny, ExpectationNone, OPERATOR ) from pyshould.dumper import Dumper __author__ = "Ivan -DrSlump- Montes" __email__ = "drslump@pollinimini.net" __licens...
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
""" WSGI config for mywb 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/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS...
from sympy.utilities.exceptions import SymPyDeprecationWarning from sympy.core.basic import Basic from sympy.core.compatibility import string_types, range from sympy.core.cache import cacheit from sympy.core import S, Dummy, Lambda from sympy import symbols, MatrixBase, ImmutableDenseMatrix from sympy.solvers import so...
# coding=utf-8 # Copyright 2021 The HuggingFace Team. 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 requir...
# As a test suite for the os module, this is woefully inadequate, but this # does add tests for a few functions which have been determined to be more # portable than they had been thought to be. import os import errno import unittest import warnings import sys import signal import subprocess import sysconfig import te...
import math oneStrings = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] tenStrings = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"] teenStrings = ["", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nin...
# -*- coding: utf-8 -*- # Copyright (c) 2020, Havenir and Contributors # See license.txt from __future__ import unicode_literals # import frappe import unittest class TestHotelGuests(unittest.TestCase): pass
# 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! *** import json import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class GetAcc...
# 获取数据集 import pymysql import os import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) couplet_path = '/root/Couplet/couplet/temp/' logger.info(" get train data from Mysql......") logger.info(" get...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables __a...
# from typing import Counter # counter={} words=input().split(" ") counter ={ x:words.count(x) for x in set(words)} print('max: ', max(counter)) print('min: ', min(counter)) # a = input().split() # d = {} # for x in a: # try: # d[x] += 1 # except: # d[x] = 1 # print('max: ', max(d)) # prin...
class InitSession(object): def __init__(self,osName,osVersion,deviceName,packageName,appActivity,appDirection=''): self.desired_caps={} self.desired_caps['platformName'] = osName self.desired_caps['platformVersion'] = osVersion self.desired_caps['deviceName'] = deviceName sel...
import torch import torch.nn as nn from torch.nn.utils.rnn import PackedSequence from src.utils.mapper import configmapper def hotfix_pack_padded_sequence( input, lengths, batch_first=False, enforce_sorted=False ): lengths = torch.as_tensor(lengths, dtype=torch.int64) lengths = lengths.cpu() if enfor...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Atompaw(Package): """A Projector Augmented Wave (PAW) code for generating atom-center...
import tqdm import json import torch import random import argparse from orderedset import OrderedSet from collections import defaultdict from outcomes.src.common import init_model def main(): ap = argparse.ArgumentParser() ap.add_argument("--device", default="cpu", type=str, help="cpu or number for GPU devi...
# from map2loop import m2l_topology import networkx as nx import random import numpy as np import pandas as pd import os import geopandas as gpd import rasterio from rasterio import plot from rasterio.plot import show from rasterio.mask import mask from rasterio.transform import from_origin from rasterio.io import Memo...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: ibc/core/client/v1/query.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection fr...
""" *************************************************************************** installerGUI.py ------------------------------------- Copyright (C) 2016 globWetland Africa (www.globwetland-africa.org) *************************************************************************** * The GlobWetland Africa toolbox ha...
#!/usr/bin/env python3 import datetime import io import json import os.path import re import requests from getpass import getpass from typing import BinaryIO, Iterable, Tuple from urllib.parse import unquote, urljoin from util import module_dir, open, shell, strip_lines, AttrDict today = datetime.date.today().isoform...
#Copyright (c) 2020 Jan Kiefer #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES...
# theAntsGoMarching.py # A program which prints the lyrics of The Ants Go Marching. """Write a program to print the yrics for ten verses of "The Ants Go Marching." A couple of sample verses are given below. You may choose your own activity for the "little one" in each vers, but be sure to choose something that makes t...
import os import stat from os.path import join, normcase, normpath, abspath, isabs, sep from django.utils.encoding import force_unicode # Define our own abspath function that can handle joining # unicode paths to a current working directory that has non-ASCII # characters in it. This isn't necessary on Windows since...
"""Pin definitions for the Coral Edge TPU Dev board.""" from adafruit_blinka.microcontroller.nxp_imx8m import pin SDA = pin.I2C2_SDA SCL = pin.I2C2_SCL PWM1 = pin.PWM1 PWM2 = pin.PWM2 PWM3 = pin.PWM3 GPIO_P13 = pin.GPIO6 GPIO_P16 = pin.GPIO73 GPIO_P18 = pin.GPIO138 GPIO_P29 = pin.GPIO7 GPIO_P31 = pin.GPIO8 GPIO_P36...
import unittest from odml import Property, Section, Document from odml.doc import BaseDocument from odml.section import BaseSection class TestSection(unittest.TestCase): def setUp(self): pass def test_value(self): pass def test_name(self): pass def test_parent(self): ...
from typing import Dict, Generator from psutil import process_iter, Process def parse_cmdline_args(cmdline_args) -> Dict[str, str]: cmdline_args_parsed = {} for cmdline_arg in cmdline_args: if len(cmdline_arg) > 0 and '=' in cmdline_arg: key, value = cmdline_arg[2:].split('=') ...
import copy from common.TimedWord import TimedWord, LRTW_to_LTW, DRTW_to_LRTW from testing.random_testing import random_testing_1, random_testing_2, random_testing_3, random_testing_4 from testing.mutation_testing import mutation_testing, model_based_mutation_testing def TQs(LTWs, system): LRTWs, value = system.t...
import timeit s = """ import cymunk as pymunk #print("easymunk.version", easymunk.version) s = easymunk.Space() s.add(easymunk.Circle(s.static_body, 5)) b = easymunk.Body(1,10) c = easymunk.Circle(b, 5) s.add(b, c) def f(arb): return False s.set_default_collision_handler(pre_solve=f) """ print(min(timeit.repeat("s...
# Generated by Django 3.0.7 on 2020-06-13 08:40 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('reference', '0005_auto_2...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 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 Licens...
import json import pathlib import re import time from http.cookies import SimpleCookie import pytest from asgiref.testing import ApplicationCommunicator from asgi_auth_github import GitHubAuth as GitHubAuthOriginal from asgi_auth_github.utils import Signer, Response @pytest.fixture def require_auth_app(): retur...
''' Created on 03-Nov-2017 @author: karthikeyan ''' from com.mycompany.dbutil.reports_dbutil import DBUtil from sqlalchemy.orm import sessionmaker from com.mycompany.entities.report_data import ReportData class ReportService(object): dbutil = DBUtil() engine = dbutil.create_engine() Session = sessionmak...
import pygame import math wScreen = 1200 hScreen = 500 win = pygame.display.set_mode((wScreen,hScreen)) pygame.display.set_caption('Projectile Motion') class ball(object): def __init__(self,x,y,radius,color): self.x = x self.y = y self.radius = radius self.color = co...
import numpy as np import json import pickle import logging scaler = pickle.load(open("model/scaler.pkl", "rb")) def process_input(request_data: str) -> (list, np.array): """ Inference pipeline. Scales input values which can then be passed to machine learning algorithm :param request_data: str, which co...
import Cheetah.Template def render(template_file, **kwargs): ''' Cheetah.Django.render() takes the template filename (the filename should be a file in your Django TEMPLATE_DIRS) Any additional keyword arguments are passed into the template are propogated into the template'...
import pytest from verity_sdk.protocols.v1_0.PresentProof import PresentProof from verity_sdk.utils import COMMUNITY_MSG_QUALIFIER for_relationship = 'some_did' thread_id = 'some thread id' name = 'Degree Verification' proof_attrs = [ {'name': 'name', 'restrictions': [{'issuer_did': 'did:sov:12345'}]}, {'name...
from asyncio import Future import pytest from jeepney.routing import Router from jeepney.wrappers import new_method_return, new_error, DBusErrorResponse from jeepney.bus_messages import message_bus def test_message_reply(): router = Router(Future) call = message_bus.Hello() future = router.outgoing(call) ...
# -*- coding: utf-8 -*- # @Date : 2020/5/26 # @Author: Luokun # @Email : olooook@outlook.com import sys from os.path import dirname, abspath import numpy as np sys.path.append(dirname(dirname(abspath(__file__)))) def test_decision_tree(): from models.decision_tree import DecisionTree X = np.array([ ...
import _plotly_utils.basevalidators class YpadValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="ypad", parent_name="histogram2dcontour.colorbar", **kwargs ): super(YpadValidator, self).__init__( plotly_name=plotly_name, parent_nam...
""" WSGI config for fcp 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.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_...
from __future__ import annotations import datetime as dt from typing import Any, Tuple from dubious.discord.enums import InteractionEventTypes, opcode, tcode from pydantic import BaseModel, Field class Snowflake(str): def __init__(self, r: str|int): self.id = int(r) if isinstance(r, str) else r ...
""" Collection of style transformations. Think of it as a kind of color post processing after the rendering is done. This could be used for instance to change the contrast/saturation; swap light and dark colors or even change certain colors for other colors. When the UI is rendered, these transformations can be appli...
# MINLP written by GAMS Convert at 05/15/20 00:51:19 # # Equation counts # Total E G L N X C B # 4 0 2 2 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
#!/usr/bin/python # # Copyright 2018-2020 Polyaxon, 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 ...
c = str(input('O nome da cidade :')) print('santo' in c.lower())
#!/usr/bin/env python """Tests for `notion` package.""" import pytest from notion import notion @pytest.fixture def response(): """Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/fixture.html """ # import requests # return requests.get('https://github.com/audreyr/cookiecut...
​ import os import math import numpy as np import tensorflow as tf import matplotlib.pyplot as plt # ============================================================================ # -----------------生成图片路径和标签的List------------------------------------ train_dir = 'D:/tensorflow/practicePlus/googLeNet/dataset/input_data' ...
""" This module lets you practice the ITERATE-THROUGH-A-SEQUENCE pattern in its most classic form: -- Iterate all the way through the sequence, from beginning to end. Authors: David Mutchler, Valerie Galluzzi, Mark Hays, Amanda Stouder, their colleagues and Kaia Johnson. """ # DONE: 1. PUT YOUR NAME IN THE...
from huobi.connection.restapi_sync_client import RestApiSyncClient from huobi.constant.system import HttpMethod from huobi.utils import * from huobi.model.etf import * class PostEftSwapInService: def __init__(self, params): self.params = params def request(self, **kwargs): channel = "/etf/s...
from vector import Vector class Translatable(object): def __init__(self, position = (0, 0)): self.__position = Vector(position[0], position[1]) def set_position(self, position): self.__position = Vector(position[0], position[1]) def position(self): return self.__position def...
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016-2021 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
# -*- coding: utf-8 -*- from django.shortcuts import get_object_or_404, render from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse from django.views import generic import json # import db models from ..models import ChartAnnotation, Assessment, TaskType #Crud def create(reques...
""" Cisco_IOS_XR_mediasvr_linux_oper This module contains a collection of YANG definitions for Cisco IOS\-XR mediasvr\-linux package operational data. This module contains definitions for the following management objects\: media\-svr\: Media server CLI operations Copyright (c) 2013\-2018 by Cisco Systems, Inc. Al...
# Copyright (c) 2016-2017 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...
# -*- coding: utf-8 -*- # Copyright (c) 2021, Fafadia Tech and contributors # For license information, please see license.txt from __future__ import unicode_literals # import frappe from frappe.model.document import Document class BalanceIPUID(Document): pass
import RPi.GPIO as GPIO import logging log = logging.getLogger("gc.b") # Note choose a pin that has pull down on by default to avoid opening the door on reboot. DOORPIN = 17 ECHOPIN = 27 TRIGGERPIN = 22 REEDPIN = 23 def init(): """ Initializes GPIOS """ log.info("Setup GPIO") GPIO.setmode(GPIO.BCM) G...
""" This file evaluates CrossEncoder on the TREC 2019 Deep Learning (DL) Track: https://arxiv.org/abs/2003.07820 TREC 2019 DL is based on the corpus of MS Marco. MS Marco provides a sparse annotation, i.e., usually only a single passage is marked as relevant for a given query. Many other highly relevant passages a...
#!/usr/bin/env python # # Author: Sandeep Sharma <sanshar@gmail.com> # Sheng Guo <shengg@princeton.edu> # Qiming Sun <osirpt.sun@gmail.com> # ''' DMRG solver for CASCI and CASSCF. ''' import ctypes import os import sys import struct import time import tempfile from subprocess import check_call, check_...
from rest_framework import serializers from .models import Snippet, Event class SnippetSerializer(serializers.ModelSerializer): class Meta: model = Snippet fields = ('id', 'title', 'description', 'body', 'lang', 'created_by', 'created_on') class EventSerializer(serializers.Mod...
from random import * from turtle import * from freegames import vector bird = vector(0, 0) balls = [] def tap(x, y): "Move bird up in response to screen tap." up = vector(0, 30) bird.move(up) def inside(point): "Return True if point on screen." return -200 < point.x < 200 and -200 < point.y < 200...
from typing import Any, Dict, List, Type, TypeVar, Union import attr from ..models.contact_address import ContactAddress from ..types import UNSET, Unset T = TypeVar("T", bound="UpdateContactAddressResponse200") @attr.s(auto_attribs=True) class UpdateContactAddressResponse200: """ Attributes: objec...
import io import os import sys import django sys.path.append(os.path.join(os.path.dirname(__file__), "..")) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "infomate.settings") django.setup() import re import logging from datetime import timedelta, datetime from urllib.parse import urlparse from time import mktime imp...
"""Binary Sensor platform for Advantage Air integration.""" from homeassistant.components.binary_sensor import ( DEVICE_CLASS_MOTION, DEVICE_CLASS_PROBLEM, BinarySensorEntity, ) from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN from .entity import AdvantageAirEntity PARALLEL_UPDATES = 0 async def async...
# -*- python -*- def forward_files( srcs = [], strip_prefix = None, dest_prefix = None, visibility = None, tags = []): """Forwards files in `srcs` to be physically present in the current packages. Present implementation simply copies the files. @param srcs ...
# !/usr/bin/env python # -*- coding: utf-8 -*- import redis import os from login_jumper.utils import config from login_jumper.utils.get_logger import logger_generate logger = logger_generate() BASE_DIR = os.path.abspath(os.path.join(os.getcwd(), ".")) def redis_handler(mode='single'): file_path = os.path.join...
""" utility functions used in yubikey_config. """ # Copyright (c) 2010, Yubico AB # All rights reserved. __all__ = [ # constants # functions # classes 'YubiKeyConfigBits', 'YubiKeyConfigFlag', 'YubiKeyExtendedFlag', 'YubiKeyTicketFlag', ] class YubiKeyFlag(): """ A flag value, and ...
"""Initial Migration Revision ID: ab67ea40134e Revises: Create Date: 2020-11-03 16:20:25.216470 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ab67ea40134e' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto ...
# Copyright 2014 CloudFounders NV # # 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 writ...
from asyncio import sleep from pytest import fixture, mark from pytest_gather_fixtures import ConcurrentFixtureGroup Foo = ConcurrentFixtureGroup('Foo') @Foo.fixture async def s1(parallel_checker): with parallel_checker.context('1_start'): await sleep(0.1) return 1 @Foo.fixture async def s2(paral...
from app import create_app def test_config(): assert not create_app().testing def test_index(client): response = client.get('/') assert response.status_code == 200 def test_admin(client): response = client.get('/admin/') assert response.status_code == 200
import random """ Set of colors models for the RGB, HSV, and LAB color spaces. """ ''' The conversion between an RGB value to a LAB value is not one to one, each conversion requires an intermediary transformation to the XYZ color space, the XYZ color space depends on a specific illumination with its own set of refe...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Operator console widget # # Copyright (c) Honda Research Institute Europe GmbH # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source c...
#!/Users/joshuabrummet/workspace/senior-design/LISPAT/lispat_app/lispat/bin/python3 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
import discord from discord.ext import commands from random import randint from random import choice as randchoice import datetime import time import os import asyncio from copy import deepcopy from __main__ import send_cmd_help from .utils.dataIO import dataIO from .utils import checks DEFAULT_SETTINGS = {"FRIENDS":...