text stringlengths 1 927k |
|---|
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... |
"""
WSGI config for {{ project_name }} project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... |
import os
from itertools import islice
import numpy as np
import argparse
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from helper import roc, find_TAR_and_TH_by_FAR
def get_roc(path, start=1., stop=100., step=0.1):
batch_size = 1000
scores, gts = [], []
with open(path, 'r') as... |
"""
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 use this ... |
from ..Qt import QtGui, QtCore
from . import ArrowItem
import numpy as np
from ..Point import Point
import weakref
from .GraphicsObject import GraphicsObject
__all__ = ['CurvePoint', 'CurveArrow']
class CurvePoint(GraphicsObject):
"""A GraphicsItem that sets its location to a point on a PlotCurveItem.
Also rot... |
from datetime import timedelta
from operator import attrgetter
from functools import partial
import pytest
import pytz
import numpy as np
import pandas as pd
from pandas import offsets
import pandas.util.testing as tm
from pandas._libs.tslib import OutOfBoundsDatetime
from pandas._libs.tslibs import conversion
from p... |
for i in range(1,101) :
if(i % 2 != 0):
pass
else:
print(i,"is even number") |
import pprint
class VariableDict(dict):
def __init__(self):
super(VariableDict, self).__init__()
def __setitem__(self, key, value):
# print("你赋值了一个屑变量 %s=%s"%(key,value))
self.__dict__[key]=value
def __getitem__(self, item):
if item not in self.__dict__:
raise... |
"""
Trading-Technical-Indicators (tti) python library
File name: test_indicator_market_facilitation_index.py
tti.indicators package, _market_facilitation_index.py module unit tests.
"""
import unittest
import tti.indicators
from test_indicators_common import TestIndicatorsCommon
import pandas as pd
import re
c... |
from __future__ import print_function
from colorama import Fore
import os
import sys
from six.moves import input
from plugin import plugin
@plugin('file organise')
class File_Organise():
"""
Type file_organise and follow instructions
It organises selected folder based on extension
"""
def __call__... |
import pytest
from tests.torch_tests.functional import BaseFunctionalTest, TORCH_AVAILABLE, MODEL, DATA
from unittest import mock
class TestTorchInference(BaseFunctionalTest):
def test_get_acc(self):
from deeplite.torch_profiler.torch_inference import get_accuracy
assert get_accuracy(MODEL, DATA['t... |
import lda2vec.dirichlet_likelihood
import lda2vec.embed_mixture
import lda2vec.tracking
import lda2vec.preprocess
import lda2vec.corpus
import lda2vec.topics
import lda2vec.negative_sampling
dirichlet_likelihood = dirichlet_likelihood.dirichlet_likelihood
EmbedMixture = embed_mixture.EmbedMixture
Tracking = tracking.... |
import pickle
films = [
{
"id": 0,
"name": "Seven",
"genre": "thriller",
"lead_actor": "Lucy",
},
{
"id": 1,
"name": "Matrix",
"genre": "action",
"lead_actor": "Barry",
},
{
"id": 2,
"name": "Alien",
"genre": "t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_commands
----------------------------------
"""
import datetime
import imp
import os
import sys
import unittest
import unittest.mock as mock
from freezegun import freeze_time
import pytest
import scarlett_os
from scarlett_os import commands
# from scarlett_os... |
import random
import asyncio
import time
import os
import sys
import discord
import requests
from lxml import html
client = discord.Client()
@client.event
async def on_message(message):
if message.content.lower() == '!test':
await client.send_message(message.channel, 'hello, ' + message.author.mention)
... |
#!c:\users\pichau\gas01\venv\scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'future==0.18.2','console_scripts','futurize'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'future==0.18.2'
try:
from importlib.metadata import distribution
except ImportError:
try:
fro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# view jit.
#
import sys, os
import environment
try:
import pygame
except ImportError:
print "You need PyGame installed"
exit(1)
if os.system("dot -V") != 0:
print "You need the dot binary (from Graphviz) installed and in the PATH"
exit(1)
from rpyth... |
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import DATETIME
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import text
from sqlalchemy import TIMESTAMP
from sqlalchemy.engine.reflection import Inspe... |
# try to get PyPI package version
try:
from .version import version as __version__
except:
pass |
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import json
import os
import os.path as osp
import numpy as np
DIV_LINE_WIDTH = 50
# Global vars for tracking and labeling data at load time.
exp_idx = 0
units = dict()
def plot_data(data, xaxis='Epoch', value="TestEpRet",
condi... |
from processor.common import helper
from processor.common.protobuf import payload_pb2
import logging
# from processor.common.protobuf.payload_pb2 import Claim
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
class HealthCareState(object):
TIMEOUT = 3
def __init__(self, context)... |
################################################################################
# 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... |
# -*- coding: utf-8 -*-
# @Time : 2020/11/26 15:14
# @File : SecurityBase.py
# @Author : Rocky C@www.30daydo.com
import re
class StockBase:
def __init__(self):
pass
def valid_code(self,code):
pattern = re.search('(\d{6})', code)
if pattern:
code = pattern.group(1)
... |
from __future__ import print_function
import os
import sys
import subprocess as subp
import numpy as np
import scipy.io as scio
import spike_distance as sd
import spike_distance_mp as sdm
import metrics
def octave_spkd(st_one, st_two, cost):
"""
Creates an octave `m` file to run the spike train distance scri... |
#
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... |
#!/usr/bin/env python
#
# Copyright (c) 2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
handle a object sensor
"""
import rospy
from derived_object_msgs.msg import ObjectArray
from carla_ros_bridge.vehicle import Vehic... |
from __future__ import unicode_literals
import os
from filecmp import cmp
import glob
import shutil
import logging
import click
from drb.configure_logging import configure_root_logger
from drb.docker import Docker
from drb.spectemplate import SpecTemplate
from drb.path import getpath
from drb.downloadsources import ... |
import json
import os
import multiprocessing
import signal
import socket
import sys
import time
from six import iteritems
from mozlog import get_default_logger, handlers, proxy
from .wptlogging import LogLevelRewriter
here = os.path.split(__file__)[0]
repo_root = os.path.abspath(os.path.join(here, os.pardir, os.pard... |
import argparse
import os
import random
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as Data
from transformers_dir import *
from torch.autograd import Variable
from torch.utils.data import Dataset, WeightedRandomSampler
from read_data import... |
from importlib import import_module
import os
from toolz import merge
from catalyst import run_algorithm
# These are used by test_examples.py to discover the examples to run.
from catalyst.utils.calendars import register_calendar, get_calendar
EXAMPLE_MODULES = {}
for f in os.listdir(os.path.dirname(__file__)):
... |
# %%
from __future__ import print_function
# make sure the setup is correct everywhere
import os
import sys
# change working directory to src
from IPython import get_ipython
import experiment
from experiment.util.file import get_parameters
# make sure it's using only GPU here...
os.environ["CUDA_VISIBLE_DEVICES"] =... |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file ... |
from setuptools import setup
with open("README.rst", "rb") as f:
long_description = f.read()
setup(
name='Speech-Hacker',
packages=['Speech-Hacker'],
version='2.3',
scripts=['Speech-Hacker/Speech-Hacker','Speech-Hacker/generator.py',
'Speech-Hacker/trainer.py'],
description="Makes... |
from django.core.exceptions import ValidationError
from web3 import Web3
def validate_checksumed_address(address):
if not Web3.isChecksumAddress(address):
raise ValidationError(
'%(address)s is not a valid ethereum address',
params={'address': address},
) |
import tensorflow as tf
from custom_scripts.node_classifier_modified import make_node_classifier
def make_skipgram(**kwargs):
""" Uses the skipgram objective for relational data
Returns
-------
A model function for skipgram edge prediction (with a nonsense vertex classifier attached for testing conve... |
import pandas as pd
import pytest
from kgextension.link_exploration import link_explorer
class TestLinkExplorer:
def test1_default(self):
df_input = pd.read_csv("test/data/link_exploration/link_exploration_test_input.csv")
expected_result = pd.read_csv("test/data/link_exploration/link_exploration_... |
#!/usr/bin/env python3
from http import HTTPStatus
from socketserver import ThreadingMixIn
from urllib.parse import urlparse
from ruamel.yaml.comments import CommentedMap as OrderedDict # to avoid '!!omap' in yaml
import threading
import http.server
import json
import queue
import socket
import subprocess
import time
... |
import base64
import json
import os
import sys
import urllib.parse as urlparse
from loguru import logger
from httprunner.ext.har2case import utils
try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
IGNORE_REQUEST_HEADERS = [
"host",
"accept",
"content... |
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd. and others
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... |
from conans import ConanFile, CMake
class TypeLiteConan(ConanFile):
version = "0.1.0"
name = "type-lite"
description = "Strong types for C++98, C++11 and later in a single-file header-only library"
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
url = "https:/... |
from config_default import *
# 使用你自己的配置项覆盖默认的配置项
# 例如下面一行
HOST = "0.0.0.0"
# 完整的配置项列表见config_default下的*.py文件
# 永远不要直接修改config_default下的任何文件! |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# log
#
# Query log messages from analytics
#
import sys
import argparse
import json
import datetime
import logging
import logging.handlers
import time
import re
from opserver_util import OpServerUtils
from sandesh_common.vns.tt... |
from typing import Optional
from unittest import TestCase
from unittest import skipUnless
from unittest.mock import Mock
from unittest.mock import patch
from urllib.error import URLError
from responses import mock as mock_responses
from opwen_email_server.config import SENDGRID_KEY
from opwen_email_server.services.se... |
import logging
from collections import defaultdict
from .utils import SimulatedDateTime
from ..baseflumine import BaseFlumine
from ..clients import BaseClient
from ..events import events
from .. import utils
from ..exceptions import RunError
from ..order.order import OrderTypes
logger = logging.getLogger(__name__)
... |
import logging
from rest_framework import serializers
from baserow.api.utils import get_serializer_class
from baserow.api.serializers import get_example_pagination_serializer_class
from baserow.core.utils import model_default_values, dict_to_object
from baserow.contrib.database.fields.registries import field_type_reg... |
import tcod as libtcod
from components.inventory import Inventory
def menu(con, header, options, width, screen_width, screen_height):
if len(options) > 26: raise ValueError('Ny yll rol synsi moy es 26 dewis.')
# calculate total height for the header (after auto-wrap) and one line per option
header_height... |
from django.urls import path
from . import views
urlpatterns = [
path('/1/<str:text>/', views.text),
path(r'/2/<str:url>', views.voice)
] |
import datetime
import unittest
from test.support import cpython_only
try:
import _testcapi
except ImportError:
_testcapi = None
import struct
import collections
import itertools
import gc
class FunctionCalls(unittest.TestCase):
def test_kwargs_order(self):
# bpo-34320: **kwargs should preserve ... |
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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, publish,... |
"""
@Author Marco A. Gallegos
@Date 2020/12/31
@Update 2020/12/31
@Description
The config manager is a class to manage the configuration file by default in ~/.commitclirc
"""
import distutils.util
import os
import pathlib
import re
from configmanager.config import Configuration
class ConfigManager(object):
... |
from django import http
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
import pytest
from mock import Mock, patch
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.access import acl
from olympia.files.decorators import allowed
class AllowedTest(TestCase):
def ... |
import networkx as nx
import helpers.DataLoader as dataLoader
import matplotlib.pyplot as plt
import helpers.DataLoader as data
class Question2_3:
def main(self):
"""
Caclulate the indegree and outdegree distribution of the given graph
"""
# Load the data
data = dataLoader... |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... |
#
# 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 us... |
import os
import subprocess
import sys
import torch
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CUDA_HOME
# ninja build does not work unless include_dirs are abs path
this_dir = os.path.dirname(os.path.abspath(__file__))
def get_cuda_bare_metal_ve... |
# 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... |
"""
MetVocab : MMD Vocabulary Class Tests
=====================================
Copyright 2021 MET Norway
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... |
from typing import Optional, List
from pydantic import BaseModel, Field
from app.models.k8s_resource.io.k8s.api.core.v1 import PersistentVolumeClaimSpec
from app.models.k8s_resource.io.k8s.apimachinery.pkg.apis.meta.v1 import ObjectMeta
class PvcInCreate(BaseModel):
metadata: ObjectMeta = Field(
...,
... |
# CPU: 0.05 s
def hcf(x, y):
if x == 0:
return y
return hcf(y % x, x)
input()
rings = list(map(int, input().split()))
for idx in range(1, len(rings)):
factor = hcf(rings[0], rings[idx])
print(f"{rings[0] // factor}/{rings[idx] // factor}") |
import spacy
nlp = spacy.blank("en")
# 导入Doc类
from spacy.tokens import Doc
# 目标文本:"Go, get started!"
words = ["Go", ",", "get", "started", "!"]
spaces = [False, True, True, False, False]
# 使用words和spaces创建一个Doc
doc = Doc(nlp.vocab, words=words, spaces=spaces)
print(doc.text) |
# -*- coding: utf-8 -*-
#
# GraphQL-core 3 documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 21 16:28:30 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... |
#!/usr/bin/python3
from login import LoginClass
def get_playlists_recursive(count, reps, user, playlists):
try:
if count > 20:
get_playlists_recursive(count - 20, reps + 1, user, playlists)
playlists += user.get_playlists(playlist_limit=count, offset=(reps * 50))
except ValueError... |
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# dkratzert@gmx.de> wrote this file. As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is worth it, you can buy me... |
#!/usr/bin/env python
"""Launch qemu tests."""
import argparse
import errno
import json
import logging
import os
import shutil
import subprocess # nosec
import sys
import tempfile
import traceback
import urllib.parse
import urllib.request
from distutils.util import strtobool
import productmd.compose
import yaml
# h... |
# Storage capacity and run time calculation.
#
# Stanley H.I. Lio
# hlio@hawaii.edu
# MESH Lab
# University of Hawaii
import math
SPI_FLASH_SIZE_BYTE = 16*1024*1024
SPI_FLASH_PAGE_SIZE_BYTE = 256
SPI_FLASH_PAGE_COUNT = SPI_FLASH_SIZE_BYTE/SPI_FLASH_PAGE_SIZE_BYTE
#SAMPLE_PER_SECOND = 1/60
SAMPLE_PER_SECOND = 5
# N... |
# Copyright 2015 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 .currency_class import CurrencyClass
class EURClass(CurrencyClass):
def __init__(self, balance):
self.currency = super().eur_currency
self.balance = balance
def converter(self):
return round(self.balance * self.currency, 2)
def info(self):
return (
"[EUR]... |
import abc
class PipelineStepBase(metaclass=abc.ABCMeta):
def take_pipeline(self, left, right):
pass
@abc.abstractmethod
def has_left(self) -> bool:
raise NotImplementedError("Abstract method not implemented!")
@abc.abstractmethod
def has_right(self) -> bool:
raise NotIm... |
num_seconds = int(input())
print(num_seconds // 3600, num_seconds // 60) |
import subprocess
import pdb
import sys
glb_group =''
glb_event = ''
def run_instance(Txy, Tf, Tc):
cmd = 'icpc -O3 -Ofast -march=native -fopenmp -I../Vary_Layout_UKR/build -DLKF=16 -DLC=1 -DLOF=1 -DuNf=128 -DuNx=68 -DuNy=68 -DuNc=256 -DuNw=1 -DuNh=1 -DEdgeXY=4 -DuSx=1 -DuSy=1 testbed_likwid.cpp'
cmd += ' -DLIK... |
# Copyright (c) 2013 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 applica... |
"""
==================================
Store and load rider power-profile
==================================
This example illustrates how to store the information contained in a
:class:`sksports.Rider` instance.
"""
print(__doc__)
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License: MIT
##############... |
import os, fnmatch, sys, importlib, time, argparse
from rich.console import Console
from rich.table import Table
from rich.style import Style
# TODO testTransferRequests.py
loadTests = [ 'testLoad' ]
singleTests = []
def isRunTest(name:str) -> bool:
if args.runAll: # run all tests
return True
if len(singl... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-07-29 20:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('topics', '0002_topic_description_text'),
]
operations = [
migrations.RenameField(
... |
import turtle
tortuguita = turtle.Turtle()
tortuguita.color('blue')
tortuguita.speed(100)
for i in range (18):
tortuguita.circle(200,100)
tortuguita.left(110)
tortuguita.up()
tortuguita.left(35)
tortuguita.forward(160)
tortuguita.down()
tortuguita.dot(70,"black")
tortuguita.left(60)
tortuguita.up
tortuguita... |
from thrift.protocol import TCompactProtocol
from thrift.transport import THttpClient
from ttypes import LoginRequest
import json, requests, LineService
nama = 'Alka'
Headers = {
'User-Agent': "Line/2.1.5",
'X-Line-Application': "CHROMEOS\t2.1.5\t"+nama+"\t11.2.5",
"x-lal": "ja-US_US",
}
de... |
import pandas as pd
import numpy as np
from scipy.integrate import odeint
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error, mean_squared_error
def logistic_R0(t, R_0_start, k, x0, R_0_end):
"""
R0 moduled as logistic function
"""
return (R_0_start - R... |
# Copyright 2020 NVIDIA. 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 applicable law or agree... |
# Esse script é uma implementação de agentes em Python
# Vamos revisar os conceitos abordados no Capítulo 2
# Neste script você encontra a especificação da classe Python que cria o Agente
# No Jupyter Notebook anexo, você encontra a utilização do Agente
# from grid import *
from statistics import mean
import random
... |
# String masquerading as ppm file (version P3)
import io
ppmfileout = io.StringIO('')
def writeppmp3(self, f):
self.writeppm(f, ppmformat='P3')
def writeppm(self, f, ppmformat='P6'):
assert ppmformat in ['P3', 'P6'], 'Format wrong'
magic = ppmformat + '\n'
comment = '# generated from Bitmap.writeppm\n... |
"""Utilities to help with developing using bcbio inside of docker.
"""
import copy
import datetime
import glob
import math
import os
import shutil
import subprocess
import sys
import boto
import numpy
import yaml
from bcbio import utils
from bcbio.distributed import objectstore
from bcbio.pipeline import genome
from ... |
# 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
from... |
import numpy as np
import pandas as pd
import pytest
import featuretools as ft
from featuretools.computational_backends.feature_set import FeatureSet
from featuretools.computational_backends.feature_set_calculator import (
FeatureSetCalculator
)
from featuretools.primitives import (
Absolute,
AddNumeric,
... |
def closest_numbers(l):
l.sort()
d = 10**7
idx = []
for i in range(1, len(l)):
x = l[i] - l[i-1]
if x < d:
d = x
idx = [i-1]
elif x == d:
idx.append(i-1)
for i in idx:
print l[i], l[i+1],
n = int(raw_input())
l = map(int, raw_input().split())
closest_numbers(l) |
# 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)
from spack import *
class Externaltest(Package):
homepage = "http://somewhere.com"
url = "http://somewhere.... |
import psycopg2
from funcionario import Funcionario
class FuncionarioDAO():
def conectar(self):
banco = "dbname=flask user=postgres password=postgres host=localhost port=5432"
return psycopg2.connect(banco)
def buscarFuncionario(self, codigo):
conexao = self.conectar().cursor()
... |
"""Tests for PyBryt's various annotations""" |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by Roberto Preste
import pytest
import prestools.clustering as pc
import numpy as np
# pc.hierarchical_clustering
def test_hierarchical_clustering_empty_df(sample_empty_df):
expect = None
result = pc.hierarchical_clustering(sample_empty_df)
assert r... |
from __future__ import absolute_import, division, print_function
import sys
import traceback
import logging
log = logging.getLogger(__name__)
def traceback_with_local_vars():
tb = sys.exc_info()[2]
while 1:
if not tb.tb_next:
break
tb = tb.tb_next
stack = []
f = tb.tb_fr... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$',
views.RootRedirectionView.as_view(),
name="root"),
# Step by step
url(r'^getting-started/$',
views.GettingStartedView.as_view(),
name="getting-started")
] |
# Generated by Django 4.0 on 2021-12-28 21:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0008_remove_customuser_address_profile_address_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='addres... |
# 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 python3
import vapoursynth as vs
import audiocutter
from subprocess import call
import shutil
import os
core = vs.core
ts_in = r"ac.mkv"
src = core.lsmas.LWLibavSource(ts_in)
ac = audiocutter.AudioCutter()
vid = ac.split(src, [(24,2182)])
ac.ready_qp_and_chapters(vid)
vid.set_output(0)
if __name__ ... |
import argparse
from collections import defaultdict
import networkx as nx
import numpy as np
from gensim.models.keyedvectors import Vocab
from six import iteritems
from sklearn.metrics import (auc, f1_score, precision_recall_curve,
roc_auc_score)
from walk import RWGraph
def parse_args(... |
import time
import threading
import cv2
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a ne... |
# 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:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
import torch
def get_test_devices():
"""Creates a string list with the devices type to test the source code.
CUDA devices will be test only in case the current hardware supports it.
Return:
list(str): list with devices names.
"""
devices = ["cpu"]
if torch.cuda.is_available():
... |
import pyomo.environ as pe
import pyutilib.th as unittest
import romodel as ro
class TestUncParam(unittest.TestCase):
def test_simple_uncparam(self):
m = pe.ConcreteModel()
m.p = ro.UncParam()
m.pnom = ro.UncParam(nominal=3)
self.assertEqual(m.pnom.nominal, 3)
self.assertEq... |
import os
import time
import torch
import argparse
import numpy as np
from inference import infer
from utils.util import mode
from hparams import hparams as hps
from torch.utils.data import DataLoader
from utils.logger import Tacotron2Logger
from utils.dataset import ljdataset, ljcollate
from model.model import Tacotro... |
from __future__ import print_function
import tarfile
import yaml
from shutil import copyfile, copytree, rmtree
import numpy as np
import os
import re
import glob
from collections import OrderedDict
from hls4ml.writer.writers import Writer
from hls4ml.model.hls_layers import XnorPrecisionType
config_filename = 'hls4ml... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.