content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
'''
任意累积
描述
请根据编程模板补充代码,计算任意个输入数字的乘积。
注意,仅需要在标注...的地方补充一行或多行代码。
'''
def cmul(a, *b):
input(a)
m = a
for i in b:
m *= i
return m
print(eval("cmul({})".format(input())))
'''
该程序需要注意两个内容:
1. 无限制数量函数定... | nilq/baby-python | python |
from src.preprocessor import preprocessor as preprocessor
from src.error import ApplicationError, error_list
from src.aggregator import Aggregator
from src.constants import MIN_CONTENT_LEN
from flask import Blueprint, request, jsonify
from flask_cors import cross_origin
import io
from flask_limiter import Limiter
from... | nilq/baby-python | python |
'''
@author: Sergio Rojas
@contact: rr.sergio@gmail.com
--------------------------
Contenido bajo
Atribución-NoComercial-CompartirIgual 3.0 Venezuela (CC BY-NC-SA 3.0 VE)
http://creativecommons.org/licenses/by-nc-sa/3.0/ve/
Creado en abril 23, 2016
'''
import matplotlib.pyplot as plt
x = [1.5, 2.7, 3.8, 9.5,12.3]... | nilq/baby-python | python |
import numpy as np
from Activations import Activations
class Layer:
def __init__(self, nNeurons, activation=Activations.linear, input=np.array([0.0])):
if type(input) == Layer:
self.inputs = input.forward()
self.inputLayer = input
else:
self.inputs = np.array([i... | nilq/baby-python | python |
from baconian.common.special import *
from baconian.core.core import EnvSpec
from copy import deepcopy
import typeguard as tg
from baconian.common.error import *
class SampleData(object):
def __init__(self, env_spec: EnvSpec = None, obs_shape=None, action_shape=None):
if env_spec is None and (obs_shape is... | nilq/baby-python | python |
# BSD LICENSE
#
# Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
# 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 copy... | nilq/baby-python | python |
#!/usr/bin/python
# Copyright (c)2012 EMC Corporation
# All Rights Reserved
# This software contains the intellectual property of EMC Corporation
# or is licensed to EMC Corporation from third parties. Use of this
# software and the intellectual property contained therein is expressly
# limited to the terms an... | nilq/baby-python | python |
from django.shortcuts import render
from django.shortcuts import get_object_or_404
# from rest_framework import status
# from rest_framework.permissions import IsAuthenticated, IsAdminUser
# from rest_framework.response import Response
# from rest_framework import viewsets
from findance import abstract
from .models im... | nilq/baby-python | python |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from urlparse import urlparse, parse_qs
import argparse
import concoction
class WebServer(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()... | nilq/baby-python | python |
from flask import request
from app import newjson,jsonify
from . import api,base_dir
from ..model.live2d import live2dConfig,live2dModel
import os,json
@api.route("/live2d/config/get",endpoint="live2d-config-get",methods = ["GET","POST"])
def live2d_getConfig():
config = request.values.get("config","default",type=... | nilq/baby-python | python |
from django.apps import AppConfig
class FourAppConfig(AppConfig):
name = 'four_app'
| nilq/baby-python | python |
# coding: latin-1
###############################################################################
# eVotUM - Electronic Voting System
#
# generateSecret-app.py
#
# Cripto-4.4.1 - Commmad line app to exemplify the usage of generateSecret
# function (see shamirsecret.py)
#
# Copyright (c) 2016 Universidade do Minho... | nilq/baby-python | python |
import pandas as pd
from actymath.columns.base import Column
from actymath.calc import register
class TestColumn1(Column):
column_name = "q(x{life})"
parameters = {"life": "test"}
dependencies = []
class TestColumn2(Column):
column_name = "timestamp"
parameters = {}
dependencies = []
def t... | nilq/baby-python | python |
#!/bin/env python
#===============================================================================
# NAME: test_api.py
#
# DESCRIPTION: A basic test framework for integration testing.
# AUTHOR: Kevin Dinkel
# EMAIL: dinkel@jpl.nasa.gov
# DATE CREATED: November 19, 2015
#
# Copyright 2015, California Institute of Techn... | nilq/baby-python | python |
from textual import events
from textual.app import App
from textual.widgets import Header, Footer, Placeholder, ScrollView
import json
from rich.panel import Panel
from textual.app import App
from textual.reactive import Reactive
from textual.widget import Widget
import pandas as pd
import numpy as np
from rich.ta... | nilq/baby-python | python |
import time
import pickle
import json
import numpy as np
from threading import Thread
from typing import Dict, List
from nxs_libs.queue import *
from azure.core import exceptions as AzureCoreException
from azure.storage.queue import (
QueueClient,
)
class NxsAzureQueuePuller(NxsQueuePuller):
def __init__(se... | nilq/baby-python | python |
from lib_rovpp import ROVPPV1SimpleAS, ROVPPV1LiteSimpleAS
from .trusted_server import TrustedServer
from lib_secure_monitoring_service.sim_logger import sim_logger as logger
from lib_secure_monitoring_service.report import Report
class ROVSMS(ROVPPV1LiteSimpleAS):
name="ROV V4"
__slots__ = tuple()
tru... | nilq/baby-python | python |
# Copyright 2021 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 wr... | nilq/baby-python | python |
from keras.models import load_model
from keras.optimizers import SGD, Adam
from skimage.io import imshow
from cnnlevelset.pascalvoc_util import PascalVOC
from cnnlevelset.localizer import Localizer
from cnnlevelset.generator import pascal_datagen, pascal_datagen_singleobj
from cnnlevelset import config as cfg
import s... | nilq/baby-python | python |
from .InteractionRedshift import InteractionRedshift | nilq/baby-python | python |
N = int(raw_input())
if N < 0:
print N * -1
else:
print N
| nilq/baby-python | python |
#!/usr/bin/python
#
# Nagios class.
#
version = "1.2.2"
from core import *
| nilq/baby-python | python |
"""
Created on Wed Feb 5 13:04:17 2020
@author: matias
"""
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import minimize
import emcee
import corner
from scipy.interpolate import interp1d
import sys
import os
from os.path import join as osjoin
from pc_path import definir_path
path_git,... | nilq/baby-python | python |
"""Linear Classifiers."""
import numpy as np
from abc import ABC, abstractmethod
from alchina.exceptions import InvalidInput, NotFitted
from alchina.metrics import accuracy_score
from alchina.optimizers import GradientDescent
from alchina.preprocessors import Standardization
from alchina.utils import check_dataset_c... | nilq/baby-python | python |
"""
This is a crawler that downloads 'friends' screenplays.
"""
import re
import requests
from bs4 import BeautifulSoup
from seinfeld_laugh_corpus.corpus_creation.screenplay_downloader.screenplay_downloader import ScreenplayDownloader
def run(input_filename, output_filename):
screenplay_downloader = SeinfeldScr... | nilq/baby-python | python |
"a shared stack module"
stack = []
class error(Exception): pass
def push(obj):
global stack
stack = [obj] + stack
def pop():
global stack
if not stack:
raise error('stack underflow')
top, *stack = stack
return top
def top():
if not stack:
raise error('stack underflow')
... | nilq/baby-python | python |
def solution(A): # O(N)
"""
Given a variable length array of integers, partition them such that the even
integers precede the odd integers in the array. Your must operate on the array
in-place, with a constant amount of extra space. The answer should sc... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
"""
Some simple unit tests of the Counter device, exercising the device from
the same host as the tests by using a DeviceTestContext.
"""
import logging
import time
import pytest
import tango
from tango.test_utils import DeviceTestContext
from ska_tango_e... | nilq/baby-python | python |
#!/bin/python3
# Imports
import math
import os
import random
import re
import sys
#
# Instructions
#
def solution_function(a, b):
# Write your code here
return [a, b]
if __name__ == '__main__':
a_count = int(input().strip())
a = []
for _ in range(a_count):
a_item = input()
a.... | nilq/baby-python | python |
# 2017-04-16
"""
Using first half of Knuth-Morris-Pratt (KMP) pattern-matching
for shortest repeating sub-pattern (SRSP) determination in O(n) time
Left edge and right edge are "sacred" locations. If we have a repeating sub-pattern that covers the whole input string, it will exist starting at left edge and exist en... | nilq/baby-python | python |
"""
https://wiki.jikexueyuan.com/project/easy-learn-algorithm/floyd.html
"""
def floyd_warshall(edges, V):
# dp: 顶点对 (i,j) 间距离
dp = [[float('inf')] * V for _ in range(V)]
for i in range(V):
dp[i][i] = 0
# 根据 edges 初始化
for u, v, w in edges:
dp[u][v] = w
# 选择引入中间... | nilq/baby-python | python |
import logging
log = logging.getLogger('agents')
from enforce_typing import enforce_types
from typing import List, Dict
import random
import math
from web3engine import bfactory, bpool, datatoken, dtfactory, globaltokens
from engine.AgentBase import AgentBase
from web3tools.web3util import toBase18
from util.constant... | nilq/baby-python | python |
import os
import tempfile
import tensorflow as tf
from tensorflow.contrib.layers import fully_connected as fc
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.python.client import timeline
batch_size = 100
inputs = tf.placeholder(tf.float32, [batch_size, 784])
targets = tf.placeh... | nilq/baby-python | python |
from .model import FaPN | nilq/baby-python | python |
import sys
import vnpy_chartwizard
sys.modules[__name__] = vnpy_chartwizard
| nilq/baby-python | python |
level = 3
name = 'Arjasari'
capital = 'Patrolsari'
area = 64.98
| nilq/baby-python | python |
"""
模块功能:
1. 采集批改网所有在库作文数据
2. 清洗,预处理
3. 入库信息键:pid作文号、title作文标题、abstract简介、refer参考答案{可能为空}、
spider_time采集时间、source_href答题页面访问链接
"""
from gevent import monkey
monkey.patch_all()
import json
import requests
from lxml import etree
import gevent
from gevent.queue import Queue
from fake_useragent import UserAgent
work_q =... | nilq/baby-python | python |
import threading
import csv
import re
from sqlalchemy import create_engine
from IPython.display import display, Javascript, HTML
from ..python_js.interface_js import load_js_scripts
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
return wra... | nilq/baby-python | python |
from microbit import *
from math import sqrt
while True:
x, y, z = accelerometer.get_values()
acc = sqrt(x*x + y*y + z*z)
y = int(2 + (acc - 1000) / 100)
display.clear()
if y < 0:
y = 0
if y > 4:
y = 4
for x in range(0, 5):
display.set_pixel(x, y, 9) | nilq/baby-python | python |
from datetime import datetime, timedelta
from discord.ext import commands
from lib.mysqlwrapper import mysql
from lib.rediswrapper import Redis
from typing import Optional
import discord
import lib.embedder
import logging
import uuid
class FriendCode(commands.Cog):
def __init__(self, client):
self.client ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Scrapy settings for telesurscraper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en... | nilq/baby-python | python |
t = int(input())
for q in range(t):
#n,k=input().split()
#n,k=int(n),int(k)
#n,m,k=input().split()
#n,m,k=int(n),int(m),int(k)
#n=int(input())
#n=int(input())
#arr=list(map(int,input().split()))
num=int(input())
n=num%8
if(n==0):
print(num-1,"SL",sep="")... | nilq/baby-python | python |
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
class Clipper(BaseEstimator, TransformerMixin):
def __init__(self, params = {}):
super().__init__()
self.name = self.__class__.__name__
self.p... | nilq/baby-python | python |
# MIT License
#
# Copyright (c) 2017 Tom Runia
#
# 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, ... | nilq/baby-python | python |
from .plot import Plot
import matplotlib.pyplot as plt
from .plot_funcs import average_traits
import numpy as np
class AverageTraitTime(Plot):
def __init__(self):
self.avgtraits = {}
def plot(self, game:"Game", file_path:str, height:int, width:int) -> None:
"""Plot the game information savin... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright 2011-2021 IBM 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 la... | nilq/baby-python | python |
"""Rx Workshop: Observables versus Events.
Part 2 - Dispose Example.
Usage:
python wksp3.py
"""
from __future__ import print_function
import rx
class Program:
"""Main Class.
"""
@staticmethod
def main():
"""Main Method.
"""
subject = rx.subjects.Subject()
subscr... | nilq/baby-python | python |
from __future__ import print_function
import numpy as np
import testing as tm
import unittest
import pytest
import xgboost as xgb
try:
from sklearn.linear_model import ElasticNet
from sklearn.preprocessing import scale
from regression_test_utilities import run_suite, parameter_combinations
except ImportE... | nilq/baby-python | python |
import PIL
print(PIL.PILLOW_VERSION)
import load_data
from load_data import *
import load_data
import gc
import matplotlib.pyplot as plt
from torch import autograd
import patch_config
plt.rcParams["axes.grid"] = False
plt.axis('off')
img_dir = "inria/Train/pos"
lab_dir = "inria/Train/pos/yolo-labels"
... | nilq/baby-python | python |
import time
import os
import getopt
import sys
import datetime
import numpy as np
from milvus import *
import config
import logging
import random
milvus = Milvus()
def is_normalized():
filenames = os.listdir(NL_FOLDER_NAME)
filenames.sort()
vetors = load_vec_list(NL_FOLDER_NAME+'/'+filenames[0])
for ... | nilq/baby-python | python |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QDateTime, QTimer
# from openssl_lib import OpenSSLLib
from .set_csr import SetCSRView
class CSRData:
def __init__(self):
self.country_name = ''
self.state_name = ''
self.locality_name = ''
self.o... | nilq/baby-python | python |
# Copyright 2021 Huawei Technologies Co., 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-2.0
#
# Unless required by applicable law or agreed to... | nilq/baby-python | python |
#Python program for continuous and discrete sine wave plot
import numpy as np
import scipy as sy
from matplotlib import pyplot as plt
t = np.arange(0,1,0.01)
#frequency = 2 Hz
f = 2
#Amplitude of sine wave = 1
PI = 22/7
a = np.sin(2*PI*2*t)
#Plot a continuous sine wave
fig, axs = plt.subplots(1,2)
axs[0].... | nilq/baby-python | python |
"""
Module containing NHL game objects
"""
from dataclasses import dataclass
from .flyweight import Flyweight
from .list import List
from .gameinfo import GameInfo
from .team import Team
from .venue import Venue
@dataclass(frozen=True)
class Game(Flyweight):
"""
NHL game object.
This is the detailed docs... | nilq/baby-python | python |
#!/usr/bin/env python
"""Base class for model elements."""
from __future__ import annotations
import logging
import uuid
from typing import TYPE_CHECKING, Callable, Iterator, Protocol, TypeVar, overload
from gaphor.core.modeling.event import ElementUpdated
from gaphor.core.modeling.properties import (
attribute,... | nilq/baby-python | python |
#!/usr/bin/env python
"""
@script: DeployerApp.py
@purpose: Deployer for HomeSetup
@created: Nov 12, 2019
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior
@mailto: yorevs@hotmail.com
@site: https://github.com/yorevs/homesetup
@license: Please refer to <https://opensource.org/licenses/MIT>
"""
#... | nilq/baby-python | python |
import numpy as np
from deep500.lv0.operators.operator_interface import CustomPythonOp
from deep500.frameworks.reference.custom_operators.python.conv_op_common import get_pad_shape, get_output_shape, get_fullconv_pad_shape, crosscorrelation, crosscorrelation_dilx_flipw, crosscorrelation_swap_axes
from deep500 import Te... | nilq/baby-python | python |
"""CelebA data-module."""
from typing import Any
import albumentations as A
import attr
from pytorch_lightning import LightningDataModule
from ranzen import implements
from conduit.data.datamodules.base import CdtDataModule
from conduit.data.datamodules.vision.base import CdtVisionDataModule
from conduit.data.dataset... | nilq/baby-python | python |
import pytest
def test_repr(module):
v = module.Dict({"x": module.Int(min=0, max=100)}, nullable=True)
assert repr(v) == (
"<Dict(schema=frozendict({'x': <Int(min=0, max=100)>}), nullable=True)>"
)
v = module.Dict({"x": module.LazyRef("foo")})
assert repr(v) == "<Dict(schema=frozendict({'... | nilq/baby-python | python |
"""
Copyright 2021 Dynatrace 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 or agreed to in writing, software
... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define the main basic Camera interface
This defines the main basic camera interface from which all other interfaces which uses a camera inherit from.
"""
from pyrobolearn.tools.interfaces.interface import InputInterface
__author__ = "Brian Delhaisse"
__copyright__ = "... | nilq/baby-python | python |
# Kenny Sprite Sheet Slicer
# KennySpriteSlice.py
# Copyright Will Blankenship 2015
# This will attempt to correctly slice sprite sheets from the Kenny Donation Collection
import xml.etree.ElementTree
from PIL import Image
import shutil
import os
from .Sprite import Sprite
from .Error import Error
from .SpriteMetaFi... | nilq/baby-python | python |
from quantitative_node import QuantitativeNode
from qualitative_node import QualitativeNode
from dataset import Dataset
from leaf_node import Leaf
from dparser import DParser
import numpy as np
import info_gain
import random
import time
import math
isBenchmark = False
def getMostFrequentClass(result_vector):
if r... | nilq/baby-python | python |
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
class NegativeKeywords(Client):
@sp_endpoint('/v2/sp/negativeKeywords/{}', method='GET')
def get_negative_keyword(self, keywordId, **kwargs) -> ApiResponse:
r"""
get_negative_keyword(self, keywordId, \*\*kwargs) -> Ap... | nilq/baby-python | python |
# -*- encoding: utf-8 -*-
"""Initialization of Flask REST-API Environment"""
from flask import Flask
from flask_bcrypt import Bcrypt # Bcrypt hashing for Flask
from flask_sqlalchemy import SQLAlchemy
from .config import config_by_name
db = SQLAlchemy() # database object
flask_bcrypt = Bcrypt() # bcrypt hashin... | nilq/baby-python | python |
from context import DBVendor, DBConnection, DBContext
from converters import *
from datasource import * | nilq/baby-python | python |
from collections import OrderedDict
from typing import List
from typing import Union, Dict, Callable, Any
from tequila.ml.utils_ml import preamble, TequilaMLException
from tequila.objective import Objective, Variable, vectorize, QTensor
from tequila.tools import list_assignment
from tequila.simulators.simulator_api i... | nilq/baby-python | python |
import setuptools
setuptools.setup(
name="epaper_standalone",
version="4.0",
license="Apache-2.0",
author="Steve Zheng",
description="Show time, weather and calendar.",
packages=setuptools.find_packages(exclude=['test']),
setup_requires=['Pillow>=5.4'],
package_data={
'cwt': ['u... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Tests for the virtual file system.'''
from __future__ import unicode_literals
import os
import unittest
from UnifiedLog import virtual_file
from UnifiedLog import virtual_file_system
from tests import test_lib
class VirtualFileSystemTests(test_lib.BaseTestCase):
... | nilq/baby-python | python |
def number_of_equal_elements(list1, list2):
return sum([x == y for x, y in zip(list1, list2)])
| nilq/baby-python | python |
# Portions of code used in this file and implementation logic are based
# on lightgbm.dask.
# https://github.com/microsoft/LightGBM/blob/b5502d19b2b462f665e3d1edbaa70c0d6472bca4/python-package/lightgbm/dask.py
# The MIT License (MIT)
# Copyright (c) Microsoft Corporation
# Permission is hereby granted, free of charg... | nilq/baby-python | python |
import xlsxwriter
class Writer:
def __init__(self, file, name):
self.excelFile = xlsxwriter.Workbook(file)
self.worksheet = self.excelFile.add_worksheet(name)
self.row = 0
self.col = 0
def close(self):
self.excelFile.close()
def write(self, identify, title, score)... | nilq/baby-python | python |
n1 = int(input('Digite um valor:'))
n2 = int(input('digite outro valor:'))
s = n1 + n2
print('A soma de {} e {} vale:{}'.format(n1, n2, s))
| nilq/baby-python | python |
import logging
import time
import alsaaudio
import webrtcvad
from .exceptions import ConfigurationException
logger = logging.getLogger(__name__)
class Capture(object):
MAX_RECORDING_LENGTH = 8
VAD_SAMPLERATE = 16000
VAD_FRAME_MS = 30
VAD_PERIOD = int((VAD_SAMPLERATE / 1000) * VAD_FRAME_MS)
VAD_SILENCE_TIMEO... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import stiefo
#stiefo.render_screen(["2-", "aus", "bei", "bei t a g", "pro", "pro z e nt"])
#stiefo.render_screen(["2- t", "2- z", "aus", "mit g e b", "der", "trans p o t", "die"])
#stiefo.render_screen(["der", "man", "ist", "nicht", "3b e0", "w e@ lich", "f a", "f... | nilq/baby-python | python |
import logging
from dht.node import SelfNode
from dht.settings import BUCKET_SIZE, BUCKET_REPLACEMENT_CACHE_SIZE
class BucketHasSelfException(Exception):
pass
class NodeNotFoundException(Exception):
pass
class NodeAlreadyAddedException(Exception):
pass
class BucketIsFullException(Exception):
pa... | nilq/baby-python | python |
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import argparse
import urllib.parse as urlparse
from osim.env import RunEnv
import numpy as np
from utils import Scaler
import multiprocessing
import pickle
PORT_NUMBER = 8018
def mp_test(s):
p = multiprocessing.Pool(2)
tras = p.map(run_... | nilq/baby-python | python |
#!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
s = pd.Series(np.random.normal(10, 8, 20))
s.plot(style='ko-', alpha=0.4, label='Series plotting')
plt.legend()
plt.savefig('pandasplot.png')
| nilq/baby-python | python |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import popart._internal.ir as _ir
import pytest
def test_tensor_type_creation():
""" Test that we can create a popart._internal.ir.TensorType enum. """
_ir.TensorType.ActGrad
_ir.TensorType.Const
_ir.TensorType.S... | nilq/baby-python | python |
SPOTIFY_USERS = {
'<user_name_1>': {
'client_id': '<client_id>',
'client_secret': '<client_secret>',
'redirect_uri': '<redirect_uri>',
'user_name': '<user_name>',
},
'<user_name_2>': {
'client_id': '<client_id>',
'client_secret': '<client_secret>',
're... | nilq/baby-python | python |
from sisense.resource import Resource
class Folder(Resource):
def get(self, oid: str) -> Resource:
"""
Get a specific folder.
:param oid: (str) Folder's ID.
:return: (Folder)
"""
content = self._api.get(f'folders/{oid}')
return Folder(self._api, content)
... | nilq/baby-python | python |
from clearskies.secrets.additional_configs import MySQLConnectionDynamicProducerViaSSHCertBastion as Base
from pathlib import Path
import socket
import subprocess
import os
import time
class MySQLConnectionDynamicProducerViaSSHCertBastion(Base):
_config = None
_boto3 = None
def __init__(
self,
... | nilq/baby-python | python |
"""
Functions and classes for aligning two lists using dynamic programming.
The algorithm is based on on a slight variation of the method given at:
http://www.avatar.se/molbioinfo2001/dynprog/adv_dynamic.html. By default NIST
insertion, deletion and substitution penalties are used.
Author: Herman Kamper
Contact: kamp... | nilq/baby-python | python |
from __future__ import absolute_import, division, print_function
import pkgutil
import numpy as np
import glue
def test_histogram_data():
data = glue.core.data.Data(label="Test Data")
comp_a = glue.core.data.Component(np.random.uniform(size=500))
comp_b = glue.core.data.Component(np.random.normal(size=... | nilq/baby-python | python |
import jax.numpy as jnp
from matplotlib import pyplot as plt
from numpy.linalg import inv
from jsl.sent.run import train
from jsl.sent.agents.kalman_filter import KalmanFilterReg
from jsl.sent.environments.base import make_matlab_demo_environment
def posterior_lreg(X, y, R, mu0, Sigma0):
Sn_bayes_inv = inv(Sigm... | nilq/baby-python | python |
import os
from datetime import datetime
import tensorflow as tf
from feature_extractor import MobileNet, Resnet, Vgg16
from modules import atrous_spatial_pyramid_pooling
class DeepLab(object):
def __init__(self, base_architecture, training=True, num_classes=21, ignore_label=255, batch_norm_momentum=0.9997, pre... | nilq/baby-python | python |
import zmq
from threading import Thread
import queue
from client_login import LoginClient
from enums import Host, Intervals
import time
class Client:
def __init__(self, target):
self.context = zmq.Context.instance()
self.username = None
self.queue = queue.Queue()
self.message = Non... | nilq/baby-python | python |
import serial
import bk169X.sim as _bksim
class PSCommError(Exception):
pass
class PowerSupply(object):
def __init__(
self,
device,
baud=9600,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
... | nilq/baby-python | python |
#!/home/sunnymarkliu/software/miniconda2/bin/python
# _*_ coding: utf-8 _*_
"""
VGG net implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits
VGG net Paper: https://arxiv.org/pdf/1409.1556.pdf
Mnist Dataset: http://yann.lecun.com/exdb/mnist/
@author: MarkLiu
... | nilq/baby-python | python |
from __future__ import absolute_import
HORIZON_CONFIG = {
# Allow for ordering dashboards; list or tuple if provided.
'dashboards': ["module", "portal"],
# Name of a default dashboard; defaults to first alphabetically if None
'default_dashboard': "portal",
# Default redirect url for users' home
... | nilq/baby-python | python |
#Team Zephyr
#necessary libraries to be imported
import nmap
import netifaces
from nmap import PortScanner
import socket
import multiprocessing
import subprocess
import os
import threading
import time
import re
import pdb
import numpy
HOST_IP = [] #contains the ip addresses of the devices connected onto the netw... | nilq/baby-python | python |
#!/usr/bin/python
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test the lint module."""
import collections
import os
import sys
sys.path.insert(0, os.path.abspath('%s/../../..' % os.path.dir... | nilq/baby-python | python |
from yunionclient.common import base
class Federatedrolebinding(base.ResourceBase):
pass
class FederatedrolebindingManager(base.StandaloneManager):
resource_class = Federatedrolebinding
keyword = 'federatedrolebinding'
keyword_plural = 'federatedrolebindings'
_columns = ["Federatednamespace_Id"]
... | nilq/baby-python | python |
"""Main module."""
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import pandas as pd
from sentimentbot.feeds import FinvizNewsFeed
class SentimentAnalyzer(object):
""" wrapper for the sentiment analyzer """
_analyzer = SentimentIntensityAnalyzer()
def __init__(self, ticker):
se... | nilq/baby-python | python |
from __future__ import absolute_import
import os, sys
import imp
class docs(object):
def __init__(self, show=True, update=False):
"""
Class for viewing and building documentation
Parameters
----------
show : bool
If True, show docs after rebuilding (default: T... | nilq/baby-python | python |
import time
from datetime import timedelta, datetime, timezone
from decimal import Decimal, localcontext, DefaultContext
import aiohttp
import asyncio
import signal
from aiokraken.model.asset import Asset
from aiokraken import markets, balance, ohlc, OHLC
from aiokraken.utils import get_kraken_logger, get_nonce
fro... | nilq/baby-python | python |
from django.http.response import JsonResponse
from core.apps.basket.basket import Basket
from .models import Order, OrderItem
def add(request):
basket = Basket(request)
if request.POST.get('action') == 'post':
order_key = request.POST.get('order_key')
user_id = request.user.id
baske... | nilq/baby-python | python |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def nextLargerNodes(self, head: ListNode) -> List[int]:
heap, res, j = [], [], 0
while head:
res.append(0)
while heap and hea... | nilq/baby-python | python |
import psutil
import schedule
import time
from userClass import *
class LeagueScheduler:
#Setters
def set_processName(self, processName):
self.__processName = processName
def __set_inGame(self, inGame):
self.__inGame = inGame
#Getters
def get_processName(self):
return self.__processName
def get_inGam... | nilq/baby-python | python |
"""Backend agnostic array operations.
"""
import itertools
import numpy
from autoray import do, reshape, transpose, dag, infer_backend, get_dtype_name
from ..core import njit, qarray
from ..utils import compose
from ..linalg.base_linalg import norm_fro_dense
def asarray(array):
"""Maybe convert data for a tenso... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.