content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
import numpy as np
import pandas as pd
import os
def prm_to_df(prm):
"""Convert prm to a pandas DataFrame"""
values = list(prm.values())
columns = list(prm.keys())
df_prm = pd.DataFrame(columns=columns)
for value, column in zip(values, columns):
df_prm[column] = [value]
return (df_prm)... | nilq/baby-python | python |
import time
import random
#import pygame
import threading
'''
Start with the person in an empty room with zombies coming at them. The maze, is part of the "nice to have" section, but not pertinent.
'''
class Zombies:
def __init__(self, xcor, ycor):
self.xcor = xcor
self.ycor= ycor
self.image = ''
#the above e... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from .schema import dump, load
from .loaded import LoadedValue
from .schema import CallableFunc
__all__ = ['dump', 'load', 'LoadedValue', 'CallableFunc']
| nilq/baby-python | python |
#!/usr/bin/env python
# Author: CloudNClock @ github
# Date 2020/01/26
# Usage: DDNS updating for namesilo
import urllib3
import xmltodict
import requests
import time
import sys
import datetime
import configparser
import xml.etree.ElementTree as ET
# Update DNS in namesilo
def update(currentIP,recordID,targetDomain... | nilq/baby-python | python |
import torch
from abc import ABCMeta, abstractmethod
from torchtrainer.utils.mixins import CudaMixin
from .callbacks import Callback, CallbackContainer, History
from .meters import ZeroMeasurementsError
from enum import Enum
from itertools import chain
from torch.autograd import Variable
from .utils.defaults import pa... | nilq/baby-python | python |
version = '0.66'
short_version = version
full_version = version
| nilq/baby-python | python |
from flask import url_for
from authentek.database.models import User
def test_get_user(client, db, user, admin_headers):
# test 404
user_url = url_for('api.user_by_id', user_id="100000")
rep = client.get(user_url, headers=admin_headers)
assert rep.status_code == 404
db.session.add(user)
db.se... | nilq/baby-python | python |
''' setup
'''
import re
import io
from distutils.command.build_ext import build_ext as build_ext_orig
from setuptools import setup, find_packages, Extension
# source: https://stackoverflow.com/a/39671214
__version__ = re.search(
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
io.open('nei_vcf/__init__.py', encoding... | nilq/baby-python | python |
#!/usr/bin/env python3
"""opencv module tests"""
import sys
import os
import inspect
import logging
import cv2
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
from matplotlib import ticker
from matplotlib.colors import LinearSegmentedColormap
logger = logging.getLogger("OPENCV")
d... | nilq/baby-python | python |
# Generated by Django 3.2.7 on 2021-09-03 10:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(sett... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import pytest
from great_expectations.core import (
ExpectationConfiguration,
ExpectationValidationResult,
)
from great_expectations.render.renderer.renderer import Renderer
def test_render():
# ??? Should this really return the input object?
# Seems like raising NotImplemente... | nilq/baby-python | python |
from MyCodes.personal import title, inputInt, inputFloat
from urllib.request import urlopen
title('Exercício 113', 50, 34)
a = inputInt('Digite um valor inteiro: ')
b = inputFloat('Digite um valor real: ')
print(f'O valor inteiro é {a} e o valor real é {b:.1f}.')
title('Exercício 114', 50, 34)
try:
pag = urlopen(... | nilq/baby-python | python |
# Copyright 2017 Gustavo Baratto. 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... | nilq/baby-python | python |
from .block import *
from .chain import *
__version__ = "0.0.1"
| nilq/baby-python | python |
import time
from multiprocessing.pool import ThreadPool
from core.events import EventHandler
from core.keystore import KeyStore as kb
from core.packetcap import pktcap
from core.actionModule import actionModule
from core.mymsf import myMsf
class msfActionModule(actionModule):
seentargets = dict()
def __init... | nilq/baby-python | python |
string = 'emir','zarina','baizak','nazira'
string = string.replace('emir','vanya')
print(string)
| nilq/baby-python | python |
# 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... | nilq/baby-python | python |
import os
import tempfile
from pathlib import Path
from test.splitgraph.commands.test_commit_diff import _alter_diff_splitting_dataset
from test.splitgraph.conftest import API_RESOURCES, OUTPUT
from unittest import mock
from unittest.mock import call, patch, sentinel
import httpretty
import pytest
from click import Cl... | nilq/baby-python | python |
name = "CheeseBurger" | nilq/baby-python | python |
import json
import requests
from requests.auth import HTTPBasicAuth as BasicAuth
from requests.packages import urllib3
from urllib3.exceptions import InsecureRequestWarning
urllib3.disable_warnings(InsecureRequestWarning)
url = "https://sbx-nxos-mgmt.cisco.com:443/ins"
username = "admin"
password = "Admin_1234!"
da... | nilq/baby-python | python |
# Generated by Django 2.1 on 2019-05-15 22:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_app', '0006_deviceconfig_last_modify'),
]
operations = [
migrations.AlterField(
model_name='deviceconfig',
name='... | nilq/baby-python | python |
class Diplomacy:
"""
Respresents every player diplomacy stances with others
"""
def __init__(self, stances=None):
"""
Initialize Diplomacy
Args:
stances (list(int)): stances with other player
Note:
there's 8 stances with other players
"""... | nilq/baby-python | python |
from portfolyo import dev, testing
from portfolyo.tools import frames
from numpy import nan
import portfolyo as pf
import numpy as np
import pandas as pd
import pytest
@pytest.mark.parametrize("series_or_df", ["series", "df"])
@pytest.mark.parametrize("bound", ["right", "left"])
@pytest.mark.parametrize(
("in_val... | nilq/baby-python | python |
import sublime
from ui.read import settings as read_settings
from ui.write import write, highlight as write_highlight
from lookup import file_type as lookup_file_type
from ui.read import x as ui_read
from ui.read import spots as read_spots
from ui.read import regions as ui_regions
from core.read import read as core_rea... | nilq/baby-python | python |
import random, time, torch
import numpy as np
from nlplingo.oregon.event_models.uoregon.define_opt import opt
from nlplingo.oregon.event_models.uoregon.tools.utils import *
from nlplingo.oregon.event_models.uoregon.models.pipeline._01.readers import read_abstract_train_data
from nlplingo.oregon.event_models.uoregon.mod... | nilq/baby-python | python |
from dbnd._core.cli.click_utils import _help
from dbnd._core.cli.service_auto_completer import completer
from dbnd._core.task_build.task_registry import get_task_registry
from dbnd._vendor import click
@click.command()
@click.argument("search", default="", autocompletion=completer.config())
@click.option("--module", ... | nilq/baby-python | python |
# Copyright 2016 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.
"""The page cycler v2.
For details, see design doc:
https://docs.google.com/document/d/1EZQX-x3eEphXupiX-Hq7T4Afju5_sIdxPWYetj7ynd0
"""
from core import pe... | nilq/baby-python | python |
from typing import List
from machine.params import Parameters
from machine.plugin import Plugin
from machine.connection import Connection
from machine.plugin import PluginGenerator, PluginResult
class Sequence(Plugin):
def __init__(self, plugins: List[PluginGenerator]):
assert len(plugins) > 0, "Sequence... | nilq/baby-python | python |
# You are given N pairs of numbers.
# In every pair, the first number is always smaller than the second number.
# A pair (c, d) can follow another pair (a, b) if b < c.
# Chain of pairs can be formed in this fashion.
# You have to find the longest chain which can be formed from the given set of pairs.
dp = [[0]*10... | nilq/baby-python | python |
""" This is the geo_mean atom.
geo_mean(x,y) = sqrt(x * y)
If either x or y is a vector, the atom is applied elementwise.
It is a CONCAVE atom. It is DECREASING in the first argument, and
DECREASING in the second argument.
It returns a SCALAR expression if the both arguments are SCALAR.
... | nilq/baby-python | python |
import torch
__TESTS__ = { }
def get_tests():
for k, v in __TESTS__.items():
yield k, v
def register(test):
name = getattr(test, "__name__", test.__class__.__name__)
if name in __TESTS__:
raise RuntimeError(f'Encountered a test name collision "{name}"')
__TESTS__[name] = test
retu... | nilq/baby-python | python |
from os import path
from glob import glob
from cStringIO import StringIO
import numpy as np
import h5py
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
from util import sort_nicely, veclen, filter_reindex
def convert_sequence_to_hdf5(filename_pattern, loader_function, hdf_ou... | nilq/baby-python | python |
# This script created by Joseph Aaron Campbell - 10/2020
# this script references https://www.agisoft.com/forum/index.php?topic=10564.msg47949#msg47949
# Use this as a learning tool only.
# I am not responsible for any damage to data or hardware if the script is not properly utilized.
# Following Code tested and ba... | nilq/baby-python | python |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
AWS_SDK_VER = "2.16.19"
AWS_KINESIS_VER = "2.3.4"
JACKSON_VER = "2.10.4"
def external_plugin_deps():
maven_jar(
name = "junit-platform",
artifact = "org.junit.platform:junit-platform-commons:1.4.0",
sha1 = "34d9983705c953b97abb01e1cd04647f4727... | nilq/baby-python | python |
import collections
from typing import List
from thinglang.lexer.values.identifier import Identifier, GenericIdentifier
from thinglang.symbols.merged_symbol import MergedSymbol
from thinglang.symbols.symbol import Symbol
from thinglang.utils import collection_utils
class SymbolMap(object):
"""
Describes a sym... | nilq/baby-python | python |
# encoding:utf-8
from numpy import *
import math
import copy
import pickle
class C4_5DTree(object):
def __init__(self): # 构造方法
self.tree = {} # 生成的树
self.dataSet = [] # 数据集
self.labels = [] # 标签集
def loadDataSet(self, path, labels, split):
recordlist = []
with open... | nilq/baby-python | python |
import logging
import subprocess
import sys
class Spotify():
def __init__(self, args):
logging.info("Spotify Connect client started.")
command = "spotifyd --no-daemon"
self.process = subprocess.Popen(command, shell=True)
def stop(self):
self.process.kill()
l... | nilq/baby-python | python |
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from children.views import ChildrenTemplateView, ChildrenDetailView, ChildrenUpdateView
from children.views import ChildrenCreateView, ChildrenDeleteView, ChildListJson
urlpatterns = [
ur... | nilq/baby-python | python |
from biosimulators_utils.model_lang.bngl.validation import validate_model, read_model
from biosimulators_utils.utils.core import flatten_nested_list_of_strings
import os
import shutil
import tempfile
import unittest
class BgnlValidationTestCase(unittest.TestCase):
FIXTURE_DIR = os.path.join(os.path.dirname(__file... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/security_keys.py
#
# 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, th... | nilq/baby-python | python |
import sys
nodes = []
class node:
value = -1
visited = False
dist = 2e30
prev = None
idx = -1
neighbors = []
def __init__(self, v):
self.value = v
def getNeighbors(x,y,input):
result = []
if y>1:
result.append(input[y-1][x])
if y+1<len(input):
result.ap... | nilq/baby-python | python |
#!/usr/bin/env python
from distutils.core import setup
setup(name='Ignition',
version='0.1.8',
description='Run multiple programs in a specific order and monitor their state',
author='Luka Cehovin',
author_email='luka.cehovin@gmail.com',
url='https://github.com/lukacu/ignition/',
packages=['ignition'],
scripts... | nilq/baby-python | python |
from ..class_boids import Boids
import numpy as np
from nose.tools import assert_equal,assert_almost_equal
import os
import yaml
def init_trial_boids():
pathtofile = 'fixtures/regression_fixtures.yml'
data=yaml.load(open(
os.path.join(os.path.dirname(__file__),pathtofile)))
pos_start = [data['befor... | nilq/baby-python | python |
# Copyright (c) 2014-2018, F5 Networks, 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 ... | nilq/baby-python | python |
import numpy as np
import torch
from net import Net
from generator import Generator
import utils
EPOCHS = 100000
BATCH_SIZE = 32
LR = 1e-3
LR_STEP = 0.1
LR_FAILS = 3
SIZE = (40, 40)
MARGIN = 1
NOISE = 0.1
MAX_LENGTH = 5
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
np.set_printoptions(thr... | nilq/baby-python | python |
# в разработке
class NavigationHelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.wd
# open home page
wd.get("http://localhost/adressbook/group.php")
def open_group_page(self):
wd = self.wd
# open group page
wd.find_... | nilq/baby-python | python |
"""ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Implementation for simple statcked convolutional networks.
"""
import torch
import torch.nn as nn
class SimpleConvNet(nn.Module):
def __init__(self, num_classes=None, kernel_size=7, feature_pos='post'):
super(SimpleConvNet, self).__init__()
... | nilq/baby-python | python |
import tensorflow as tf
import numpy as np
class Convolutional_NN(object):
def __init__(self):
pass
def lr_network(self, input_shape, label_shape):
"""
Create loss function and the list of metrics
Arguments:
input_shape: [list / tuple] input shape
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 06 15:07:49 2016
@author: Mike
"""
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
import os
from geopy.distance import vincenty
fr... | nilq/baby-python | python |
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
a.b -= 2
a[0] += 1
a[0:2] += 1
| nilq/baby-python | python |
import re
class JSVM(object):
_memory = {}
_program = []
_js_methods = {}
def __init__(self, code=""):
# TODO: parse automatically the 'swap' method
# function Bn(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c;return a};
def _swap(args):
a = list(args[0])
b... | nilq/baby-python | python |
#!/usr/bin/python
"""
entry point
"""
import datetime
import traceback
import six
import tempfile
import io
import signal
import json
import gzip
# config file
from pandaserver.config import panda_config
from pandaserver.taskbuffer.Initializer import initializer
from pandaserver.taskbuffer.TaskBuffer import taskBu... | nilq/baby-python | python |
# -*- coding: UTF-8 -*-
#!usr/env/bin python 3.6
from matplotlib.font_manager import FontProperties
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import numpy as np
def file2matrix(file_name):
file = open(file_name)
array_lines = file.readlines()
number_of_lines = len(array_lines)
... | nilq/baby-python | python |
# Copyright (c) 2022 Manuel Olguín Muñoz <molguin@kth.se>
#
# 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 appli... | nilq/baby-python | python |
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import torch
import poptorch
# half_stats_begin
model = torch.nn.Sequential()
model.add_module('lin', torch.nn.Linear(16, 16))
model.add_module('bn', torch.nn.BatchNorm1d(16))
model.float()
opts = poptorch.Options()
opts.Precision.runningStatisticsAlwaysFloat(... | nilq/baby-python | python |
# Generated by Django 2.2.24 on 2022-02-24 22:20
from django.db import migrations
def commit_old_currencies_deactivation(apps, schema_editor):
Currency = apps.get_model("exchange", "Currency")
db_alias = schema_editor.connection.alias
Currency.objects.using(db_alias).filter(code__in=["MRO", "VEF"]).update... | nilq/baby-python | python |
#! /usr/bin/python
#
# xindice_python_delete.py
#
# Apr/13/2012
#
import math
import cgi
import string
import sys
import os
import xml.dom.minidom
import pycurl
#
import json
# ------------------------------------------------------------------
sys.path.append ('/var/www/data_base/common/python_common')
#
from text_... | nilq/baby-python | python |
"""Wrapper for the CIFAR-10 dataset, which is provided in the `torchvision`
package.
The model and data transform are taken directly from:
https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html
"""
# Chuan-Zheng Lee <czlee@stanford.edu>
# July 2021
from pathlib import Path
import torch
import torch.... | nilq/baby-python | python |
#Un alumno desea saber cual será su calificación final en la materia de Algoritmos.
#Dicha calificación se compone de los siguientes porcentajes:
#55% del promedio de sus tres calificaciones parciales.
#30% de la calificación del examen final.
#15% de la calificación de un trabajo final.
parcial1 = float(input("Dig... | nilq/baby-python | python |
from ..utils import Object
class EditMessageMedia(Object):
"""
Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album ... | nilq/baby-python | python |
# Generated by Django 3.0.7 on 2020-09-06 08:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exams', '0020_auto_20200906_1408'),
]
operations = [
migrations.AlterField(
model_name='questio... | nilq/baby-python | python |
"""
Tox21 dataset loader.
"""
from __future__ import division
from __future__ import unicode_literals
import os
import logging
import deepchem
import dglt.contrib.moses.moses.data.featurizer as feat
from dglt.contrib.moses.moses.data.reader.utils import AdditionalInfo
from dglt.contrib.moses.moses.data.reader.data_lo... | nilq/baby-python | python |
import os
import sys
import time
from monk.pip_functionality_tests.keras.test_default_train import test_default_train
from monk.pip_functionality_tests.keras.test_default_eval_infer import test_default_eval_infer
from monk.pip_functionality_tests.keras.test_update_copy_from import test_update_copy_from
from monk.pip... | nilq/baby-python | python |
"""
.log to view bot log
For all users
"""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="log"))
@borg.on(events.NewMessage(pattern=r"\.log(.*)",incoming=True))
async def _(event):
if event.fwd_from:... | nilq/baby-python | python |
import rigor.importer
import argparse
def main():
parser = argparse.ArgumentParser(description='Imports images and metadata into the database')
parser.add_argument('database', help='Database to use')
parser.add_argument('directories', metavar='dir', nargs='+', help='Directory containing images and metadata to impo... | nilq/baby-python | python |
"""
this is a transfer tool for existed oai data (train, val , test, debug)
it will crop the image into desired size
include two part
crop the data and save it into new direc ( the code will be based on dataloader)
generate a new directory which should provide the same train,val,test and debug set, but point to the cro... | nilq/baby-python | python |
#-*- coding: utf-8 -*-
"""
security
~~~~~~~~
Generic User class for interfacing with use accounts +
authentication.
"""
import hashlib
import random
from utils import Storage, to36, valid_email, \
ALPHANUMERICS as ALPHAS
username_regex = r'([A-Za-z0-9_%s]){%s,%s}$'
passwd_regex = r'([A-Za-z0-9%s]... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-26 11:01
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_u... | nilq/baby-python | python |
import re
S = input()
if re.search(r'^(hi)+$', S):
print('Yes')
else:
print('No') | nilq/baby-python | python |
# -*- Mode: Python3; coding: utf-8; indent-tabs-mpythoode: nil; tab-width: 4 -*-
import os
import numpy as np
PATH = "../Images/"
def organize(data):
# ndArray
print("Original:")
print(data[:2])
# Preparar, remodelar Array
height, width, channels = data.shape
data = data.flatten() # ve... | nilq/baby-python | python |
from arrp import clear
def test_clear():
clear("test_dataset") | nilq/baby-python | python |
from multiprocessing import Pool
from .rabbitmq.rmq_consumer import CocoRMQConsumer
from .kafka.kafka_consumer import CocoKafkaConsumer
from .redis.redis_consumer import CocoRedisConsumer
from .logger import logger
import time
# this is aka mixture of a consumer factory and threadpool
class CocoConsumerManager(object... | nilq/baby-python | python |
# Suites of test positions are normally stored in many different EPD files.
# We keep them in one big JSON file instead, with standardized IDs, because
# that makes it easier to keep track of scores over time.
#
# This program imports a new EPD test suite into that JSON file.
import sys
import json
import chess
impor... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Test for the MDF
import os
import os.path
import sys
sys.path.append(os.path.join(os.path.dirname(__file__),".."))
from schema import Range,Variable,Table
from census_spec_scanner import CensusSpec
TEST_FNAME = os.path.join(os.path.dirname(__file__), "docx_test/test_fil... | nilq/baby-python | python |
import time
import pyqtgraph as pg
class UserTestUi(object):
def __init__(self, expected_display, current_display):
pg.mkQApp()
self.widget = pg.QtGui.QSplitter(pg.QtCore.Qt.Vertical)
self.widget.resize(1600, 1000)
self.display_splitter = pg.QtGui.QSplitter(pg.QtCore.Qt.Horizonta... | nilq/baby-python | python |
from autohandshake.src import HandshakeBrowser
from autohandshake.src.Pages.StudentProfilePage import StudentProfilePage
from autohandshake.src.constants import BASE_URL
class ViewAsStudent:
"""
A sub-session in which the user logs in as a student.
Should be used as a context manager. Example:
::
... | nilq/baby-python | python |
hensu = "HelloWorld"
print(hensu) | nilq/baby-python | python |
import os
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
project_dir = Path(__file__).resolve().parents[1]
load_dotenv(find_dotenv())
LOGLEVEL = os.getenv("LOGLEVEL", "INFO").upper()
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
... | nilq/baby-python | python |
import numpy as np
import pytest
import torch
from thgsp.graphs.generators import random_graph
from thgsp.sampling.rsbs import (
cheby_coeff4ideal_band_pass,
estimate_lk,
recon_rsbs,
rsbs,
)
from ..utils4t import devices, float_dtypes, snr_and_mse
def test_cheby_coeff4ideal_band_pass():
order = ... | nilq/baby-python | python |
# 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
# distributed under the Li... | nilq/baby-python | python |
#!/usr/bin/env python
#encoding=utf-8
import numpy as np
from random import choice, shuffle, uniform
#from data_factory import PlotFactory
class DataFactory():
def __init__(self, n=1):
self.plt_max=5
self.nmb_plt=None
if n < self.plt_max:
self.nmb_plt=n
else:
... | nilq/baby-python | python |
from .base import BaseNewsvendor, DataDrivenMixin
from ..utils.validation import check_cu_co
from keras.models import Sequential
from keras.layers import Dense
import keras.backend as K
from sklearn.utils.validation import check_is_fitted
import numpy as np
ACTIVATIONS = ['elu', 'selu', 'linear', 'tanh', 'relu', 'soft... | nilq/baby-python | python |
# Copyright 2018 eShares, Inc. dba Carta, 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | nilq/baby-python | python |
MAX_LENGTH_TEXT_MESSAGE = 800
MAX_LENGTH_TEXT_SUBJECT = 80
TEXT_SIZE = "The text must be between 0 and 800 characters."
SUBJECT_SIZE = "Subject must be between 0 and 80 characters."
USER_EXISTS = "User don't exists."
| nilq/baby-python | python |
default_app_config = 'features.apps.FeaturesConfig'
| nilq/baby-python | python |
import logging
import abc
import traceback
from media.monitor.pure import LazyProperty
appname = 'root'
def setup_logging(log_path):
""" Setup logging by writing log to 'log_path' """
#logger = logging.getLogger(appname)
logging.basicConfig(filename=log_path, level=logging.DEBUG)
def get_logger():
""... | nilq/baby-python | python |
import time
import telnetlib
class Telnet:
#
# Desenvolvido por Felipe Lyp
#
def connect(self, host, port, username, password):
self.telnet = telnetlib.Telnet(host, port)
self.telnet.read_until(b"Login:")
self.telnet.write(username.encode('ascii') + b"\n")
if pas... | nilq/baby-python | python |
import random
class Enemy:
"""
Automatically inherits object class from python3
"""
def __init__(self, name="Enemy", hit_points=0, lives=1):
self.name = name
self.hit_points = hit_points
self.lives = lives
self.alive = True
def take_damage(self, damage):
... | nilq/baby-python | python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2011 OpenStack 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... | nilq/baby-python | python |
import argparse
import pickle
import time
import os
import logging
import numpy as np
import theano as th
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
import lasagne
import lasagne.layers as ll
from lasagne.layers import dnn, batch_norm
import nn
logging.basicConfig(level=logging.INFO)... | nilq/baby-python | python |
from django.contrib import admin
from bookmarks.models import Bookmark, BookmarkInstance
class BookmarkAdmin(admin.ModelAdmin):
list_display = ('url', 'description', 'added', 'adder',)
admin.site.register(Bookmark, BookmarkAdmin)
admin.site.register(BookmarkInstance) | nilq/baby-python | python |
import os
import pickle
from smart_open import smart_open
def _split3(path):
dir, f = os.path.split(path)
fname, ext = os.path.splitext(f)
return dir, fname, ext
def get_containing_dir(path):
d, _, _ = _split3(path)
return d
def get_parent_dir(path):
if os.path.isfile(path):
path ... | nilq/baby-python | python |
# coding=utf-8
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import *
class CreditNoteAdmin(admin.ModelAdmin):
model = CreditNote
search_fields = ('numero', 'invoice__id', 'invoice__contact__id')
list_display... | nilq/baby-python | python |
import logging
import logging.handlers
from logging.handlers import TimedRotatingFileHandler, MemoryHandler
import os
from datetime import datetime
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
sys.path.insert(0, os.path.dirname(__file__))
if True:
... | nilq/baby-python | python |
from typing import List, Dict, Callable
import numpy as np
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.decorators import tensor
from neuralmonkey.vocabulary import END_TOKEN_INDEX
from neuralmonkey.runners.base_runner import BaseRunner
from neuralmonkey.decoders.sequence_label... | nilq/baby-python | python |
import json
import os
from google.auth.transport import requests
from google.oauth2 import service_account
_BASE_URL = "https://healthcare.googleapis.com/v1"
def get_session():
"""Creates an authorized Requests Session."""
credentials = service_account.Credentials.from_service_account_file(
filename... | nilq/baby-python | python |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | nilq/baby-python | python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import range
from builtins import super
import mock
import string
import unittest
import random
import itertools
from pprint import pprint
from dpaycli impor... | nilq/baby-python | python |
import os
from configuration import *
from scipy.io import wavfile
from scipy.signal import stft,check_COLA,istft
import numpy as np
import pickle
import multiprocessing as mp
# save decoded dataset as pickle file
def save_as_wav(dir_list):
dataset= {
'vocals': [],
'accompaniment': [],
'bass': [],
... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.