content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
"""
Inspection utilities.
"""
from typing import Optional
import numpy as np
import tensorflow as tf # type: ignore
from matplotlib import cm # type: ignore
from PIL import Image # type: ignore
from ._image import preprocess_image, Preprocessing
from ._typing import NDUInt8Array, NDFloat32Array
def make_grad_cam... | nilq/baby-python | python |
#! /usr/bin/env python
# coding=utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('CHANGELOG.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
re... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
""" Useful functions to work with dictionaries.
"""
def deep_get(d, *keys, default=None):
""" Recursive safe search in a dictionary of dictionaries.
Args:
d: the dictionary to work with
*keys: the list of keys to work with
default: the default value to return ... | nilq/baby-python | python |
"""
PyRetroPrint emulates Epson ESC/P printers, IBM Proprinters, and Atari 8-series
"""
__all__ = ["pyretroprint", "page", "epsonfx", "ibm"]
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 8 19:20:13 2018
@author: kejintao
input information:
1. demand patterns (on minutes)
2. demand databases
3. drivers' working schedule (online/offline time)
** All the inputs are obtained from env, thus we do not need to alter parameters here
"""
from path import *
imp... | nilq/baby-python | python |
from unittest import TestCase
from catalog import Catalog
class TestCatalog(TestCase):
def setUp(self):
class TestNum(Catalog):
_attrs = 'value', 'label', 'other'
red = 1, 'Red', 'stuff'
blue = 2, 'Blue', 'things'
self.TestNum = TestNum
def test_access_at... | nilq/baby-python | python |
import unittest2 as unittest
import urllib2
from AccessControl import Unauthorized
from plone.app.testing import TEST_USER_ID
from plone.app.testing import setRoles
from zope.component import getUtility
from plone.registry.interfaces import IRegistry
from collective.flattr.interfaces import ICollectiveFlattr
from mocke... | nilq/baby-python | python |
"""
This is about the prediction of alpha using the conditional input output pair of parameters and outcome
"""
import os
import argparse
import numpy as np
import pandas as pd
import seaborn as sns
from collections import Counter
import logging
from annotator.annot import Annotator
from commons import ENDPOINT
from e... | nilq/baby-python | python |
import asyncio
import datetime
import time
from pprint import pprint
from typing import List, Optional, Tuple
import meadowflow.event_log
import meadowflow.jobs
import meadowflow.time_event_publisher
import pytest
import pytz
from meadowflow.time_event_publisher import (
Periodic,
PointInTime,
TimeEventPu... | nilq/baby-python | python |
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import warnings
from typing import Any
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel
from torch import nn
from mmedit.apis import single_gpu_test
from mmedit.core.export import ONNXRuntimeEditing
fr... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
@author: Daniel Jiménez-Caminero Costa
"""
import numpy as np
import math
def nonlinear_common(p_0, alpha, m_exponents, v_i_array, threshold_db_array):
""" Array lists that are necessary for the calculation of the non-linearity and are general to each band. This has
bee... | nilq/baby-python | python |
import time
import math
from dronekit import connect
from dronekit.mavlink import MAVConnection
from dronekit.test import with_sitl
from nose.tools import assert_not_equals, assert_equals
@with_sitl
def test_mavlink(connpath):
vehicle = connect(connpath, wait_ready=True)
out = MAVConnection('udpin:localhost:1... | nilq/baby-python | python |
# -----------------------------------------------------------------------------
# QP/Python Library
#
# Port of Miro Samek's Quantum Framework to Python. The implementation takes
# the liberty to depart from Miro Samek's code where the specifics of desktop
# systems (compared to embedded systems) seem to warrant a diff... | nilq/baby-python | python |
#!/usr/bin/python
'''=========================================================================
The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
ABN 41 687 119 230.
All rights reserved.
Licensed under the CSIRO BSD 3-Clause License
You may not use this file ex... | nilq/baby-python | python |
#!/usr/bin/python
import sys
import math, numpy as np
import roslib; roslib.load_manifest('hrl_fabric_based_tactile_sensor')
import rospy
from hrl_msgs.msg import FloatArray
import hrl_lib.util as ut
import hrl_lib.transforms as tr
import hrl_fabric_based_tactile_sensor.adc_publisher_node as apn
from m3skin_ros.ms... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import os
import h5py
import pathlib as p
import numpy as np
from .trs import Trs
__all__ = ['Ta']
class Ta(Trs):
'''
TA experimental class
Child class of TRS (time-resolve spectroscopy)
Handels Uberfast ps/fs and Fastlab TA files.
'''
def __init__(self, full_path=Non... | nilq/baby-python | python |
from . import card
def get_image_slug(value, size: str="small"):
if not isinstance(value, card.Card):
return "ERROR[NOT_A_CARD({!r})]".format(value)
try:
s = card.size_from_str(size)
except TypeError:
return "ERROR[INVALID_SIZE({!r})]".format(size)
try:
retur... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import os
import mongomock
import pymongo
import pytest
import requests
from autoradarr.autoradarr import (
convert_imdb_in_radarr,
filter_by_detail,
filter_in_db,
filter_in_radarr,
filter_regular_result,
get_db,
get_imdb_data,
get_radarr_data,
get_tmdbid_by_... | nilq/baby-python | python |
#
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | nilq/baby-python | python |
import base64
import difflib
import threading
from pathlib import Path
from typing import Tuple
from urllib.parse import quote
from nornir.core.task import Optional, Result, Task
import requests
LOCK = threading.Lock()
def _generate_diff(original: str, fromfile: str, tofile: str, content: str) -> str:
diff =... | nilq/baby-python | python |
#Imports
from PIL import Image
class RotateImage(object):
'''
Rotates the image about the centre of the image.
'''
def __init__(self, degrees):
'''
Arguments:
degrees: rotation degree.
'''
# Write your code here
self.degrees = degree... | nilq/baby-python | python |
"""
@author:ACool(www.github.com/starFalll)
根据微博用户动态进行词云,词频分析,和时间分析
"""
import jieba
from wordcloud import WordCloud
from sqlalchemy import create_engine, MetaData,Table, Column, Integer, String, ForeignKey,update,select
import re
from collections import Counter
from pyecharts import Bar, Pie
from weibo.Connect_mysql i... | nilq/baby-python | python |
import os
DESCRIPTION = "sets a variable for the current module"
def autocomplete(shell, line, text, state):
env = shell.plugins[shell.state]
# todo, here we can provide some defaults for bools/enums? i.e. True/False
if len(line.split()) > 1:
optionname = line.split()[1]
if optionname in ... | nilq/baby-python | python |
import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
img_path = "Resources/text.png"
img = cv2.imread(img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # Convert to RGB
hImg , wImg , = img.shape [0] , img.shape [1]
print("Enter 1 to read ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
hdu_api._internal_utils
-----------------------
"""
import sys
from hdu_api import _pyDes
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
def encrypt(data, first_key, second_key, third_key):
bts_data = extend_to_16bits(data)
... | nilq/baby-python | python |
import os
import numpy as np
class Reversi:
def __init__(self):
# parameters
self.name = os.path.splitext(os.path.basename(__file__))[0]
self.Blank = 0
self.Black = 1
self.White = 2
self.screen_n_rows = 8
self.screen_n_cols = 8
self.enable_actions = ... | nilq/baby-python | python |
__version__ = "v0.0.dev"
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Test different properties in FlowProposal"""
from nessai.proposal import FlowProposal
def test_poolsize(proposal):
"""Test poolsize property"""
proposal._poolsize = 10
proposal._poolsize_scale = 2
assert FlowProposal.poolsize.__get__(proposal) == 20
def test_dims(proposal)... | nilq/baby-python | python |
from corehq.apps.groups.models import Group
from corehq.apps.users.models import CommCareUser, CouchUser
from corehq.apps.users.util import WEIRD_USER_IDS
from corehq.elastic import es_query, ES_URLS, stream_es_query, get_es
from corehq.pillows.mappings.user_mapping import USER_MAPPING, USER_INDEX
from couchforms.model... | nilq/baby-python | python |
"""Contains classes to store the result of a genetic algorithm run.
Additionally, the classes in this module allow for figure generation.
"""
from abc import ABC
import copy
import enum
import math
import random
from typing import Dict, List, Union
from os import listdir, mkdir
from matplotlib import pyplot as plt
f... | nilq/baby-python | python |
from flask import Flask
from flask import request
from flask import jsonify
from flask import send_from_directory
from flask import Response
from flask import abort
from werkzeug import secure_filename
from setup import *
app = Flask(__name__)
#app = Flask(__name__, static_url_path='')
app.config['MAX_CONTENT_LENG... | nilq/baby-python | python |
import gizeh
from .base_form import BaseForm
from .base_picture import BasePicture
@BasePicture.register_subclass('circle')
class Circle(BaseForm):
def draw(self, ind):
circle = gizeh.circle(
r=self.radius[ind],
xy=self.center,
fill=self.color[ind],
**self... | nilq/baby-python | python |
from datetime import datetime
from gtts import gTTS
def speech_1(text, sender):
msg = 'Da: {}. Oggetto: {}'.format(sender, text)
tts = gTTS(text=msg, lang='it')
now = datetime.now()
title = sender.replace(' ', '_') + now.strftime('_%d-%m-%y_%H-%M-%S') + '.mp3'
print(title)
tts.save(title)
... | nilq/baby-python | python |
import random
import numpy as np
import torch
class min_max_node_tracker:
def __init__(self):
self.max = float('-inf')
self.min = float('inf')
def normalized(self, node_Q):
"""
Normalize the value to [0, 1]
Parameters
----------
node_Q : float
... | nilq/baby-python | python |
"""
We are given head, the head node of a linked list containing unique integer
values.
We are also given the list G, a subset of the values in the linked list.
Return the number of connected components in G, where two values are connected
if they appear consecutively in the linked list.
Example 1:
Input:
head: 0-... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import unittest
from clu.phontools.struct import *
from .utils import phrase1
"""
Test `clu.phontools.struct.Phrase` behaviors
"""
class PhraseTests(unittest.TestCase):
phrase1: Phrase = phrase1
def test_equality(self):
"""Comparisions of pairs of `clu.phontools.struct.Phra... | nilq/baby-python | python |
from django.db import models
from django.utils.translation import gettext as _
from django.conf import settings
from django.utils import timezone
from dateutil.relativedelta import relativedelta
from datetime import date
from django.urls import reverse_lazy
from app.models import TimeStampMixin
class TypeOfService(Ti... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-13 10:48
from __future__ import unicode_literals
import annoying.fields
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_fsm
import silver.models.documents.base
def move_documents_to_b... | nilq/baby-python | python |
from Factory import customer
# set data
if __name__ == "__main__":
cust = customer.Customer()
data = cust.get_data()
sorted_data = cust.sort_by_revenue(cust.data)
print('\n\n')
print("In order of annual revenue the accounts low to high are:")
cust.print_data(sorted_data)
print('\n')
pr... | nilq/baby-python | python |
#!/usr/bin/python3
class Transform:
def __init__(self, position, rotation=0, scale=1, layer=0):
"""
The transform defines spatial orientation parameters
:param position: the position
:param rotation: the rotation in degrees
:param scale: the scale (1 is 100%)
:para... | nilq/baby-python | python |
#!/usr/bin/python3
# First choice pack and unpack into sqlite
# Paul H Alfille 2021
# Wrap firstchoice-specific code into an sqlite3 one.
try:
import sys
except:
print("Please install the sys module")
print("\tit should be part of the standard python3 distribution")
raise
import first
import ... | nilq/baby-python | python |
from io import BytesIO
import math
from wand.image import Image as WandImageBase
from wand.color import Color as WandColor
import aiohttp
import discord
class Color(WandColor):
"""
A little subclass of wand.color.Color
Adds functionality for ascii art.
"""
def __init__(self, *args, **kwargs):
... | nilq/baby-python | python |
# Check if One Array can be Nested in Another
# Create a function that returns True if the first list can be nested inside the second.
def can_nest(list1, list2):
sortedlist1 = sorted(list1)
sortedlist2 = sorted(list2)
return sortedlist2[0] < sortedlist1[0] and sortedlist1[-1] < sortedlist2[1]
print(can_nest([3, ... | nilq/baby-python | python |
import cpg_scpi
from time import sleep
def main():
cpg = cpg_scpi.CircuitPlayground()
if cpg.is_open:
repeat(what=cpg.buttonAny, count=10, delaySeconds=1)
repeat(what=cpg.buttonLeft, count=10, delaySeconds=1)
repeat(what=cpg.buttonRight, count=10, delaySeconds=1)
repeat(what=cp... | nilq/baby-python | python |
import random
ch = {}
class Node(object):
def __init__(self, val):
#self.ID = id(self)
#self.weight = random.randint(1, 10)
self.ID = val
self.weight = self.ID
self.cluster = []
self.clusterHead = None
self.neighbours = []
ch[self] = F... | nilq/baby-python | python |
import torch.nn as nn
from ..builder import BACKBONES
from .base_backbone import BaseBackbone
import numbers
import collections
import logging
import functools
import torch
from torch import nn
from torch.nn import functional as F
from mmcls.models.backbones.transformer import Transformer
checkpoint_kwparams = None
#... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 28 13:33:54 2019
Programa que permite contar
las vocales dentro de una palabra
@author: Luis Cobian
"""
palabra = input("Una palabra: ")
palabra = palabra.lower();
a = palabra.count("a");
e = palabra.count("e");
i = palabra.count("i");
o = palabra.count("o");
u = palabr... | nilq/baby-python | python |
import pytest
import urlpath
from cortex.utils.databases import mongo_db
| nilq/baby-python | python |
from __future__ import unicode_literals
import cv2
import numpy as np
import mediapipe as mp
from tensorflow.keras.models import load_model
import cv2
mp_hands = mp.solutions.hands # Hands model
mp_drawing = mp.solutions.drawing_utils # Drawing utilities
def mediapipe_detection_hands(image, model):
# image = cv2.... | nilq/baby-python | python |
# Copyright (c) 2021 PaddlePaddle 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 appli... | nilq/baby-python | python |
from typing import Any, Dict
from .ml_model import MLModel
from .modeler import Modeler
class MLModeler(Modeler):
"""
Base class for H1st ML Modelers. Has capabilities that are specific to MLModels.
"""
def train_model(self, prepared_data: dict) -> MLModel:
"""
Implement logic of ... | nilq/baby-python | python |
# PLEASE NOTE
# ===========
#
# The code in this module is a slightly modified version of the code from
# the Chemistry Toolkit Rosetta Wiki.
# http://ctr.wikia.com/wiki/Calculate_TPSA
#
# The algorithm follows the approach of Ertl et al., which is to sum partial
# surface contributions based on fragments defined in a... | nilq/baby-python | python |
from io import BytesIO
from os import path
from PIL import Image
# Each entry in the list contains the information necessary to render the final
# image with each of the layers resized and cropped accordingly. Some of this
# information is also required by the JavaScript on the page.
TEMPLATES = {
'bq-aquaris': ... | nilq/baby-python | python |
import json
from urllib.parse import parse_qsl, urlencode
import falcon
import requests
from requests_oauthlib import OAuth1Session
from sikre import settings
from sikre.models.users import User
from sikre.resources.auth import utils
from sikre.utils.logs import logger
class LinkedinAuth(object):
def on_post(s... | nilq/baby-python | python |
#!/usr/bin/env python
# coding: utf-8
"""
mq modules defines Message Queue clients and some tools.
"""
from .rabbit import RabbitMQConnection
from .kafka import KafkaConnection
from .consts import MQTypes
class MQClientFactory():
def __init__(self, mq_type):
self._mq_type = mq_type
if mq_type n... | nilq/baby-python | python |
import os
import sys
import csv
import copy
import time
import random
import argparse
import numpy as np
np.set_printoptions(precision=4)
from matplotlib.animation import FFMpegWriter
from tqdm import tqdm
# from minisam import *
# how to install minisam: https://minisam.readthedocs.io/install.html
... | nilq/baby-python | python |
"""
==========================
Non blocking stream reader
==========================
"""
import time
from typing import Optional, TypeVar, Union
from threading import Thread
from queue import Queue, Empty
Stdout = TypeVar('Stdout')
Seconds = TypeVar('Seconds')
######################################################... | nilq/baby-python | python |
from aws_ssm_copy.copy import main
| nilq/baby-python | python |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
class Conv2DBatchNorm(nn.Module):
def __init__(
self,
in_channels,
n_filters,
k_size,
stride,
padding,
bias=True,
dilation=1,
is_batchnorm=True,
):
... | nilq/baby-python | python |
class Solution:
def XXX(self, s: str) -> bool:
# 栈用于存储左括号
stack = []
for char in s:
if char in '([{':
# 如果是左括号,压入
stack.append(char)
else:
# 如果是右括号,栈空(无左括号),或左右不匹配,则无效
if not stack or '([{'.f... | nilq/baby-python | python |
from setuptools import setup
with open("README.md","r") as fh:
long_description = fh.read()
setup(
url="https://github.com/dave-lanigan/kyber-api-python",
author="Daithi",
author_email="dav.lanigan@gmail.com",
name="kybernet",
version="0.0.1",
description="Unofficial python wrapper for Ky... | nilq/baby-python | python |
import numpy as np
list = [np.linspace([1,2,3], 3),\
np.array([1,2,3]),\
np.arange(3),\
np.arange(8).reshape(2,4),\
np.zeros((2,3)),\
np.zeros((2,3)).T,\
np.ones((3,1)),\
np.eye(3),\
np.full((3,3), 1),\
np.random.rand(3),\
np.random.rand(3,3),\
np.random.uniform(5,15,3),\
np.random.randn(3),\
np.random.normal(3, 2.5, ... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: LiuZhi
@time: 2019-01-20 00:28
@contact: vanliuzhi@qq.com
@software: PyCharm
"""
from flask import render_template, send_from_directory, abort, request
from flask.blueprints import Blueprint
from flask_security import login_required
index_bp = Bluepri... | nilq/baby-python | python |
#
# Copyright 2018 ISP RAS (http://www.ispras.ru)
#
# 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 agr... | nilq/baby-python | python |
from sqlalchemy.orm import Session
from ..models import users, sensors
from .. import routers
from .. import schemas
def get_sensors_for_user(db: Session, username: str):
user_id = db.query(users.User).filter(users.User.username == username).first().id
print(user_id)
return db.query(sensors.Sensor).filte... | nilq/baby-python | python |
PATTERNS = {
"precedence": {
"afterward(s)": "^afterwards?",
"after that": "^after th(at|is)",
"eventually": "^eventually",
"in turn": "^in turn",
"later": "^later",
"next": "^next", # followed by pronoun?
"thereafter": "^thereafter"
},
"succession": {
... | nilq/baby-python | python |
#!/usr/bin/python
# coding=utf8
from char_rnn_net import char_rnn_net
from config import Config
from data_utils import get_data
import tensorflow as tf
from utils import pick_top_n
def gen_acrostic(start_words, word2ix, ix2word, prefix_words=None):
with tf.Session() as sess:
save_path = Config.model_path... | nilq/baby-python | python |
#! /usr/bin/env python
import unittest
import ddlib as dd
class TestDDLib(unittest.TestCase):
def setUp(self):
self.words = ["Tanja", "married", "Jake", "five", "years", "ago"]
self.lemma = ["Tanja", "marry", "Jake", "five", "years", "ago"]
def test_materialize_span(self):
span1 = dd.Span(0, 3)
... | nilq/baby-python | python |
"""----------------------------------------------------------
Authors: Wilhelm Ågren <wagren@kth.se>
Last edited: 12-03-2022
License: MIT
----------------------------------------------------------"""
from autograd import Tensor
class Module(object):
def __call__(self, x):
return self.forward(x)
def ... | nilq/baby-python | python |
import math
import multiprocessing
import itertools
import glob
import sys
import time
import re
import numpy as np
from matplotlib import pyplot as plt
from astropy.io import fits as pyfits
from scipy.optimize import fmin_powell
from scipy.interpolate import RectBivariateSpline
from . import kepio, kepmsg, kepkey, kep... | nilq/baby-python | python |
#!/usr/bin/env python3
from __future__ import print_function
import os
import pythondata_cpu_minerva
print("Found minerva @ version", pythondata_cpu_minerva.version_str, "(with data", pythondata_cpu_minerva.data_version_str, ")")
print()
print("Data is in", pythondata_cpu_minerva.data_location)
assert os.path.exist... | nilq/baby-python | python |
#! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Osman Baskaya"
from pprint import pprint
from collections import defaultdict as dd
from classifier_eval import ChunkEvaluator
from logger import ChunkLogger
from classifier import *
import mapping_utils
import sys
import os
chunk_types = ['semcor', 'uniform',... | nilq/baby-python | python |
"""
Chouette storages file.
For now it's just a RedisStorage.
It could be made more enterprise-y with a Storage interface, but it'll
work for now as is.
"""
import json
import logging
import os
import re
from datetime import datetime
from typing import Any, Dict, Optional
from uuid import uuid4
from redis import Redis... | nilq/baby-python | python |
# state ChrMarineStartingLeft
# autogenerated by SmartBody
stateManager = scene.getStateManager()
stateChrMarineStartingLeft = stateManager.createState1D("mocapStartingLeft")
stateChrMarineStartingLeft.setBlendSkeleton('ChrBackovic.sk')
motions = StringVec()
motions.append("ChrMarine@Idle01_ToWalk01")
motion... | nilq/baby-python | python |
"""Valid URL Configuration for testing purposes"""
from django.views.generic import RedirectView
GITHUB = RedirectView.as_view(
url="https://github.com/jambonsw/django-url-check"
)
| nilq/baby-python | python |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nilq/baby-python | python |
#!/usr/bin/env python3
import os
import sys
import argparse
import tempfile
import shutil
from saturation.utils import (normalize_args, export_to_file, get_macs_command_line, parse_outputs, save_plot)
def get_parser():
parser = argparse.ArgumentParser(description='SatScript', add_help=True)
parser.add_argumen... | nilq/baby-python | python |
def decorate(func):
def decorated():
print("==" * 20)
print("before")
func()
print("after")
return decorated
@decorate
def target():
print("target 함수")
target()
## output
"""
========================================
before
target 함수
after
"""
def target2():
print(... | nilq/baby-python | python |
"""This script is used to plot a gene2vec embedding"""
# imports
import argparse
import pandas as pd
import numpy as np
import plotly.express as px
import mygene
import math
import os
# describe program
parser = argparse.ArgumentParser(description='Plots an embedding of a gene2vec hidden layer.')
# arguments
parser.... | nilq/baby-python | python |
class MedianFinder:
def __init__(self):
def addNum(self, num: int) -> None:
def findMedian(self) -> float:
# Your MedianFinder object will be instantiated and called as such:
# obj = MedianFinder()
# obj.addNum(num)
# param_2 = obj.findMedian()
| nilq/baby-python | python |
from sys import stdin
mb_per_month = int(stdin.readline())
n_of_months = int(stdin.readline())
current_num_of_mb = mb_per_month
for n in range(n_of_months):
current_num_of_mb = (current_num_of_mb - int(stdin.readline())) + mb_per_month
print current_num_of_mb
| nilq/baby-python | python |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | nilq/baby-python | python |
from typing import Any, Callable, List, TypeVar
from vkwave.bots.core.dispatching.filters.base import (
BaseFilter,
AsyncFuncFilter,
SyncFuncFilter,
)
from vkwave.bots.core.dispatching.handler.base import BaseHandler
from vkwave.bots.core.dispatching.handler.record import HandlerRecord
F = TypeVar("F", bo... | nilq/baby-python | python |
#!/usr/bin/python
import os
import re
from optparse import OptionParser
SUFFIX=".out"
def main () :
global filename
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="the file to update", metavar="FILE")
parser.add_option("-n", "--name", dest="name",
... | nilq/baby-python | python |
import vvx_nego
if __name__ == "__main__":
#hogeの部分をエンジンが有るpathに変更して実行してください
vvn = vvx_nego.VoicevoxNegotiation("hoge\\run.exe")
vvn.request_audio_query("これは", speaker=1)
vvn.request_synthesis(vvn.audio_query, speaker=1)
vvn.multi_synthesis.append(vvn.synthesis)
vvn.request_audio_quer... | nilq/baby-python | python |
__author__ = 'Aditya Roy'
import unittest
from time import sleep
from WebAutomation.Test.TestUtility.ScreenShot import SS
from WebAutomation.Src.PageObject.Pages.ConfirmationPage import Confirmation
from WebAutomation.Src.PageObject.Pages.HomePage import Home
from WebAutomation.Src.TestBase.EnvironmentSetUp import Env... | nilq/baby-python | python |
# 写入csv文件
import csv
with open('data.csv', 'w') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(['id', 'name', 'age'])
writer.writerow(['10001', 'Mike', 20])
writer.writerow(['10002', 'Bob', 22])
writer.writerow(['10003', 'Jordan', 21])
| nilq/baby-python | python |
#!/usr/bin/env python
import decimal
import hashlib
import json
import sys
# Parse the query.
query = json.load(sys.stdin)
# Build the JSON template.
boolean_keys = [
'ActionsEnabled',
]
list_keys = [
'AlarmActions',
'Dimensions',
'InsufficientDataActions',
'OKActions',
]
alarm = {}
for key, v... | nilq/baby-python | python |
from django.urls import path
from .ajax import CustomerRequirementAjaxView
urlpatterns = [
path('customer/', CustomerRequirementAjaxView.as_view(), name='customerRequirementAjax'),
]
| nilq/baby-python | python |
import settings
from PyQt5.QtCore import QObject, QEvent
from PyQt5.QtCore import Qt
from enum import Enum
import cv2
import numpy as np
from skimage.draw import rectangle, line
#
# class Mode(Enum):
# SHOW = 1
# DRAW = 2
# ERASE = 3
class GrabCutToolInteractor(QObject):
def __init__(self, viewer, ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 3 14:12:10 2018
@author: joshcole
#F1_Data Analysis Fake Loan Company
"""
import pandas as pd
loan_data=pd.read_csv("drop_location/train_loan data.csv")
print (loan_data)
| nilq/baby-python | python |
import tensorflow_hub as hub
import tensorflow as tf
import numpy as np
def predict_image(im):
model = tf.keras.models.load_model('CNN_model.h5', custom_objects={'KerasLayer': hub.KerasLayer})
im = np.asarray(im)
image = tf.image.resize(im, (256, 256))
img = image/255.0
image = tf.expand_dims(img, ... | nilq/baby-python | python |
#!/usr/bin/env python3
import os, sys, json
import numpy as np
import pandas as pd
import functools as fct
import collections as cols
from alignclf import create_clf_data
if __name__ == '__main__':
result_dnames = [
'clst-2018-12-generic_50-inc0-net1',
'clst-2018-12-generic_50-inc0-net2',
... | nilq/baby-python | python |
from setuptools import setup
from setuptools import find_packages
version = '0.0.1'
classifiers = """
Development Status :: 3 - Alpha
Intended Audience :: Developers
Operating System :: OS Independent
Programming Language :: JavaScript
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programm... | nilq/baby-python | python |
#====creating a function for insertion sort==========
def insertion_sort(list1):
#===outer loop================
for i in range(1, len(list1)):
value = list1[i]
j = i-1
while j >= 0 and value < list1[j]:
list1[j+1] = list1[j]
j -= 1
... | nilq/baby-python | python |
import pandas as pd
import requests
url = 'http://localhost:9696/predict'
sample_data_points = [
{'timestamp': '2016-12-22 08:00:00', 't1': 5.0, 't2': 2.0, 'hum': 100.0, 'wind_speed': 13.0, 'weather_code': 4, 'is_holiday': 0, 'is_weekend': 0, 'season': 3}, # actual=2510
{'timestamp': '2016-08-11 15:00:00', ... | nilq/baby-python | python |
import random
from vprasanja import slovar, vprasanja_multiple_izbire, riziki
#======================================================================================
#Definicija konstant
#======================================================================================
STEVILO_DOVOLJENIH_NAPAK = 5
STEVILO_PRAVI... | nilq/baby-python | python |
from .p2pnet import build
# build the P2PNet model
# set training to 'True' during training
def build_model(args, training=False):
return build(args, training) | nilq/baby-python | python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import abc
import json
import os
import random
from collections import OrderedDict
from pprint import pformat
import pydash as ps
import torch
import torch.nn as nn
import numpy as np
import t... | nilq/baby-python | python |
import re
import geopandas as gpd
from ...tessellation import tilers
import shapely
import pytest
poly = [[[116.1440758191, 39.8846396072],
[116.3449987678, 39.8846396072],
[116.3449987678, 40.0430521004],
[116.1440758191, 40.0430521004],
[116.1440758191, 39.8846396072]]]
geom = [sh... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.