text
stringlengths
1
927k
"""Cross Domain Decorators""" from datetime import timedelta from functools import update_wrapper from flask import current_app, make_response, request from past.builtins import basestring from ..models.client import validate_origin def crossdomain( origin=None, methods=None, headers=( ...
# flake8: noqa import sys import subprocess from .exceptions import PyperclipException EXCEPT_MSG = """ Pyperclip could not find a copy/paste mechanism for your system. For more information, please visit https://pyperclip.readthedocs.org """ PY2 = sys.version_info[0] == 2 text_type = unicode if PY2 else str ...
# -*- coding: utf-8 -*- # # This file is 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 w...
#!/usr/bin/env python """ Simple example of a CLI that demonstrates fish-style auto suggestion. When you type some input, it will match the input against the history. If One entry of the history starts with the given input, then it will show the remaining part as a suggestion. Pressing the right arrow will insert this...
# coding: utf-8 """ Pure Storage FlashBlade REST 1.12 Python SDK Pure Storage FlashBlade REST 1.12 Python SDK. Compatible with REST API versions 1.0 - 1.12. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/...
from rest_framework import generics from api_v1.users.serializers import UserSerializer from users.models import User class UserListAPIView(generics.ListAPIView): serializer_class = UserSerializer queryset = User.objects.all().order_by("email")
# Copyright 2018 The TensorFlow Probability 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 applicable law o...
# Generated by Django 3.0.6 on 2020-06-18 01:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('RestAPIS', '0003_auto_20200618_0222'), ] operations = [ migrations.AlterField( model_name='verses_learned', name='st...
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import boto3 import json import logging import os import pymssql logger = logging.getLogger() logger.setLevel(logging.INFO) def lambda_handler(event, context): """Secrets Manager RDS SQL Server Handler ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer from os import curdir, sep PORT_NUMBER = 8083 #This class will handles any incoming request from #the browser class myHandler(BaseHTTPRequestHandler): #Handler for the GET requests def do_GET(self): if se...
import sqlite3 import click from flask import current_app, g from flask.cli import with_appcontext # g # g is a unique request object used to store data that might be accessed by multiple functions during the request. # Stored and re-used if called during the same request instead of creating a new connection def ge...
# Copyright (C) 2019 The Raphielscape Company LLC. # # Licensed under the Raphielscape Public License, Version 1.d (the "License"); # you may not use this file except in compliance with the License. # # Ported by @azrim """ Userbot module which contains afk-related commands """ from datetime import datetime import tim...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # varclass - Waqas Bhatti (wbhatti@astro.princeton.edu) - Oct 2017 # License: MIT. See the LICENSE file for more details. '''This contains various modules that obtain features to use in variable star classification. - :py:mod:`astrobase.varclass.starfeatures`: features r...
"""Support for Ubee router.""" import logging import voluptuous as vol from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA, DeviceScanner) from homeassistant.const import ( CONF_HOST, CONF_PASSWORD, CONF_USERNAME) import homeassistant.helpers.config_validation as cv REQUIREMENTS = [...
import csv import re def main(): run = True I_NUMBERS = 0 STUDENT_NAME = 1 path = 'E:/GitHub/2021-cs111-programming-with-functions/w09-text-files/teach-/students.csv' students = get_dictionary(path, I_NUMBERS, STUDENT_NAME) while run: print() number_student = input('Please enter an I-Number (xx-xxx-xxxx): ...
import os, sys __file__ = os.path.normpath(os.path.abspath(__file__)) __path__ = os.path.dirname(__file__) # print(__path__) if __path__ not in sys.path: sys.path.insert(0, __path__) from csharp_element import CSharpElement import csharp_utils class CSharpClassField(CSharpElement): def __init__(self, csh...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import os import random import unittest from datetime import datetime from tqsdk.test.api.helper import MockInsServer, MockServer from tqsdk import TqApi, TqBacktest class TestMdBasic(unittest.TestCase): """ 测试TqApi行情相关函数基本功能, 以及TqApi与行情服务器交互是否符合设计预期 ...
import numpy as np import offsetbasedgraph as obg from graph_peak_caller.postprocess.holecleaner import HolesCleaner from graph_peak_caller.sparsediffs import SparseValues import pytest @pytest.fixture def complicated_graph(): nodes = {i: obg.Block(2) for i in range(1, 11)} edges = {1: [2, 3], 2:...
from decimal import * def queueRequests(target, wordlists): req = '''GET /time.php HTTP/1.1 Host: portswigger-labs.net Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0 Connection: keep-alive ''' windo...
############################################################################## # Copyright (c) 2015 Orange # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompani...
# -*- coding: utf-8 -*- import pytest from resources.models import Equipment, ResourceEquipment, EquipmentCategory from django.urls import reverse from .utils import check_disallowed_methods, UNSAFE_METHODS @pytest.fixture def list_url(): return reverse('equipmentcategory-list') @pytest.mark.django_db @pytest....
# # 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...
# Copyright (c) 2011 Advanced Micro Devices, 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 of conditions...
#!/usr/bin/env python """ This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdicti...
from setuptools import setup setup( name="chippr", version="0.1", author="Alex Malz", author_email="aimalz@nyu.edu", url = "https://github.com/aimalz/chippr", packages=["chippr"], description="Cosmological Hierarchical Inference with Probabilistic Photometric Redshifts", long_descriptio...
import datetime import logging from . import DS_poller import azure.functions as func import os account_id = os.environ['ID'] customer_id = os.environ['WID'] shared_key = os.environ['WKEY'] key = os.environ['KEY'] secret = os.environ['SECRET'] connection_string = os.environ['STORE'] historical_days = 10 url = os.envi...
# MINLP written by GAMS Convert at 05/15/20 00:50:44 # # Equation counts # Total E G L N X C B # 49 49 0 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
"""Generated definition of rust_proto_library.""" load("//rust:rust_proto_compile.bzl", "rust_proto_compile") load("//internal:compile.bzl", "proto_compile_attrs") load("//rust:rust_proto_lib.bzl", "rust_proto_lib") load("@rules_rust//rust:rust.bzl", "rust_library") def rust_proto_library(name, **kwargs): # buildifi...
#!/usr/bin/env python3 import os import subprocess import click from rich import pretty, inspect from rich.console import Console # setup Rich pretty.install() console = Console() print = console.print log = console.log # setup click @click.command() @click.option('--dns-name', prompt='DNS Name', help='DNS name use...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. import io import math import os import shutil from typing import Any, Dict, Optional, Union import augly.audio.utils as audutils import ffmpeg import numpy as np from augly.utils import pathmgr, SILENT_AUDIO_PATH from augly.utils.ffmpeg import ...
#----------------------------------------------------------------------------- # Runtime: 32ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def myPow(self, x: float, n: int) -> float: if x == 0 or n == 1: return x ...
a = int(input('Digite um número inteiro: ')) b = int(input('Digite um outro número inteiro: ')) c = float(input('Digite um número real: ')) la = (a * 2) * (b / 2) lb = (a * 3) + c lc = c ** 3 print(f'O produto do dobro do primeiro número com metade do segundo número é igual a {la}') print(f'A soma do triplo do primeiro...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding 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-...
# Copyright 2015 NEC Corporation. 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 ...
# Generated by Django 2.0.7 on 2018-07-20 17:11 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
# Generated by Django 2.0.6 on 2018-06-22 04:21 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('api', '0002_delete_user'), ] operations = [ migrations.CreateModel( name='User', fields=[ ...
import torch import torch.nn as nn from torch.autograd import Variable class LockedDropout(nn.Module): def __init__(self): super().__init__() def forward(self, x, dropout=0.5, seq_lens=None): if not self.training or not dropout: return x if seq_lens == None: m ...
#!/usr/bin/env python3 import boto3 from botocore.exceptions import ClientError import os import logging import time from datetime import datetime as dt, timedelta, time import json # Assume basic scan setting has been set up in the private registry, otherwise the script throws error # Trigger manual scan for all im...
"""Support for Broadlink sensors.""" import logging import voluptuous as vol from homeassistant.components.sensor import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_POWER, DEVICE_CLASS_TEMPERATURE, PLATFORM_SCHEMA, STATE_CLASS_MEASUREMENT, SensorEntity, ) from homeassis...
""" Helper functions to get information about the environment. """ import importlib.util import os as python_os import subprocess import sys as python_sys from typing import Any, Optional from homura.liblog import get_logger logger = get_logger("homura.environment") # Utility functions that useful libraries are av...
import typing from collections import ( Counter, ) def solve( a: typing.List[int], ) -> typing.NoReturn: c = Counter(a) s = 0 for k, v in c.items(): s += min(v, k - 1) print(s) def main() -> typing.NoReturn: t = int(input()) for _ in range(t): n = int(input()) *a, = map( int, in...
# -*- coding: utf-8 -*- from ccxt.base.exchange import Exchange import hashlib from ccxt.base.errors import ExchangeError class southxchange (Exchange): def describe(self): return self.deep_extend(super(southxchange, self).describe(), { 'id': 'southxchange', 'name': 'SouthXchange...
from .AzureProvider import AzureProvider
# This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list o...
import copy import efficientnet.model as eff import keras_applications as ka from classification_models.models_factory import ModelsFactory from . import inception_resnet_v2 as irv2 from . import inception_v3 as iv3 from . import vgg19 class BackbonesFactory(ModelsFactory): _default_feature_layers = { # ...
""" Version of Alexnet with smaller input size and less weights """ import tensorflow as tf import numpy as np # input downscaled to 128x128x1 def alexnet(inputs, num_outputs=1, dropout_rate=0, reuse=None, is_training=False, verbose=False): """A basic al...
"""Project exceptions.""" from django.conf import settings from django.utils.translation import gettext_noop as _ from readthedocs.doc_builder.exceptions import BuildAppError, BuildUserError class ProjectConfigurationError(BuildUserError): """Error raised trying to configure a project for build.""" NOT_FO...
from __future__ import annotations from typing import Tuple, NoReturn from ...base import BaseEstimator import numpy as np from ...metrics import misclassification_error from itertools import product class DecisionStump(BaseEstimator): """ A decision stump classifier for {-1,1} labels according to the CART al...
import pandas as pd import numpy as np import xgboost # reading data hotel_data = pd.read_csv('cleaned_train.csv') X = hotel_data.drop(columns=['n_clicks', 'hotel_id']) # let's also add the new feature avg_saving_cash X['avg_saving_cash'] = X['avg_price'] * X['avg_saving_percent'] y = hotel_data['n_clicks'] # let's c...
from functools import partial import six from graphql_relay import from_global_id, to_global_id from ..types import ID, Field, Interface, ObjectType from ..types.interface import InterfaceMeta def is_node(objecttype): ''' Check if the given objecttype has Node as an interface ''' assert issubclass(...
"""Quick way to verify I provided matching download URL and MD5. """ import hashlib import json import pathlib import sys import requests def download_data(url): print('Downloading', url, '... ', end='', flush=True) response = requests.get(url) response.raise_for_status() print('Done') return re...
# Copyright 2015 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 writ...
import functools import datasets import seqio import t5 import tensorflow as tf import promptsource.templates from . import load_annotated_prompts, utils # Tasks deemed as clean/useful annotated_tasks = load_annotated_prompts.load_annotated_prompts() CLEAN_TASKS = [t["dataset_subset_template"] for t in annotated_t...
import pytest from assertpy import assert_that, fail import yaml import logging import filtergenerator.cli as cli import io import textwrap import tempfile import subprocess import os import sys from pprint import pprint as pp class Test_gen(): def test_stdoutに出力される(self, capfd): definitionfile = "sample.y...
import argparse, getpass, humanfriendly, os, shutil, sys, tempfile, time from .infrastructure import * from os.path import join def _getCredential(args, name, envVar, promptFunc): # Check if the credential was specified via the command-line if getattr(args, name, None) is not None: print('Using {} specified via ...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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 o...
# 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 ...
import openface import cv2 class FaceFinder: def __init__(self): self.align = openface.AlignDlib("models/dlib/shape_predictor_68_face_landmarks.dat") self.net = openface.TorchNeuralNet("models/openface/nn4.small2.v1.t7", 96) def getFaces(self, imgPath): bgrImg = cv2.imread(imgPath) ...
""" Working with calendars The calender """
from distutils.version import LooseVersion import os import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup version = '1.12.0.dev0' # Remember to update local-oldest-requirements.txt when changing the minimum # acme/certbot version. insta...
import unittest class Solution: def judgeCircle(self, moves): """ :type moves: str :rtype: bool """ lr = ud = 0 for move in moves: if move == 'L': lr += 1 elif move == 'R': lr -= 1 elif move == 'U':...
""" Base settings to build other settings files upon. """ from pathlib import Path import environ ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent # django_bulk_saving_benchmark/ APPS_DIR = ROOT_DIR / "django_bulk_saving_benchmark" env = environ.Env() READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_...
import os filePath2 = r'D:/downloads/cungudafa-keras-yolo3-master/keras-yolo3/dataset/phonts' filePath1 = r'D:/downloads/cungudafa-keras-yolo3-master/keras-yolo3/dataset/Annotations' list1 = os.listdir(filePath1) file_list1 = [] #annotations中的文件名列表 不带后缀 for i in list1: file_list1.append(os.path.splitext(i)[0]) # ...
"""Unit tests for aws parameter store interactions""" import importlib import sys from typing import Generator from unittest.mock import patch import pytest from secretbox import awsparameterstore_loader as ssm_loader_module from secretbox.awsparameterstore_loader import AWSParameterStore from tests.conftest import T...
""" Django settings for neighbour project. Generated by 'django-admin startproject' using Django 2.1.3. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os ...
import re class BasicPreprocessing: def __init__(self): self.name = "basic" def __call__(self, text: str): return clean_text(text) def clean_text(text): text = text.lower() text = replace_all(text, [ ("n't ", " not "), ("'ve ", " have "), ("'ll ", " will "), ...
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs from sklearn.cluster import Birch from sklearn.metrics import adjusted_rand_score # Set random seed for reproducibility np.random.seed(1000) nb_samples = 2000 batch_size = 80 if __nam...
from social_media.base import Engine from social_media.simulation import RandomBehaviour engine = Engine.select('hangouts') rb = RandomBehaviour(engine) engine.login(read_from_env=True) rb.pause(10, silent=False) rb.stay_on_page(duration=10) rb.driver.get("https://icons8.com/icons/set/git-fork") engine.close() # engin...
from django.shortcuts import render from products.models import Product from products.constants import ORDER_BY_CHOICES # Create your views here. def search_products(request): """ View that returns search results """ # Filter the products based on search results products = Product.objects.filter(name__i...
"""HackGatchina URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
# 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...
import pytest from datetime import datetime pytestmark = [ pytest.mark.django_db, pytest.mark.freeze_time('2032-12-01 15:30'), ] def test_works(order): assert order.paid is None order.set_paid() order.refresh_from_db() assert order.paid == datetime(2032, 12, 1, 15, 30) assert order.stud...
# Generated by Django 2.2.14 on 2020-07-05 08:16 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('HealthChecker', '0002_auto_20200704_1853'), ] operations = [ migrations.CreateModel( name='ClientCertificate', fiel...
import pytest from tests.actions.support.mouse import assert_move_to_coordinates, get_center from tests.actions.support.refine import get_events, filter_dict _DBLCLICK_INTERVAL = 640 # Using local fixtures because we want to start a new session between # each test, otherwise the clicks in each test interfere with ...
import logging from pyvisdk.exceptions import InvalidArgumentError ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) def LunHbaAssociation(vim, *args, **kwargs): '''This data object represents the lun, HBA a...
# pylint: disable=missing-function-docstring import numpy as np import numpy.testing as npt import pytest from quantify_scheduler.waveforms import ( square, drag, staircase, modulate_wave, rotate_wave, ) def test_square_wave(): amped_sq = square(np.arange(50), 2.44) npt.assert_array_equa...
from bs4 import BeautifulSoup import os import json import datetime import random import difflib import time import openWeather as OW def unix_time(dt): epoch = datetime.datetime.utcfromtimestamp(0) delta = dt - epoch return delta.total_seconds() def unix_time_millis(dt, tz): # add on some random mi...
import asyncio import logging from copy import copy from functools import partial from typing import List, Optional, Union import discord import TagScriptEngine as tse from redbot.core import commands from ..abc import MixinMeta from ..blocks import HideBlock from ..errors import RequireCheckFailure from ..http impor...
# Copyright 2018 BMW Car IT GmbH # # 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...
# 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 ...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import msgprint, _ import json import csv import six import requests from six import StringIO, text_type, string_types from frappe.utils import encode, c...
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure tha...
import json import os.path import unittest from unittest.mock import patch from instasave.utils import hook DATA = os.path.join( os.path.dirname(os.path.dirname(__file__)), "test_data", "json" ) class TestHooks(unittest.TestCase): def test_private_profile_returns_true(self): with open(os.path.join(D...
import tensorflow as tf (x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0 model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(filters=16, kernel_size=(3, 3), activation='relu'), tf.keras.layers.MaxPool2D(), tf.keras.layer...
from mpi4py import MPI from numpy import arange, empty comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() n = 10 data = empty(n, float) if rank == 0: data = arange(n, dtype=float) comm.Bcast(data, 0) if rank == 1: print("Received: " + str(data))
# server import socket # Import socket module port = 60000 # Reserve a port for your service. s = socket.socket() # Create a socket object host = socket.gethostname() # Get local machine name s.bind((host, port)) # Bind to the port s.listen(5) ...
import json import re import scrapy from locations.items import GeojsonPointItem class KristoilSpider(scrapy.Spider): name = "kristoil" item_attributes = { 'brand': "Kristoil" } allowed_domains = ["www.kristoil.com"] def start_requests(self): url = 'http://www.kristoil.com/wp-content/themes/kr...
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019-Present Datadog, Inc. from datadog_api_client.v2.model_utils import ( ApiTypeError, ModelSimple, ...
# This file is part of QuTiP: Quantum Toolbox in Python. # # Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: ...
# Generated by Django 2.0.2 on 2018-03-29 02:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('student', '0003_auto_20180329_0209'), ] operations = [ migrations.AlterField( model_name='india', name='Type', ...
#!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Class for bitcoind node under test""" import decimal import errno import http.client import json import log...
from statistics import median_low import mysql.connector import numpy as np import scipy.stats from ..forecasters.fc_abstract import Forecaster from delphi.epidata.client.delphi_epidata import Epidata import delphi.operations.secrets as secrets import delphi.utils.epiweek as flu from ..utils.forecast_type import Foreca...
""":mod:`wand.image` --- Image objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opens and manipulates images. Image objects can be used in :keyword:`with` statement, and these resources will be automatically managed (even if any error happened):: with Image(filename='pikachu.png') as i: print('width =', i.w...
import json from .oauth import OAuth2Test class SlackOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.slack.SlackOAuth2' user_data_url = 'https://slack.com/api/users.identity' access_token_body = json.dumps({ 'access_token': 'foobar', 'token_type': 'bearer' }) user_dat...
import uuid from ace.api.apikey import ApiKey import pytest key_value = "5dbc0b66-fcf7-4b98-a0f4-59e523dbba92" key_name = "test" key_description = "test description" key_is_admin = False @pytest.mark.parametrize( "key", [ ApiKey(api_key=key_value, name=key_name, description=key_description, is_admi...
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'requests', 'validators', 'packaging', 'lxml', 'gitchang...
import math import numpy as np def change_sample_rate(buffer: np.ndarray, current, target) -> np.ndarray: shape = [0, 0] shape[0] = buffer.shape[0] # RATEo = SAMPLESo # RATEm = (SAMPLESo / RATEo) * RATEm extend = target / current shape[1] = int(math.ceil(buffer.shape[1] * extend)) convert...
import pandas as pd import osmnx import numpy as np fix = {'西湖区,杭州市,浙江省,中国': 2} city_query = [ '杭州市,浙江省,中国', ] district_query = [ '上城区,杭州市,浙江省,中国', '下城区,杭州市,浙江省,中国', '江干区,杭州市,浙江省,中国', '西湖区,杭州市,浙江省,中国', '拱墅区,杭州市,浙江省,中国', '滨江区,杭州市,浙江省,中国', ] def query_str_to_dic(query_str): result = que...
# https://leetcode.com/problems/contains-duplicate class Solution: def containsDuplicate(self, nums): hs = set() for num in nums: hs.add(num) return len(hs) != len(nums)
#coding:utf-8 # overlap-add convolve with impulse response waveform import sys import os import argparse import numpy as np from scipy import signal from scipy.io.wavfile import read as wavread from scipy.io.wavfile import write as wavwrite # Check version # Python 3.6.4 on win32 (Windows 10) # numpy 1.16.3 # sc...