content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
import time
import serial
import numpy as np
from pytweening import easeInOutQuint, easeOutSine
from scipy.misc import derivative
from scipy.interpolate import interp1d
from raspberryturk.embedded.motion.arm_movement_engine import ArmMovementEngine
from .pypose.ax12 import *
from .pypose.driver import Driver
SERVO_1 =... | nilq/baby-python | python |
"""
程式設計練習題 1-6 1-14 Turtle:畫三角形.
撰寫一程式,在螢幕的畫三角形。
"""
from turtle import Turtle
TURTLE = Turtle()
TURTLE.showturtle()
TURTLE.right(60)
TURTLE.forward(100)
TURTLE.right(120)
TURTLE.forward(100)
TURTLE.right(120)
TURTLE.forward(100)
| nilq/baby-python | python |
# Generated by Django 3.1.1 on 2020-09-18 16:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0005_personel'),
]
operations = [
migrations.AddField(
model_name='crew',
name='total_assigments',
... | nilq/baby-python | python |
# Generated by Django 3.0.5 on 2020-11-06 16:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('qing', '0003_mistakes'),
]
operations = [
migrations.AddField(
model_name='data',
name='data_url',
field... | nilq/baby-python | python |
# flake8: noqa
from .some_function import some_function
from .SomeClass import SomeClass
from .SomeClass import SOME_CONSTANT
from .wrap_min import wrap_min
from .wrap_min import MinWrapper
| nilq/baby-python | python |
# Copyright (c) 2015 OpenStack Foundation. 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 ... | nilq/baby-python | python |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
# PySNMP MIB module SNMP-USM-AES-MIB (http://pysnmp.sf.net)
# ASN.1 source file:///usr/share/snmp/mibs/SNMP-USM-AES-MIB.txt
# Produced by pysmi-0.0.5 at Sat Sep 19 23:11:55 ... | nilq/baby-python | python |
# Generated by Django 2.0.4 on 2018-04-17 05:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('blog', '0001_initial'),
... | nilq/baby-python | python |
# Generated by Django 3.0.7 on 2020-07-23 07:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('disdata', '0021_auto_20200723_0649'),
]
operations = [
migrations.AlterField(
model_name='disease',
name='victim_id'... | nilq/baby-python | python |
from math import factorial
from collections import Counter
import operator
from itertools import permutations
import math
print(round(2.9))
print(abs(-2.9)) # absolute vaue
print(math.ceil(2.2)) # the ceiling of a number
print(math.floor(9.8))
print(sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]))
print(math.fsum([.... | nilq/baby-python | python |
from util.orientation import Orientation
from util.vec import Vec3
class GameObject:
"""GameObjects are considered to be all objects that can move on the field.
Attributes:
location (Vec3): location vector defined by x,y,z coordinates
velocity (Vec3): velocity vector with x,y,z components
... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2017 Juan Cabral
# 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 withou... | nilq/baby-python | python |
def greet(i):
console.log(str(i) + " Hello World!")
for i in range(8):
greet(i)
| nilq/baby-python | python |
import unittest
from pyconductor import *
class NewUserTest(unittest.TestCase):
def setUp(self):
self.preloaded_dict = load_test_values()
def test_user_can_run_material_testcase(self):
calculate_conductance(self.preloaded_dict["air"])
def test_user_can_add_material_to_materialdict(self... | nilq/baby-python | python |
import re
from pyingest.config import config
class UATURIConverter():
'''
Takes a string containing a comma-separated list of string as input,
and converts any that match UAT entities to their UAT:URI_# instead
(not including URL). Returns a string consisting of comma-separated
keywords/uris.
... | nilq/baby-python | python |
from __future__ import annotations
from typing import Optional
from pydantic.fields import Field
from pydantic.types import StrictBool
from ..api import BodyParams, EndpointData
from ..types_.endpoint import BaseEndpoint
from ..types_.inputs import WorkflowCustomField
from ..types_.scalar import WorkflowId
class W... | nilq/baby-python | python |
from app import *
keyboard = types.InlineKeyboardMarkup(row_width=1)
a = types.InlineKeyboardButton(text=emoji.emojize(":memo: Activate Subscriber", use_aliases=True), callback_data="activate")
b = types.InlineKeyboardButton(text=emoji.emojize(":scroll: Send Advertisement", use_aliases=True), callback_data="ad")
c = ... | nilq/baby-python | python |
import cv2
import numpy as np
from imread_from_url import imread_from_url
from acvnet import ACVNet
resolutions = [(240,320),(320,480),(384,640),(480,640),(544,960),(720,1280)]
# Load images
left_img = imread_from_url("https://vision.middlebury.edu/stereo/data/scenes2003/newdata/cones/im2.png")
right_img = imread_fr... | nilq/baby-python | python |
"""
Test Models
A set of trivial models for PyTests
"""
import pandas as pd
import numpy as np
import re
class SingleWordModel:
def __init__(self, name, colname, myword):
self.name = name
self.colname = colname
self.word = myword
def predict(self, x: pd.DataFrame) -> np.ndarr... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 6 13:24:49 2021
@author: Asus
"""
import pandas as pd
import numpy as np
import string
import unicodedata
import re
from functools import reduce
def strip_accents(s):
return ''.join(c for c in unicodedata.normalize('NFD', s)
if unicodedata.category(... | nilq/baby-python | python |
'''
test_fix.py: Test fix_fusion
'''
import os
import pysam
from utils import check_file
from circ.CIRCexplorer import fix_fusion
class TestFix(object):
def setup(self):
'''
Run fix_fusion
'''
print('#%s: Start testing fix_fusion' % __name__)
ref = 'data/ref.txt'
... | nilq/baby-python | python |
import numpy as np
import rich
from rich import print, pretty
pretty.install()
#############
from price_model import SimulateGBM
from basis_fun import laguerre_polynomials
##############
def priceOption(S0, K, r, paths, sd, T, steps, Stock_Matrix,k, reduce_variance = True):
steps = int(steps)
Stn = Stock_Matri... | nilq/baby-python | python |
"""
Copyright 2019 Samsung SDS
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 |
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['scikit-learn', 'pandas', 'scipy', 'numpy', 'category_encoder... | nilq/baby-python | python |
import copy
import weakref
import re
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_unicode
from django.core.exceptions import FieldError, ValidationError
from django.utils.translation import get_language
from itertools import izip
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from lantz import Feat, Action, Driver, Q_
from lantz.drivers.ni.daqmx import AnalogOutputTask, VoltageOutputChannel
import numpy as np
import pandas as pd
import os
import time
default_folder = os.path.dirname(__file__)
default_filename = os.path.join(default_folder, 'power_calibration.csv')
... | nilq/baby-python | python |
#!/usr/local/bin/python3
from SM1 import * # The SM1 library is imported here
COMPORT = '/dev/tty.usbserial-AL05TVH5' # Serial port (on Windows, it is COM1,2,...)
ser = setup_serialcom(COMPORT) # Connection w serial port established
print('Reading axes position...\n')
output1 = query_position(ser, 1) ... | nilq/baby-python | python |
# The code that helped me to achive this is from Just Van Rossum: https://gist.github.com/justvanrossum/b65f4305ffcf2690bc65
def drawShape(shapePhase, shapeRadius):
def variation(pt, radius, phase):
x, y = pt
dx = radius * cos(phase)
dy = radius * sin(phase)
return x + dx, y + ... | nilq/baby-python | python |
## Hit-and-Run Sampling, adapted from Johannes Asplund-Samuelsson (https://github.com/Asplund-Samuelsson)
# Import libraries
import sys, os
import numpy as np
import time
import math
from scipy import stats
#######################################################################################################
## Nam... | nilq/baby-python | python |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.mixture import GaussianMixture as GMM
from sklearn.cluster import DBSCAN
from time import time
def color_match(im, Q = 5, verbose = False):
GMM_FEATURE_MATRIX = im.reshape(-1,3)
model = GMM(n_components=Q,covariance_type='diag')
CLOSE... | nilq/baby-python | python |
from inventory.env import Staging
from inventory.project import BackEnd, FrontEnd
class DevelopHost(Staging, BackEnd, FrontEnd):
ansible_host = 'develop_hostname'
version = 'develop'
extra = {'debug': 1}
class StagingHost(Staging, BackEnd, FrontEnd):
ansible_host = 'master_hostname'
version = 'm... | nilq/baby-python | python |
"""
Tests of neo.io.neomatlabio
"""
import unittest
from neo.io import MicromedIO
from neo.test.iotest.common_io_test import BaseTestIO
class TestMicromedIO(BaseTestIO, unittest.TestCase, ):
ioclass = MicromedIO
entities_to_download = [
'micromed'
]
entities_to_test = [
'micromed/Fil... | nilq/baby-python | python |
# ElectrumSV - lightweight Bitcoin SV client
# Copyright (C) 2019-2020 The ElectrumSV Developers
#
# 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 lim... | nilq/baby-python | python |
import json
from ipaddress import IPv4Address
from pytest_toolbox.comparison import AnyInt, RegexStr
from .conftest import Factory
async def test_login(cli, url, factory: Factory):
user = await factory.create_user()
r = await cli.post(
url('auth:login'),
data=json.dumps({'email': user.email,... | nilq/baby-python | python |
from datasets.base.image.manipulator import ImageDatasetManipulator
import numpy as np
import copy
from datasets.base.common.operator.manipulator import fit_objects_bounding_box_in_image_size, \
update_objects_bounding_box_validity, prepare_bounding_box_annotation_standard_conversion
from data.types.bounding_box_fo... | nilq/baby-python | python |
import numpy as np
import pydub
import librosa
import scipy
import scipy.fftpack as fft
silence_threshold = 60 # in -dB relative to max sound which is 0dB
lambdaa = 1 # amplitude of delta signal in PEFBEs
n_mels = 60 # feature dimension for each frame
segment_length = 41 # 1 segment is 41 frames
segment_hop_... | nilq/baby-python | python |
"""empty message
Revision ID: 40557a55e174
Revises: 0f9ddf8fec06
Create Date: 2021-09-13 03:11:26.003799
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '40557a55e174'
down_revision = '0f9ddf8fec06'
branch_labels = None
depends_on = None
def upgrade():
# ... | nilq/baby-python | python |
import numpy as np
import matplotlib.pyplot as plt
import pdb
import hsmix
import scipy as sp
#====================================================================
def test_ideal_gas_press():
TOL = .03
xHS = 1.0
# atmospheric conditions
mHS = 28.97
kT = 1.0/40 # 300 K
V0 = 39270.0
V_a = V... | nilq/baby-python | python |
from simplerpcgen.rpcgen import rpcgen
| nilq/baby-python | python |
import os
import sys
from .graph import SubtaskGraph
from sge.mazemap import Mazemap
import numpy as np
from .utils import get_id_from_ind_multihot
from sge.utils import WHITE, BLACK, DARK, LIGHT, GREEN, DARK_RED
class MazeEnv(object): # single batch
def __init__(self, args, game_name, graph_param, game_len, gam... | nilq/baby-python | python |
from django.contrib.auth.backends import BaseBackend
from naloge.models import Uporabnik
from accounts.francek import *
from django.conf import settings
class FrancekBackend(BaseBackend):
# FrancekBackend deluje kot sekundarni nacin prijave v aplikacijo. V
# nastavitvah mora biti na zadnjem mestu - kot v nasl... | nilq/baby-python | python |
from app.programs.loader import load
list = load('app/programs/original')
| nilq/baby-python | python |
n = input("Enter the name:: ")
reverseString = []
i = len(n)
while i > 0:
reverseString += n[ i - 1 ]
i = i - 1
reverseString = ''.join(reverseString)
print("ReversedString::", reverseString)
| nilq/baby-python | python |
pa = int(input('Digite o primeiro termo da PA: '))
r = int(input('Digite a razao da PA: '))
c = 0
mais = 10
tot = 0
print('Os termos são', end=" ")
while mais != 0:
tot += mais
while c <= tot:
c += 1
print('{}'.format(pa), end=' -> ')
pa = pa + r
print('PAUSA')
mais = int(input('... | nilq/baby-python | python |
from io import StringIO
from cline import CannotMakeArguments, CommandLineArguments
from mock import patch
from pytest import raises
from smokestack.exceptions import SmokestackError
from smokestack.register import register
from smokestack.tasks.operate import OperateTask, OperateTaskArguments
from smokestack.types i... | nilq/baby-python | python |
import os
import json
import argparse
import glob as gb
import utils as ut
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def main(args):
""" Execute:
-------------------------------------------------------------------
python process.py --path data/v6... | nilq/baby-python | python |
# python 3 headers, required if submitting to Ansible
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.utils.display import Display
display = Display()
class FilterModule(object):
"""
ansible filter
"""
def filters(self):
return {
... | nilq/baby-python | python |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | nilq/baby-python | python |
# Copyright 2016 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 |
import bartender
import atexit
from flask import Flask, request, Response
from drinks import drink_list, drink_options
#import atexit
from menu import MenuItem, Menu, Back, MenuContext, MenuDelegate
atexit.register(bartender.Bartender.atExit)
pete = bartender.Bartender()
pete.buildMenu(drink_list, drink_options)
app ... | nilq/baby-python | python |
import datetime
# Gets time from milliseconds
# Returns string formatted as HH:MM:SS:mmm, MM:SS:mmm or S:mmm, depending on the time.
def get_time_from_milliseconds(milli):
milliseconds = milli % 1000
seconds= (milli//1000)%60
minutes= (milli//(1000*60))%60
hours= (milli//(1000*60*60))%24
if hours... | nilq/baby-python | python |
import numpy as np
from sklearn.metrics import r2_score
from metaflow_helper.models import LightGBMRegressor
from metaflow_helper.constants import RunMode
def test_lightgbm_model_regressor_handler_train():
n_examples = 10
n_repeat = 10
offset = 10
X = np.repeat(np.arange(n_examples), n_repeat)[:, None... | nilq/baby-python | python |
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, BatchNormalization, Activation
from tensorflow.keras.layers import UpSampling2D, add, concatenate, MaxPool2D, Dropout
import tensorflow.keras.backend as K
import numpy as np
def basic_Block(inputs, out... | nilq/baby-python | python |
c = get_config()
#Export all the notebooks in the current directory to the sphinx_howto format.
c.NbConvertApp.notebooks = ['*.ipynb']
c.NbConvertApp.export_format = 'markdown'
c.NbConvertApp.output_files_dir = '../assets/posts/{notebook_name}_files'
| nilq/baby-python | python |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2012,2013,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | nilq/baby-python | python |
import urllib.parse
from sp_api.api import ProductFees
from sp_api.base import Marketplaces
def test_get_fees_for_sku():
print(ProductFees().get_product_fees_estimate_for_sku("Foo's Club", 39.32, is_fba=False))
| nilq/baby-python | python |
# Copyright (c) 2022 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 |
import os
import datetime
from omegaconf import OmegaConf
from . import io
from . import features
from . import models
from . import metrics
from . import kfolds
from . import permutation
conf = None
def setup(config="config.yaml"):
global conf
conf = OmegaConf.load(config)
if not os.path.exists('out... | nilq/baby-python | python |
"Livestreamer main class"
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os
import re
import sys
# Python 2/3 compatibility
try:
from urllib.parse import urlsplit
except ImportError:
from urlparse import urlsplit
try:
from configparser i... | nilq/baby-python | python |
"""
Tests ``from __future__ import absolute_import`` (only important for
Python 2.X)
"""
import jedi
from .. import helpers
@helpers.cwd_at("test/test_evaluate/absolute_import")
def test_can_complete_when_shadowing():
script = jedi.Script(path="unittest.py")
assert script.completions()
| nilq/baby-python | python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import math
import os
import random
import unittest
from typing import Li... | nilq/baby-python | python |
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
from .....exabel.api.anal... | nilq/baby-python | python |
"""Metadata read/write support for bup."""
# Copyright (C) 2010 Rob Browning
#
# This code is covered under the terms of the GNU Library General
# Public License as described in the bup LICENSE file.
import errno, os, sys, stat, pwd, grp, struct, re
from cStringIO import StringIO
from bup import vint, xstat
from bup.d... | nilq/baby-python | python |
import functools
import hashlib
import os
from typing import BinaryIO, Final, List, Optional, final, Iterable
@final
class Team:
team_id: Final[str]
name: Final[str]
def __init__(self, team_id: str, name: str):
self.team_id = team_id
self.name = name
@final
class Replay:
PLAYER_TAG_... | nilq/baby-python | python |
from .extension import setup
__version__ = "0.1.0"
__all__ = ["setup"]
| nilq/baby-python | python |
#!/usr/bin/env python3
import csv
import logging
import subprocess
import os
import sys
from github import Github
from s3_helper import S3Helper
from get_robot_token import get_best_robot_token
from pr_info import PRInfo, get_event
from build_download_helper import download_all_deb_packages
from upload_result_helper... | nilq/baby-python | python |
"""
Top-level namespace for meta-analyses.
"""
from . import cbma
from . import ibma
from . import esma
__all__ = ['cbma', 'ibma', 'esma']
| nilq/baby-python | python |
## 테스트 셋 기본
def make_test_set():
test_df = pd.read_csv("sample_submission.csv", usecols=["order_id"])
# order_id에 맞는 user_id를 찾아서 merge
orders_df = pd.read_csv("orders.csv", usecols=["order_id","user_id", "order_dow", "order_hour_of_day"])
test_df = pd.merge(test_df, orders_df, how="inner", on="o... | nilq/baby-python | python |
import orodja
import re
import unicodedata
import os
from pathlib import Path
leta = ["/pyeongchang-2018", "/sochi-2014", "/vancouver-2010", "/turin-2006", "/salt-lake-city-2002", "/nagano-1998",
"/lillehammer-1994", "/albertville-1992", "/calgary-1988", "/sarajevo-1984", "/lake-placid-1980", "/innsbruck-197... | nilq/baby-python | python |
#
# MythBox for XBMC
#
# Copyright (C) 2011 analogue@yahoo.com
# http://mythbox.googlecode.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at... | nilq/baby-python | python |
import io
import json
import os
import click
from demisto_sdk.commands.common.constants import (PACK_METADATA_SUPPORT,
PACKS_DIR,
PACKS_PACK_META_FILE_NAME,
FileType)... | nilq/baby-python | python |
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
from deeploader.dataset.dataset_base import ArrayDataset
import util
from dataset.data_util import get_img
def rotate(angle, x, y):
"""
基于原点的弧度旋转... | nilq/baby-python | python |
from abc import abstractmethod
from dataclasses import dataclass
import textwrap
from typing import Any, Callable, Dict, Iterable, Iterator, List, Sequence, Tuple, Union
import clingo
from clingo import MessageCode, Symbol, SymbolicAtom
from clingo import ast
from clingo.ast import parse_string
from eclingo.prefixes ... | nilq/baby-python | python |
"""Testing module for priorityq."""
import pytest
@pytest.fixture
def test_q():
"""Test fixtures of priority qs."""
from src.priorityq import PriorityQ
q0 = PriorityQ()
q1 = PriorityQ()
q1.insert('sgds', 10)
q1.insert('another', 9)
q1.insert('another', 8)
q1.insert('another', 7)
q... | nilq/baby-python | python |
###
#
# Lenovo Redfish examples - Get metric inventory
#
# Copyright Notice:
#
# Copyright 2019 Lenovo 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.o... | nilq/baby-python | python |
#!usr/bin/python
# -*- coding:utf8 -*-
# 列表生成式(列表推导式)
# 1. 提取出1-20之间的奇数
# odd_list = []
# for i in range(21):
# if i % 2 == 1:
# odd_list.append(i)
# odd_list = [i for i in range(21) if i % 2 == 1]
# print(odd_list)
# 2. 逻辑复杂的情况 如果是奇数将结果平方
# 列表生成式性能高于列表操作
def handle_item(item):
return item * item
odd... | nilq/baby-python | python |
"""
Desenvolva uma lógica que leia o peso e a altura de uma pessoa,
calcule seu IMC e mostre seu status.
Rasgue as minhas cartas
E não me procure mais
Assim será melhor, meu bem
O retrato que eu te dei
Se ainda tens, não sei
Mas se tiver, devolva-me
Devolva-me - Adriana Calcanhot... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from flask import Flask
from peewee import MySQLDatabase
from celery import Celery
from config import config
db = MySQLDatabase(None)
def create_app(config_name):
"""
创建flask应用对象
:param config_name:
:return:
"""
app = Flask(__name__)
app.config.from_object(confi... | nilq/baby-python | python |
from __future__ import print_function, division
#
import sys,os
quspin_path = os.path.join(os.getcwd(),"../../")
sys.path.insert(0,quspin_path)
#
from quspin.operators import hamiltonian # Hamiltonians and operators
from quspin.basis import spinful_fermion_basis_1d # Hilbert space spinful fermion basis
import numpy as ... | nilq/baby-python | python |
"""
Sponge Knowledge Base
Action metadata Record type
"""
def createBookType(name):
return RecordType(name, [
IntegerType("id").withNullable().withLabel("Identifier"),
StringType("author").withLabel("Author"),
StringType("title").withLabel("Title")
... | nilq/baby-python | python |
"""
restriction generaters representing sets of packages
"""
| nilq/baby-python | python |
# http://www.geeksforgeeks.org/design-a-stack-that-supports-getmin-in-o1-time-and-o1-extra-space/
from sys import maxint
class MyStack:
def __init__(self):
self.minimum = -maxint-1
self.stack = []
def push(self,val):
if not self.stack:
self.minimum = val
... | nilq/baby-python | python |
import pygame
import math
pygame.font.init()
DEBUG_FONT = pygame.font.Font(None, 22)
def get_surface(obj):
""" Returns a Surface representing the parameter.
if obj is the filename of an image, a surface containing the image will be returned.
if obj is a Surface, it will be returned unchanged.
"""
... | nilq/baby-python | python |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
import torch.distributions as dist
from beanmachine.ppl.experimental.abc.abc_infe... | nilq/baby-python | python |
from .base import init
| nilq/baby-python | python |
__author__ = 'zaxlct'
__date__ = '2017/4/6 下午12:14'
import re
from django import forms
from operation.models import UserAsk
# class UserAskForm(forms.Form):
# name = forms.CharField(required=True, min_length=2, max_length=20)
# phone = forms.CharField(required=True, min_length=11, max_length=11)
# cours... | nilq/baby-python | python |
from .libs import metadata
from .libs import utils
from .libs.athena import Athena
from .libs.s3 import S3
from .libs.csv_parser import single_column_csv_to_list, csv_to_list_of_dicts
from .libs.policy_generator import PolicyGenerator
import argparse
import logging
def arguments():
parser = argparse.ArgumentParse... | nilq/baby-python | python |
import boto3
import json
from datetime import datetime
#to download, <bucket, obj name, file path to dl to>
# s3.download_file(
# "iot-fastgame-proj-ads","beard.jpg","downloads/beard.jpg"
# )
#to upload <file path to upload from, bucket, obj name>
# s3.upload_file('images/pokemon.jpg','iot-fastgame-proj-ads','pok... | nilq/baby-python | python |
import turtle as t # підключення бібліотеки
from random import randint
from turtle import *
screen = t.getscreen() # вікно
t.title("Черепашка")
my_turtle = t.Turtle()
my_turtle.shape("turtle") # square , triangle , classic
#my_turtle.color("green")
my_turtle.color("black","red")
my_turtle.shapesize(2,2,0)
#for i in ran... | nilq/baby-python | python |
cisco_ios = "Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1)"
a = cisco_ios.split()
print(a)
b = a.index('Version')
c = a[b+1]
d = c[:-1]
print(d)
# for i in a:
# if i=='Version':
# print(i) | nilq/baby-python | python |
from math import sqrt, ceil
def p1(num: int):
size = ceil(sqrt(num))
center = ceil((size - 1) / 2)
return max(0, center - 1 + abs(center - num % size))
assert p1(1) == 0
assert p1(12) == 3
assert p1(23) == 2
assert p1(1024) == 31
assert p1(347991) == 480
# p2 349975
# https://oeis.org/A141481
| nilq/baby-python | python |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# Additional Authors:
# Mike Auty <mike.auty@gmail.com>
#
# This file is part of Volatility.
#
# Volatility is free software; you can redistribute it and/or modify
# it under the terms of... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
__author__ = 'abbot'
import requests
# response = requests.get("https://www.12306.cn/mormhweb/", verify = False)
# print(response.text)
response = requests.get("http://www.baidu.com")
print(response.content)
| nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'a test module'
import sys
_author_ = 'tianmaolin'
def fun1(*a):
print(a)
def fun2(**b):
print(b)
# fun1(1, 2, 5)
# fun2(name='tianmlin', age=22)
def test():
args = sys.argv
if len(args) == 1:
print("Hello World!")
elif len(args) == 2:
... | nilq/baby-python | python |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from conte... | nilq/baby-python | python |
import os
from typing import Any
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
import cssutils
import requests
url_re = r'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)'
def delete_duplicates(l: list) -> list:
new_l = []
... | nilq/baby-python | python |
# Generated by Django 2.2 on 2019-06-21 07:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0055_auto_20190620_1527'),
]
operations = [
migrations.AddField(
model_name='presentation',
name='is_keynote',
... | nilq/baby-python | python |
# AUTOGENERATED FILE! PLEASE DON'T EDIT
from .callbacks import Callback, Callbacks, Cbs
import k1lib, os, torch
__all__ = ["Autosave", "DontTrainValid", "InspectLoss", "ModifyLoss", "Cpu", "Cuda",
"DType", "InspectBatch", "ModifyBatch", "InspectOutput", "ModifyOutput",
"Beep"]
@k1lib.patch(Cbs)
c... | nilq/baby-python | python |
import cowsay
print(cowsay.get_output_string('trex', 'Hello (extinct) World')) | nilq/baby-python | python |
#!/usr/bin/env python
# coding=utf-8
#list:[]
bicycles = ['trek', 'cannodale', 'redline', 'speciakixrdd']
print(bicycles)
#下标正数: 0,1,2,... , n - 1; 到着数: -1, -2, ...., n
print(bicycles[0].title())
print(bicycles[-1])
motorcycles = ['honda', 'yamaha', 'suzyki']
print(motorcycles)
## 修改
motorcycles[0] = 'ducati... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.