text
stringlengths
1
927k
"""Draws squares around detected faces in the given image.""" import argparse from google.cloud import vision from PIL import Image, ImageDraw def detect_face(face_file, max_results=4): """Uses the Vision API to detect faces in the given file. Args: face_file: A file-like object containing an image w...
from fastapi import APIRouter, status from mongoengine import errors from access360.api.model import accountModel from access360.api.model.userMixin import AccountManager from access360.view.generalMixin import Access360FullMixin from access360.api.model.AccountPydanticModel import UserRegisterationInput, UserLoginIn...
import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) import numpy as np import matplotlib.pyplot as plt; import cmath; from TMM_functions import run_TMM_simulation as rTMM ## GOAL: simulate a BRAGG MIRROR at some wavelength (1 micron) ...
#!/usr/bin/env python import explorerhat from time import sleep from random import randint #the explorer hat has already some motor functions build in #invert() - Reverses the direction of forwards for this motor #forwards( speed ) - Turns the motor "forwards" at speed ( default 100% ) #backwards( speed ) - Turns the ...
# Day20 - 2021 Advent of code # source: https://adventofcode.com/2021/day/20 import os import numpy as np def clear_console(): os.system('clear') print('< .... AoC 2021 Day 20, part 1 .... >') print() return # convert from pixels to binary "...#...#." -> "000100010" def pix_2_binary(the_9_pixels): ...
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Script that reads omahaproxy and gsutil to determine a version of the sdk_tools bundle to use. Please note the differences betw...
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test some PROJ.4 specific translation issues. # Author: Frank Warmerdam <warmerdam@pobox.com> # ###########################################...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import datetime import hashlib import logging import time from bisect import bisect_right from collections import OrderedDict, defaultdict fro...
from abc import ABC, abstractmethod from app.shared.operation import Operation class APIModelBase(ABC): def __init__(self): self.detail: str = "" self.status_code: int | None = None self.was_successful: bool = False @abstractmethod def exec(self) -> None: pass @abstr...
import numpy as np from pynwb import NWBFile from rec_to_nwb.processing.exceptions.missing_data_exception import MissingDataException from rec_to_nwb.processing.nwb.components.position.time.invalid.fl_pos_invalid_time_builder import \ FlPosInvalidTimeBuilder from rec_to_nwb.processing.tools.beartype.beartype impor...
# The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False import logging from pip._internal.build_env import BuildEnvironment from pip._internal.distributions.base import AbstractDistribution from pip._internal.exceptions import InstallationError from pip._internal.uti...
from __future__ import division, print_function, absolute_import import math import random from collections import deque import torch from PIL import Image from torchvision.transforms import ( Resize, Compose, ToTensor, Normalize, ColorJitter, RandomHorizontalFlip, Pad ) class Random2DTranslation(object): """...
# !/usr/bin/env python # -- coding: utf-8 -- # @Author zengxiaohui # Datatime:8/31/2021 2:50 PM # @File:SpaceToDepthModuleConv import torch import torch.nn as nn class SpaceToDepth(nn.Module): def __init__(self, block_size=4): super().__init__() assert block_size == 4 self.bs = block_size ...
#%% import rasterio from pathlib import Path import matplotlib.pyplot as plt from blend_modes import blending_functions from utils import get_dem_data, load_shapefile, crop_raster, save_raster, make_ramp dem_path: Path = Path("https://planetarymaps.usgs.gov/mosaic/Mars_MGS_MOLA_DEM_mosaic_global_463m.tif") cropped_r...
import gym import railrl.torch.pytorch_util as ptu from railrl.data_management.obs_dict_replay_buffer import ObsDictRelabelingBuffer from railrl.exploration_strategies.base import \ PolicyWrappedWithExplorationStrategy from railrl.exploration_strategies.gaussian_and_epislon import \ GaussianAndEpislonStrategy ...
# coding: utf8 { '\n Ao clicar no botão "enviar" abaixo, você estará concordando com os termos de uso acima descritos': '\n Ao clicar no botão "enviar" abaixo, você estará concordando com os termos de uso acima descritos', '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the r...
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-11-09 15:29 from __future__ import unicode_literals import uuid import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ...
from .base import BaseDetector from .single_stage import SingleStageDetector from .two_stage import TwoStageDetector from .rpn import RPN from .fast_rcnn import FastRCNN from .faster_rcnn import FasterRCNN from .mask_rcnn import MaskRCNN from .cascade_rcnn import CascadeRCNN from .htc import HybridTaskCascade from .ret...
# A Python plugin for Domoticz to access airly api for smog information in Poland # # Author: fisher # # TODO: Update text sensors only when changed # # # v0.1.0 - initial version, fetching data from airly sensor # v0.1.1 - response body decode - error handling, minor language corrections # v0.1.2 - removed gettext bas...
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: Shulai Zhang ## Microsoft Research ## yuyua@microsoft.com ## Copyright (c) 2021 ## ## This source code is licensed under the MIT-style license found in the ## LICENSE file in the root directory of this source tree ##++++++++++++...
import tensorflow as tf class VariationalAutoencoder(object): def __init__(self, n_input, n_hidden, optimizer = tf.train.AdamOptimizer()): self.n_input = n_input self.n_hidden = n_hidden network_weights = self._initialize_weights() self.weights = network_weights # model ...
import numpy as np import pandas as pd import tensorflow as tf class MRNetDataset(): def __init__(self, root_dir, task, plane, train=True, transform=None, weights=None): self.task = task self.plane = plane self.root_dir = root_dir self.train = train if self.train: ...
import time import torch import torch.nn.functional as F def train_runtime(model, data, epochs, device): if hasattr(data, 'features'): x = torch.tensor(data.features, dtype=torch.float, device=device) else: x = None mask = data.train_mask if hasattr(data, 'train_mask') else data.train_idx...
# -*- coding: utf-8 -*- ''' integration tests for mac_softwareupdate ''' # Import python libs from __future__ import absolute_import # Import Salt Testing libs from tests.support.unit import skipIf from tests.support.case import ModuleCase from tests.support.helpers import destructiveTest, skip_if_not_root # Import ...
from migen import * from litex.soc.interconnect import stream burst_lengths = { "SDR": 1, "DDR": 4, "LPDDR": 4, "DDR2": 4, "DDR3": 8, "DDR4": 8 } class Settings: def set_attributes(self, attributes): for k, v in attributes.items(): setattr(self, k, v) class ...
import os import torch from osgeo import gdal import numpy as np from warnings import warn from .model_io import get_model from .transform import process_aug_dict from .datagen import InferenceTiler from ..raster.image import stitch_images, create_multiband_geotiff from ..utils.core import get_data_paths class Infere...
# MIT License # # Copyright (c) 2020 Airbyte # # 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, publ...
from .fluxcal import * from .flatfield import * from .apextract import * from .identify import * from .imtools import * from .wrappers import * from .version import __version__
#-*- coding: UTF-8 -*- import xlrd import sqlite3 import pprint import os,sys ''' 商品id itemid VARCHAR(12) 商品名称 itemname NVARCHAR(255) 商品主图 itempic VARCHAR(255) 商品详情页链接地址 itemdesclink VARCHAR(255) 商品一级类目 itemcats VARCHAR(100) 淘宝客链接 taobaokelink VARCHAR(255) 商品价格(单位:元) itemprice ...
TELEGRAM_V2_2 = ( '/ISk5\\2MT382-1004\r\n' '\r\n' '0-0:96.1.1(00000000000000)\r\n' '1-0:1.8.1(00001.001*kWh)\r\n' '1-0:1.8.2(00001.001*kWh)\r\n' '1-0:2.8.1(00001.001*kWh)\r\n' '1-0:2.8.2(00001.001*kWh)\r\n' '0-0:96.14.0(0001)\r\n' '1-0:1.7.0(0001.01*kW)\r\n' '1-0:2.7.0(0000.00*kW...
import sys import traceback import logging logger = logging.getLogger(__name__) def logging_traceback(): exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) error_message = ''.join(lines) logger.error(error_message)
from typing import Dict, Union, List, Optional import ray from ray._raylet import ObjectRef from ray._raylet import PlacementGroupID from ray._private.utils import hex_to_binary from ray.util.annotations import PublicAPI, DeveloperAPI from ray.ray_constants import to_memory_units from ray._private.client_mode_hook imp...
from django.apps import AppConfig class AppLicencesConfig(AppConfig): name = 'app_licences'
""" This code contains test tasks for luigi Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov """ import os import luigi from emit_main.workflow.workflow_manager import WorkflowManager from emit_main.workflow.slurm import SlurmJobTask class ExampleTask(SlurmJobTask): config_path = luigi.Paramet...
# Copyright 2013-2022 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) import os from spack.util.environment import is_system_path class Tcl(AutotoolsPackage, SourceforgePackage): """Tcl...
""" An enhanced distutils, providing support for Fortran compilers, for BLAS, LAPACK and other common libraries for numerical computing, and more. Public submodules are:: misc_util system_info cpu_info log exec_command For details, please see the *Packaging* and *NumPy Distutils User Guide* secti...
# -*- coding: utf-8 -*- """ test_ext_githubpages ~~~~~~~~~~~~~~~~~~~~ Test sphinx.ext.githubpages extension. :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from util import with_app @with_app('html', testroot='ext-githubpages') def t...
#!/usr/bin/env python #===----------------------------------------------------------------------===## # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===------------...
import torch from torch import nn from torchvision.ops import MultiScaleRoIAlign from ..utils import load_state_dict_from_url from .faster_rcnn import FasterRCNN from .backbone_utils import resnet_fpn_backbone __all__ = [ "KeypointRCNN", "keypointrcnn_resnet50_fpn" ] class KeypointRCNN(FasterRCNN): """ ...
# WILLIAM BARBOUR # UNIV 5360 # ASSIGNMENT 1: PYTHON # 01/22/2018 # PART 7 # SPARQL # --------------------------------------------------------------- # datadotworld module has been imported as dw import datadotworld as dw # We've written a SPARQL query for you and assigned it to the `sparql_query` variable: sparql_...
from compas.geometry import Point, Polyline from compas.utilities import meshgrid, flatten from compas_view2.app import App from compas_occ.geometry.curves import BSplineCurve from compas_occ.geometry.surfaces import BSplineSurface points1 = [] points1.append(Point(-4, 0, 2)) points1.append(Point(-7, 2, 2)) points1....
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Copyright (c) 2017-2020 The Raven Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the listtransactions API.""" from io import ...
import os, json, sys, re, random, time import requests, inquirer from jinja2 import Template from termcolor import colored root = os.path.dirname(os.path.realpath(__file__)) JSON_FILE = root + '/json.json' ARR_FILE = root + '/arr.json' MAP = { '名词': 'n.', '动词': 'vt.', '形容词': 'adj.', '副词': 'adv.', '介词': 'pr...
import typing from dataclasses import dataclass from starlette.datastructures import URL, QueryParams @dataclass class PageControl: text: str url: URL = None is_active: bool = False is_disabled: bool = False def inclusive_range(st: int, en: int, cutoff: int) -> typing.List[int]: """ Return ...
# DO NOT LOAD THIS FILE. Load envoy_build_system.bzl instead. # Envoy test targets. This includes both test library and test binary targets. load("@rules_python//python:defs.bzl", "py_binary", "py_test") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load("@rules_fuzzing//fuzzing:cc_defs.bzl", "fu...
from django.contrib.auth import get_user_model from django.db import models import uuid UserModel = get_user_model() class Project(models.Model): title = models.CharField(max_length=20, unique=True) description = models.TextField() link = models.URLField(null=True) image = models.ImageField(upload_t...
""" Mask R-CNN Configurations and data loading code for the synthetic Shapes dataset. This is a duplicate of the code in the noteobook train_shapes.ipynb for easy import into other notebooks, such as inspect_model.ipynb. Copyright (c) 2017 Matterport, Inc. Licensed under the MIT License (see LICENSE for details) Writt...
# Generated by Django 3.0.6 on 2020-06-05 18:18 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('digital_books', '0008_digital_book_rating'), ('inventories', '0067_auto_20200605_0418'), ] operations = [ ...
import unittest #from moto import mock_s3 import boto3 import pandas from lore.io import download from tests.mocks.features import UserWarehouseSearchesFeature class TestFeatures(unittest.TestCase): #@mock_s3 def xtest_s3_features(self): s3 = boto3.resource('s3') # We need to create the bu...
"""Part of the training engine related to Python generators of array data. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import warnings import numpy as np from .training_utils import is_sequence from .training_utils import iter_sequence_infinite from...
from honeybee_schema.radiance.modifier import Plastic, Glass, BSDF, Glow, Light, \ Trans, Mirror, Metal from copy import copy from pydantic import ValidationError import pytest import os import json # target folder where all of the samples live root = os.path.dirname(os.path.dirname(__file__)) target_folder = os.p...
# Copyright 2013-2022 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.package import * class Nlcglib(CMakePackage, CudaPackage): """Nonlinear CG methods for wave-function opti...
"""Tests for the switchbot integration.""" from unittest.mock import patch from homeassistant.const import CONF_MAC, CONF_NAME, CONF_PASSWORD, CONF_SENSOR_TYPE from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry DOMAIN = "switchbot" ENTRY_CONFIG = { CONF_NAME: "test-name", ...
import os import time from flask import Flask def create_app(test_config=None): """Create and configure an instance of the Flask application.""" time.sleep(10) app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( # a default secret that should be overridden by instanc...
#! usr/bin/env python import random from collections import OrderedDict, Counter # Custom imports from . import GlobalConstants as GC from . import configuration as cf from . import static_random from . import InputManager, Engine from . import CustomObjects, StateMachine, AStar, Support, Dialogue, Cursor from . impor...
# 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 u...
#!/usr/bin/env python ################################################## ## DEPENDENCIES import sys import os import os.path try: import builtins as builtin except ImportError: import __builtin__ as builtin from os.path import getmtime, exists import time import types from Cheetah.Version import MinCompatib...
#!/usr/bin/python3 """ imports API App for gunicorn configurations gunicorn --bind 127.0.0.1:8002 wsgi.wsgi_api:app.app """ app = __import__('api.v1.app', globals(), locals(), ['*']) if __name__ == "__main__": """runs the main flask app""" app.app.run()
# Copyright (c) Kuba Szczodrzyński 2021-5-6. import os from .primes import PRIMES class DiffieHellman: _prime: int _private_key: int _public_key: int _shared_key: int @staticmethod def _to_bytes(a: int) -> bytes: return a.to_bytes((a.bit_length() + 7) // 8, byteorder="big") de...
# http://codingbat.com/prob/p165097 def front_times(str, n): result = "" for i in range(n): if len(str) < 3: result += str else: result += str[0:3] return result
import tempfile import os import requests from tqdm import tqdm from rich import print as rprint from felicette.constants import band_tag_map workdir = os.path.join(os.path.expanduser("~"), "felicette-data") def check_sat_path(id): data_path = os.path.join(workdir, id) if not os.path.exists(data_path): ...
#!c:\users\reiya\pycharmprojects\lineworks\venv\scripts\python.exe # $Id: rst2latex.py 5905 2009-04-16 12:04:49Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ A minimal front end to the Docutils Publisher, producing LaTeX. """ try: import ...
""" Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. This model provider translation classes that convert between JSON and Python Dictionaries. """ import java.io.FileNotFoundException as J...
from ..regular.regular import refresh_from_dict class Export(): """ An export object is metadata. ie Status, etc. Exporting sample patterns: A) Call generate_export() from a job object (or directory coming soon) It will return JSON or a URL directly and is blocking. Note, we maintain generate_export() as o...
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # https://doc.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals class QiubaiSpiderMiddleware(object): # Not all methods need to be defined. If a method is not defined, # scrapy a...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pytest import solutions.day5.solver as solver def test_solver1(): # act output = solver.solver1([0, 3, 0, 1, -3]) # assert assert output == 5 def test_solver1_jumps(): # arrange jumps = [0, 3, 0, 1, -3] # act solver.solver1(ju...
# -*- coding: utf-8 -*- import logging from elasticsearch import Elasticsearch from functools import partial LOGGER = logging.getLogger(__name__) STORAGE_DEFAULTS = { 'host': '127.0.0.1', 'port': '9200', 'db_name': 'bridge_db', 'alias': 'bridge' } class ElasticsearchStorage(object): def __init_...
from collections import defaultdict from typing import List, Union, Dict from pkg_resources import iter_entry_points from oarepo_oai_pmh_harvester.transformer import OAITransformer from oarepo_oai_pmh_harvester.utils import infinite_dd from . import config from .provider import OAIProvider from .synchronization impor...
# Generated by Django 3.1.2 on 2021-03-11 13:06 from django.db import migrations from ..utils import read_sql_from_file class Migration(migrations.Migration): dependencies = [ ("salingo", "0001_sku_to_date") ] operations = [ migrations.RunSQL(read_sql_from_file('update_prices.sql')) ...
""" Calculates interpolation tables for elliptical integral of the first and second kind. """ import math import numpy as np from math import sin, cos, sqrt from scipy import integrate from scipy.interpolate import interp1d from scipy.special import ellipk, ellipe # These are complete elliptic integrals of the first an...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
#!/usr/bin/python2.5 # Copyright 2009-2010 by Ka-Ping Yee # # 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 ...
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\fame\fame_handlers.py # Compiled at: 2019-02-12 19:48:29 # Size of source mod 2**32: 1335 bytes from...
from django.contrib import admin from .models import Deployment, CurrentPackage class DeploymentAdmin(admin.ModelAdmin): list_display = ('env', 'app', 'package', 'ticket', 'jenkins_build_url') class CurrentPackageAdmin(admin.ModelAdmin): list_display = ('env', 'app', 'package', 'ticket', 'jenkins_build_url...
try: from .engine import create_supervised_trainer except ImportError: # no ignite def create_supervised_trainer(*args, **kwargs): raise ImportError('Ignite not installed') from .modules import (Lambda, Flatten, View, Concat, ...
#!/usr/bin/python3 from __future__ import annotations from json import loads from os.path import abspath, dirname, join class Language: ''' This class will hold information about a certain langauge ''' _countrySpecific = '' def __init__(self, iso3, iso, name): self.iso3 = iso3 ...
import unittest import pandas as pd import numpy as np from ..timeseries import TimeSeries from ..utils.missing_values import auto_fillna, na_ratio class MissingValuesTestCase(unittest.TestCase): time = pd.date_range('20130101', '20130130') lin = [float(i) for i in range(len(time))] cub = [float(i - 4) ...
import os from robolearn.old_utils.plots.policy_cost import plot_policy_cost from robolearn.old_utils.plots.specific_cost import plot_specific_cost from robolearn.old_utils.plots.duals import plot_duals from robolearn.old_utils.plots.policy_final_distance import plot_policy_final_distance method = 'gps' # 'gps' or 't...
""" Code by Tae-Hwan Hung(@graykode) https://en.wikipedia.org/wiki/Normal_distribution """ import numpy as np from matplotlib import pyplot as plt def gaussian(x, n): u = x.mean() s = x.std() # divide [x.min(), x.max()] by n x = np.linspace(x.min(), x.max(), n) a = ((x - u) ** 2) / (2 * (...
#!/usr/bin/env python """ Pure-Python Implementation of the AES block-cipher. Benchmark AES in CTR mode using the pyaes module. """ import perf from six.moves import xrange import pyaes # 23,000 bytes CLEARTEXT = b"This is a test. What could possibly go wrong? " * 500 # 128-bit key (16 bytes) KEY = b'\xa1\xf6%\x8c...
# Copyright 2013-2020 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) import argparse import llnl.util.tty as tty import spack.cmd import spack.repo description = "revert checked out packag...
#!/usr/bin/env python3 # # Copyright 2015 Dovetail Genomics LLC # # from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import map from builtins import str from builtins import range from builtins import object import pickle as pickle debug=False ...
# -*- coding: utf-8 -*- ######################################################################## # # License: BSD # Created: 2005-05-24 # Author: Ivan Vilata i Balaguer - ivan@selidor.net # # $Id$ # ######################################################################## """Utilities for PyTables' test suites.""" fr...
import tensorflow as tf import os import math import time import numpy import unittest tf.compat.v1.disable_eager_execution() from sklearn.neighbors import KernelDensity from kde_histogram import KDEHistogram from histogram_max import * session = None def get_session(): global session if not session: ...
# Copyright (C) 2013 Ion Torrent Systems, Inc. All Rights Reserved from django import http from django.contrib.auth.decorators import login_required from django.template import RequestContext from django.shortcuts import render_to_response, get_object_or_404, \ get_list_or_404 from django.conf import settings from...
# -*- coding: utf-8 -*- """ Characterisation Plotting ========================= Defines the characterisation plotting objects: - :func:`colour.plotting.plot_single_colour_checker` - :func:`colour.plotting.plot_multi_colour_checkers` """ from __future__ import division import numpy as np from colour.models impo...
from office365.runtime.client_value import ClientValue class InvitationParticipantInfo(ClientValue): """This resource is used to represent the entity that is being invited to a group call.""" pass
from setuptools import setup, find_packages import os # Check if OpenCV is installed and raise an error if it is not # but don't do this if the ReadTheDocs systems tries to install # the library, as that is configured to mock cv2 anyways READ_THE_DOCS = (os.environ.get("READTHEDOCS", "False") == "True") NO_CV2_INSTALL...
""" Utilities for working with the Telegram API itself (such as handy methods to convert between an entity like a User, Chat, etc. into its Input version) """ import base64 import binascii import imghdr import inspect import io import itertools import logging import math import mimetypes import os import pathlib import...
import tensorflow as tf @tf.function def f(): for i in range(10): print(i) f() f()
# Generated by Django 1.11.7 on 2018-01-13 14:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("submission", "0022_submission_review_code"), ] operations = [ migrations.AddField( model_name="submission", name="i...
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.async_support.base.exchange import Exchange # ----------------------------------------------------------------------------- try...
""" Copyright 2022 RPANBot 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, software distrib...
from pythonwarrior.abilities.base import AbilityBase class Rest(AbilityBase): def description(self): return "Gain 10% of max health back, but do nothing more." def perform(self): if self._unit.health < self._unit.max_health: amount = int(self._unit.max_health * 0.1) if...
import matplotlib.pyplot as plt; import numpy as np; import math data = np.loadtxt('spatial.txt', skiprows=1); x = data[:,0]; V = data[:,1]; E = data[:,2]; n = data[:,3]; p = data[:,4]; s = data[:,5]; NA = data[:,6]; NC = data[:,7]; Jn = data[:,8]; Jp = data[:,9]; J_NA = data[:,10]; J_NC = data[:,11]; J_disp = data[:...
from typing import Tuple from torch.utils.data import IterDataPipe class StreamReaderIterDataPipe(IterDataPipe[Tuple[str, bytes]]): r""" :class:`StreamReaderIterDataPipe` Iterable DataPipe to load IO stream with label name, and to yield bytes with label name in a tuple args: chunk : bytes to ...
#!/usr/bin/env python # # Copyright (c) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
# 数据类型 # int money = 28 print(type(money)) # <class 'int'> # float money = 28.9 print(type(money)) # <class 'float'> # String money = '10000' print(type(money)) # <class 'str'> money = "100000" print(type(money)) # <class 'str'> message = '"Ryan Fawcett"' print(message) message = "'Ryan Fawcett'" print(messag...
from django.db import models # Create your models here. class Notes(models.Model): title = models.CharField(max_length=255) content = models.TextField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True) modified_at = models.DateTimeField(auto_now=True) class Meta: ...
def conv(x): return int(''.join(t[c] for c in x)) b = input().split() N = int(input()) a = [input() for _ in range(N)] t = {b[i]: str(i) for i in range(10)} a.sort(key = lambda x: conv(x)) print(*a, sep='\n')