text stringlengths 1 927k |
|---|
#!/usr/bin/env python3
"""Generate `trn` files for Librispeech
Given a Librispeech directory, parse transcript files,
transcribe the corresponding audio, and generate hypothesis files.
"""
import os
import time
import logging
import argparse
from pathlib import Path
import torch
import torchaudio
import fairseq
impor... |
n = str(input('Digite o nome: '))
#Função input(): tem por objetivo de escrever a String passada como parâmetro e em seguida, ativar o modo de digitação, isto é, colocar o Console de uma determinada forma em que seja possível a digitação (entrada de dados).
#faz uma pausa no programa e espera uma entrada do usuário pel... |
#!/usr/bin/python
import EupathExporter
import re
class Genome:
def __init__(self, reference_genome):
"""
Teases out from the user's parameter, the reference genome information used in the construction of dependency
data. The reference genome parameter should be of the form: ProjectId-E... |
"""
WSGI config for textmatch 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_SET... |
# Copyright 2018 Sysdig
#
# 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... |
# Copyright 2022 Sony Semiconductors Israel, Inc. 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 b... |
from rest_framework import serializers
from .models import Employee, ZooPlace, AnimalType, Animal
class EmployeeSerializer(serializers.ModelSerializer):
class Meta:
model = Employee
fields = '__all__'
class ZooPlaceSerializer(serializers.ModelSerializer):
animal_count = serializers.ReadOnly... |
"""
Entity module tests
"""
import unittest
from txtai.pipeline import Entity
class TestEntity(unittest.TestCase):
"""
Entity tests.
"""
@classmethod
def setUpClass(cls):
"""
Create entity instance.
"""
cls.entity = Entity("dslim/bert-base-NER")
def testEnt... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-27 19:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('steps', '0005_auto_20170827_1925'),
]
operations =... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
"""
Handle chain info request
if chain info request is initiated the handler will execute those steps:
1. validate message
2. get chain info and summery
3. publish chain info and get cid
4. send the cid and summery
"""
from typing import Tuple
from blockchain import Blockchain
from network.ipfs import Node, Message
f... |
#ontwikkeld door S1118551
#We sturen in deze file een whatsapp bericht naar gebruiker wanner die wakker is geworden met de taken die hem te wachten staan op deze dag.
#mocht de gebruiker geen taak hebben op die dag, dan krijgt die een melding dat die goed bezig was de afgelopen dag
#Dit is een koppeling met subsyste... |
import os.path
import sys
import pytest
TEST_ROOT = os.path.dirname(__file__)
SRC_ROOT = os.path.dirname(TEST_ROOT)
DATASCIENCE_ROOT = os.path.join(SRC_ROOT, 'datascience')
if __name__ == '__main__':
sys.path.insert(1, DATASCIENCE_ROOT)
ec = pytest.main([
'--rootdir', SRC_ROOT,
TEST_ROOT,
... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/space/debris/shared_cargo_destroyed_large_a.iff"
result.attribute_templ... |
import socket
"""
TODO
Custom implementation of traceroute
It will only return data needed for the rest of the program (ip and time)
""" |
# qubit number=4
# total number=39
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
import numpy as np
OUTPUTS = [
'primary phone is valid',
'primary phone to name',
'primary phone to address',
'primary phone line type',
'primary phone is prepaid',
'primary phone is commercial',
'primary address is valid',
'primary address diagnostic',
'primary address to name',
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import torch
from tests import utils
class SimpleFloorModule(torch.nn.Module):
def forward(self, a, b):
c = a + b
return torch.floor(c)
class TestFloor(unittest.TestCase):
def test_floor(self... |
import logging
import time
from threading import Thread
from src.events import CREATE_LIMIT_ORDER, CREATE_MARKET_ORDER, GRID_INIT, GRID_RESET, ORDERS, POSITION, REMOVE_ALL_LIMIT_ORDERS, REMOVE_LIMIT_ORDER, REMOVE_MARKET_ORDER
from src.sessions import SESSIONS, get_session
class RestWorker:
def start(self, execut... |
import asyncio, datetime, discord, json, pycountry, random, re, requests, time, traceback
from aioconsole import ainput
from word2number import w2n
from client import *
from datamanager import config, del_data, get_data, has_data, mod_data, set_data, batch_set_data
from discordutils import *
from league import *
as... |
"""
Django settings for cfehome project.
Generated by 'django-admin startproject' using Django 2.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
#... |
# coding: utf-8
from keras.models import Sequential
from keras import layers
import numpy as np
import matplotlib.pyplot as plt
from six.moves import range
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--data_size', default='45000')
parser.add_argument('--train_size', default='4000... |
#!/usr/bin/env python
# coding: utf-8
import torch
import graphgallery
print("GraphGallery version: ", graphgallery.__version__)
print("Torch version: ", torch.__version__)
'''
Load Datasets
- cora/citeseer/pubmed
'''
from graphgallery.datasets import NPZDataset
data = NPZDataset('cora', root="~/GraphData/datasets/"... |
from typing import List
from tmtrader.entity.order import BasicOrder, FilledBasicOrder
from tmtrader.entity.trade import Trade
class OrderManager:
def __init__(self):
self.__open_orders: List[BasicOrder] = list()
self.__filled_orders: List[FilledBasicOrder] = list()
# TODO: refactor and ... |
#!/usr/bin/python3
# coding: utf-8
from tkinter import *
BGCOLOR="#229"
def Hochzaehlen(event=None):
sollwert.set(sollwert.get() + 1)
def Runterzaehlen(event=None):
sollwert.set(sollwert.get() - 1)
def Bestaetigen():
bestaetigen = "Eingestellter Sollwert " + str(sollwert.get())
confirm_label.config(... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
"""
Main part of nuqql.
"""
import logging
import os
import signal
import nuqql.backend
import nuqql.config
import nuqql.ui
logger = logging.getLogger(__name__)
# main loop of nuqql
def main_loop() -> str:
"""
Main loop of nuqql.
"""
logger.debug("entering main loop")
try:
# init and s... |
from datetime import datetime
from filetime import from_datetime, to_datetime, utc
def test_from_datetime():
assert from_datetime(datetime(2009, 7, 25, 23, 0)) == 128930364000000000
assert from_datetime(datetime(1970, 1, 1, 0, 0, tzinfo=utc)) == 116444736000000000
assert from_datetime(datetime(1970, 1, 1, 0, 0)) ... |
#!/bin/python
def is_valid_triangle(edges):
assert len(edges) == 3, "input should have 3 edges"
if edges[0] + edges[1] > edges[2] and edges[0] + edges[2] > edges[1] and edges[1] + edges[2] > edges[0]:
return True
else:
return False
def main():
response = is_valid_triangle([5, 10, 25])... |
# Generated by Django 3.2.4 on 2021-12-15 01:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
("submission", "0062_cfp_settings_data"),
]
operations = [
migrations.CreateModel(
... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, Radmon.
Use of this source code is governed by the MIT license that can be
found in the LICENSE file.
"""
from flask import render_template
from ..auth import auth
from ..blog import blog
def index():
return render_template('site/index.html')
def about():
ret... |
import unittest
from functools import wraps
def score_with(score):
def decorator(fn):
def decorated(*args,**kwargs):
ret = fn(*args,**kwargs)
if ret:
args[0].__class__._increase_score(score)
return ret
return decorated
return decorator
clas... |
""" Jeffreys divergences """
import torch
def jeffreys_normal(mu1, lv1, mu2, lv2):
mu1, lv1 = mu1.view(mu1.shape[0], -1), lv1.view(lv1.shape[0], -1)
mu2, lv2 = mu2.view(mu2.shape[0], -1), lv2.view(lv2.shape[0], -1)
return (0.25*((-lv1).exp() + (-lv2).exp())*(mu1-mu2)**2 + 0.25*((lv1-lv2).exp() + (lv2-lv1)... |
#!/usr/bin/env python
# coding: utf-8
"""
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met... |
import json
from flask import (
abort,
current_app,
flash,
redirect,
render_template,
session,
url_for,
)
from itsdangerous import SignatureExpired
from notifications_utils.url_safe_token import check_token
from app import user_api_client
from app.main import main
from app.main.forms impor... |
from setuptools import setup
requirements = ['ezdxf', 'shapely']
setup_requirements = ['pytest-runner', ]
test_requirements = ['pytest']
setup(
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
... |
# coding=utf-8
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... |
#
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 ... |
import sys, re
def get_repeated_substring(s):
l = len(s)
for i in xrange(l / 2, 0, -1):
for j in xrange(l - i + 1):
ss = s[j : j + i]
if not re.match("\s+", ss):
for k in xrange(i + j, l - i + 1):
if s[k : k + i] == ss:
... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import random
import torch
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
from torch.autograd import Variable
import numpy as np
from warpctc_pytorch import CTCLoss
import os
import utils
import datas... |
from .approx_max_iou_assigner import ApproxMaxIoUAssigner
from .assign_result import AssignResult
from .atss_assigner import ATSSAssigner
from .base_assigner import BaseAssigner
from .center_region_assigner import CenterRegionAssigner
from .max_iou_assigner import MaxIoUAssigner
from .point_assigner import PointAssigne... |
# -*- coding: utf-8 -*-
"""
Created on 28/10/2017
@author: Carlos Eduardo Barbosa
Detection of sources in data and separation of bins prior to Voronoi
tesselation
"""
from __future__ import division, print_function
import os
import pyregion
import numpy as np
from astropy.io import fits
from astropy.convolution im... |
#!/usr/bin/python3
# Copyright © 2012-2015 Graham Sellers
# 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... |
import json
import os
import sys
from ..functional_test import TestCase
class LuaTest(TestCase):
def test_satisfy_from_source(self):
with open(os.path.join(self.path(), 'needs.json'), 'w') as needs_file:
needs_file.write(json.dumps({
'libraries': {
'lua': {... |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google LLC. 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... |
"""
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com
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, m... |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... |
# Manter Ordem Alfabética
def join_list(lst, string=', '):
"""
:param lst: List to be joined
:param string: String that will be used to join the items in the list
:return: List after being converted into a string
"""
lst = str(string).join(str(x) for x in lst)
return lst
def unique_list(... |
#!/usr/bin/env python
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
The following is an example of how to use the asynchronous serial modbus
client implementation from pymodbus with twisted.
"""
from twisted.internet import reactor
from pymodbus.c... |
#!/usr/bin/env python
# encoding: utf-8
def build_log_urls(node, path):
url = node.web_url_for(
'addon_view_or_download_file',
path=path,
provider='osfstorage'
)
return {
'view': url,
'download': url + '?action=download'
}
class OsfStorageNodeLogger(object):
... |
#!/usr/bin/env python3
import requests
import string
import sys
import urllib
"""
POST /vulnerabilities/sqli_blind/ HTTP/1.1
Host: lab
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en... |
#!/usr/bin/env python
import os
import h5netcdf
from PIL import Image
import scipy.spatial
import scipy.ndimage
from veros import VerosSetup, veros_routine, veros_kernel, KernelOutput
from veros.variables import Variable
from veros.core.operators import numpy as npx, update, at
import veros.tools
BASE_PATH = os.pat... |
# coding=utf-8
# Copyright 2021 The init2winit 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 la... |
from coldtype.geometry.rect import Rect
def parse_inputs(inputs, defaults):
defaults["rect"] = [
Rect(1080, 1080),
lambda xs: Rect([int(x) for x in xs.split(",")])]
defaults["preview_only"] = [False, bool]
defaults["log"] = [False, bool]
parsed = {}
if not isinstance(inputs, dict... |
'''
Importance Sampling Simulation
------------------------------
This is the main module of the PyFPT code, as it runs the simulations, post
processes and exports the data ready for plotting.
'''
from timeit import default_timer as timer
import multiprocessing as mp
from multiprocessing import Process, Queue
import ... |
import sys, os
import win32api
import tempfile
import unittest
import gc
import pywintypes
import pythoncom
import winerror
from pythoncom import _GetInterfaceCount, _GetGatewayCount
import win32com
import logging
import _winreg
import cStringIO as StringIO
import pywin32_testutil
from pywin32_testutil import TestLoad... |
from abc import ABC, abstractmethod
from typing import List
import numpy as np
class Ledger(ABC):
@abstractmethod
def get_next_batch_id(self) -> int:
"""Return next available batch id."""
@abstractmethod
def get_next_transaction_id(self) -> int:
"""Return next available transaction i... |
# License: BSD Style.
from ...utils import verbose
from ..utils import _data_path, _get_version, _version_doc
@verbose
def data_path(path=None, force_update=False, update_path=True, download=True,
verbose=None):
"""
Get path to local copy of the kiloword dataset.
This is the dataset from [... |
import yaml
class ServiceArea(yaml.YAMLObject):
yaml_loader = yaml.SafeLoader
yaml_tag = u'!ServiceArea'
def __init__(self, area_type, area_name, instance_id, description, orientation_id = None, orientation_name = None, position = None, orientation = None):
self.area_type = area_type
... |
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
@app.get('/')
def main():
return 'root url'
@app.get('/json')
def json():
return {
"result": "json",
"sub_result": {"sub": "json"}
}
class Request(BaseModel):
id: int
body: str
@app.po... |
from django.urls import path
from adminpanel.views import (index,
WordCreateView, WordListView, WordUpdateView, WordDeleteView,
GrammarCreateView, GrammarListView, GrammarUpdateView, GrammarDeleteView,
LangCreateView, LangListVi... |
# Copyright (c) 2021, NVIDIA 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 by applic... |
from django.conf import settings
from django.db import models
class TaskTransaction(models.Model):
"Generated Model"
status = models.CharField(
max_length=10,
)
timestamp_completed = models.DateTimeField(
null=True,
blank=True,
)
task = models.ForeignKey(
"task.... |
# coding=utf-8
# Copyright 2019 The Open AI Team Authors and The HuggingFace Inc. 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
#
# ... |
#!/home/opc/py36env/bin/python
#################################################################################################################
# OCI - Scheduled Auto Scaling Script
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is licensed to you under the Universal Pe... |
from typing import Iterator, Optional
from algoliasearch.search_client import SearchClient
from nintendeals.commons.enumerates import Platforms
APP_ID = "U3B6GR4UA3"
API_KEY = "c4da8be7fd29f0f5bfa42920b0a99dc7"
INDEX_NAME = "ncom_game_en_us"
INDEX = None
PLATFORMS = {
Platforms.NINTENDO_3DS: "Nintendo 3DS",
... |
"""
Django settings for yatube project.
Generated by 'django-admin startproject' using Django 2.2.19.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
#... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
Django settings for DjYamosa project.
Generated by 'django-admin startproject' using Django 2.1.7.
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 json
import re
from string import rstrip
from urlparse import urljoin
from django.http import HttpResponseRedirect
from django.shortcuts import render
from cartoview.app_manager.models import *
from forms import BasicAppForm
from geonode import settings
from .models import *
APP_NAME = 'cartoview_esri_app_sta... |
import numpy as np
import pytest
from ...core import consume_config
from ..cwgan import ConditionalTuningCurveGenerator
from ..ssn import emit_tuning_curve_generator, ssn_type_choices
from ..wgan import DEFAULT_PARAMS
from .test_euler_ssn import JDS
TEST_PARAMS = dict(
DEFAULT_PARAMS,
# Stimulator:
num_tc... |
# Copyright 2017 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... |
# Description
# A sample Python REST API script to:
# - Load a saved configuration file
# - Run traffic
# - Get stats and evaluate for user defined expected stat values.
# - Get test result
#
# - For IxLoad Gateway running in Windows only. Linux Gateway is not supported at this time.
# - This... |
import operator
from functools import reduce, partial
from django import forms
from django.forms.formsets import all_valid
from django.urls import reverse
from django.contrib.admin.exceptions import DisallowedModelAdminToField
from django.contrib.admin import widgets, helpers
from django.contrib.admin.utils import (
... |
import re
from ..pattern.Pattern import Pattern
from .exceptions import (MemorySearchNotFoundException,
MemorySearchTooManyMatchException)
class MemorySearch:
def __init__(self, memory: bytes):
self.memory = memory
def find_pattern(self, pattern: Pattern) -> re.Match:
... |
import torch
from torch import nn
from torch.nn import init
from torch.utils.data import DataLoader
from overrides import overrides
import numpy as np
import time
from models.BaseModel import BaseModel
class PCAModel(BaseModel):
def __init__(self, configs: object):
super().__init__(configs.model.model_na... |
# Copyright 2013-present Barefoot Networks, Inc.
# Copyright 2018-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
# Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
from typing import Any, List, Tuple, Union
import numpy as np
import torch
from torch import nn
from doctr.models.preprocess... |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... |
# -*- 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.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... |
from django.contrib import admin
from .models import Event
# Register your models here.
admin.site.register(Event) |
"""
.. module:: CXData2.py
:platform: Unix
:synopsis: A class for coherent X-ray phasing data.
.. moduleauthor:: David Vine <djvine@gmail.com>
"""
import scipy as sp
import numpy as np
import scipy.fftpack as spf
import scipy.ndimage as spn
from numpy.random import uniform
from numpy import pad
import os
impo... |
def change_min_palindrome(s,que):
'''
# 在区间内更改最少的元素,使得它不包含长度2以上的回文
# 输入包括一系列区间查询,输出变更区间的最小成本
# 字符串只含有a,b,c
#https://codeforces.com/problemset/problem/1555/D
#*1600
#输入:
s:字符串
que:查询序列,每个查询为(l,r)表示区间范围,坐标从1开始
#返回:
ans:每个查询的答案
'''
#分析
#由于不能包含长度2以上的回文,且只有三种字符
#推... |
#!/usr/bin/python3
devices = {0x40: "K63",
0x17: "K65 RGB",
0x07: "K65",
0x37: "K65 LUX RGB",
0x39: "K65 RAPIDFIRE",
0x3f: "K68 RGB",
0x13: "K70 RGB",
0x09: "K70",
0x33: "K70 LUX RGB",
0x36: "K70 LUX",
... |
from datetime import datetime
import os
import platform
import sys
import time
import discord
from discord.ext import commands
import psutil
from constants import Constants
from library import resolver
start_time = datetime.now() # The time the script started running
class Statistics(commands.Cog):
def __init... |
from influxdb import InfluxDBClient
class InfluxConnection:
points = []
def __init__(self):
self.points = []
self.host = "host"
self.port = "port"
self.username = "user"
self.password = "pass"
self.database = "base"
self.client = InfluxDBClient(self.hos... |
#!/usr/bin/env python3
#
# Copyright 2021 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 -*-
# This is used (with minor differences) in both the class and the function
_AUTO_ARIMA_DOCSTR = \
"""Automatically discover the optimal order for an ARIMA model.
The auto-ARIMA process seeks to identify the most optimal
parameters for an ``ARIMA`` model, settling on a single fitted... |
"""
WSGI config for djangochat 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_SE... |
"""
Clock synchronizer
"""
import logging
import contextlib
from teuthology.orchestra import run
log = logging.getLogger(__name__)
@contextlib.contextmanager
def task(ctx, config):
"""
Sync or skew clock
This will initially sync the clocks. Eventually it should let us also
skew by some number of se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fsfs-reshard.py REPOS_PATH
# fsfs-reshard.py REPOS_PATH -target=MAX_FILES_PER_SHARD
#
# Display repository information about fsfs db.
#
# fsfs-reshard.py REPOS_PATH MAX_FILES_PER_SHARD
#
# Perform an offline conversion of an FSFS repository between linear (format
# 2, ... |
# Copyright 2001-2017 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
############################ Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
import sys
import operator
from dataclasses import dataclass
from collections import OrderedDict
from typing import Generic, TypeVar
T = TypeVar('T')
nil = None
class Nil:
def __init__(self):
global nil
if nil is None:
nil = self
return
raise ValueError("Nil canno... |
"""
MinerFees
"""
from .miner_fees_item import MinerFeesItem
class MinerFees:
"""
The total amount of fees that the purchaser will pay to cover BitPay's
UTXO sweep cost for an invoice. The key is the currency and the value
is an amount in satoshis. This is referenced as "Network Cost" on an
inv... |
# Authors: CommPy contributors
# License: BSD 3-Clause
from __future__ import division, print_function # Python 2 compatibility
from math import cos
from numpy import ones, inf, sqrt, array, identity, zeros, dot, trace, einsum, absolute, exp, pi, fromiter, kron, \
zeros_like, empty
from numpy.random import seed... |
'''
root module of the recommender app
'''
from flask import Flask, request, render_template
from recommender import recommend_nmf, recommend_random,recommend_neighbors,recommend_popular
from utils import movies,ratings,df_mov_avg_cnt, search_title,movie_to_id,id_to_movie,get_movieId
#where we define our Flask object... |
# Copyright 2015 Dell 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 agree... |
from .Abstractmesh import AbstractMesh
import numpy as np
from ..utils import IO, ObservableArray, deprecated, utilities
from ..utils.load_operations import get_connectivity_info_surface as get_connectivity_info
from ..utils.load_operations import compute_vertex_normals, compute_face_normals
from ..utils.load_operatio... |
"""
Copyright 2016-present Nike, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
You may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.