content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# This package will contain the spiders of your Scrapy project
#
# Please refer to the documentation for information on how to create and manage
# your spiders.
import scrapy
import json
import sys
from scrapy.http import Request
from Links.items import DSItem
from __builtin__ import any as b_any
class DSSpider(scr... | nilq/baby-python | python |
from typing import Callable, List
class Route:
def __init__(self, url_path: str, fn: Callable, methods: List[str]):
self.url_path = url_path
self.fn = fn
self.methods = methods
| nilq/baby-python | python |
import unittest
from collections import MutableMapping, MutableSequence
from mock import MagicMock, Mock, patch, sentinel
from unittest_expander import expand, foreach, param
from rabbit_tools.delete import DelQueueTool
from rabbit_tools.purge import PurgeQueueTool
tested_tools = [
param(tool=DelQueueTool),
... | nilq/baby-python | python |
'''
Created on 30.08.2015
@author: mEDI
'''
from PySide import QtCore, QtGui, QtSvg
from datetime import datetime
class guitools(object):
def __init__(self, parent):
self.parent = parent
def getPixmapFromSvg(self, svgfile, w=48, h=48):
svg_renderer = QtSvg.QSvgRenderer(svgf... | nilq/baby-python | python |
from animal import *
from species import *
from habitat import *
from transport import *
bob = Betta('orange', 'Bob')
betty = Betta('blue', 'Betty')
| nilq/baby-python | python |
# Generated by Django 3.1.5 on 2021-01-18 09:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0004_delete_card'),
]
operations = [
migrations.CreateModel(
name='Card',
... | nilq/baby-python | python |
"""Test suites for numerical compatibility with librosa"""
import os
import unittest
import torch
import torchaudio
import torchaudio.functional as F
from torchaudio._internal.module_utils import is_module_available
from parameterized import parameterized, param
LIBROSA_AVAILABLE = is_module_available('librosa')
if ... | nilq/baby-python | python |
# Copyright 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | nilq/baby-python | python |
import augument as myaug
from loader.fb_image_gen_pre import *
from settings import *
from utils import getMinMax
import numpy as np
import time
from models.resnet50Reg import *
def plot_images(imlist):
imlen= len(imlist)
plt.figure(figsize=(6, 2))
for i in range(imlen):
plt.subpl... | nilq/baby-python | python |
constants = {
"L": {
"short_name": "L",
"description": "Canopy background adjustment",
"default": 1.0,
},
"g": {
"short_name": "g",
"description": "Gain factor",
"default": 2.5
},
"C1": {
"short_name": "C1",
"description": "Coefficient ... | nilq/baby-python | python |
##########################
# Test script to check if advisors have duplicated idea tokens
# By Pelmen, https://github.com/Pelmen323
##########################
import re
from ..test_classes.generic_test_class import ResultsReporter
from ..test_classes.characters_class import Characters
def test_check_advisors_duplicat... | nilq/baby-python | python |
from setuptools import setup
from distutils.util import convert_path
# Additional keyword arguments for setup
kwargs = {}
d = {}
execfile(convert_path('cinspect/__init__.py'), d)
kwargs['version'] = d['__version__']
with open('README.md') as f:
kwargs['long_description'] = f.read()
packages = [
'cinspect',... | nilq/baby-python | python |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | nilq/baby-python | python |
import typing as _t
from django.contrib.auth import get_user_model, update_session_auth_hash
from django.contrib.auth.password_validation import validate_password
from django.contrib.auth.models import AbstractUser
from django.db import transaction
from django_filters import BooleanFilter, CharFilter
from rest_framewo... | nilq/baby-python | python |
from utils import *
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
train_X = get_attributes('train_binary.csv')
train_Y = get_classes('train_binary.csv')
test_X = get_attributes('test_binary.csv')
test_Y = get_classes('... | nilq/baby-python | python |
"""This file contains functions to handle /delete_webhook command."""
from aiohttp import web
from jinja2 import Environment
from webhook_telegram_bot.database.backends.types import DatabaseWrapperImpl
from webhook_telegram_bot.database.exceptions import ChatNotFound
from webhook_telegram_bot.database.models import Ch... | nilq/baby-python | python |
from ..estimators.estimator_base import H2OEstimator
from h2o.utils.typechecks import Enum
from h2o.utils.typechecks import assert_is_type
class H2OPCA(H2OEstimator):
"""
Principal Component Analysis
"""
algo = "pca"
def __init__(self, model_id=None, k=None, max_iterations=None, seed=None,
... | nilq/baby-python | python |
#!/usr/bin/env python
import os
import sys
from django.conf import settings
import django
DIRNAME = os.path.dirname(__file__)
settings.configure(DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
N = int(input())
numbers = list(map(int, input().split()))
print("Menor valor: %d" % min(numbers))
print("Posicao: %d" % (numbers.index(min(numbers)))) | nilq/baby-python | python |
#!/usr/bin/python
"""
* Copyright 2015 Alibaba Group Holding Limited
*
* 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 req... | nilq/baby-python | python |
#! /usr/bin/env python3
import rospy
from sensor_msgs.msg import PointCloud2
import pcl
import pcl_helper
def do_euclidian_clustering(cloud):
# Euclidean Clustering
white_cloud = pcl_helper.XYZRGB_to_XYZ(cloud) # <type 'pcl._pcl.PointCloud'>
tree = white_cloud.make_kdtree() # <type 'pcl._pcl.KdTree'>
ec ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#/*
# * Copyright (c) 2022 Renwei
# *
# * This is a free software; you can redistribute it and/or modify
# * it under the terms of the MIT license. See LICENSE for details.
# */
import pickle
# =====================================================================
def t_class_save(file_path, ... | nilq/baby-python | python |
# Copyright 2020 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | nilq/baby-python | python |
# Copyright (c) 2022 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@opencyphal.org>
from __future__ import annotations
import asyncio
import time
from typing import Any
import json
import tempfile
from pathlib import Path
from pprint import pprint
import p... | nilq/baby-python | python |
from .mesh_adv_dataset import MeshAdversarialDataset
from .mesh_h36m_dataset import MeshH36MDataset
from .mesh_mix_dataset import MeshMixDataset
from .mosh_dataset import MoshDataset
__all__ = [
'MeshH36MDataset', 'MoshDataset', 'MeshMixDataset',
'MeshAdversarialDataset'
]
| nilq/baby-python | python |
import numpy as np
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
from matplotlib.path import Path
import matplotlib.patches as patches
@image_comparison(['patheffect1'], remove_text=True)
def test_patheffect1():
... | nilq/baby-python | python |
import sys
import irefindex_parser
reload(irefindex_parser)
from irefindex_parser import *
import metrics_nx
reload(metrics_nx)
from metrics_nx import *
try:
import metrics_gt
reload(metrics_gt)
except ImportError:
sys.stderr.write("[warning] Cannot import graph_tool\n")
| nilq/baby-python | python |
import asyncio
import logging
import re
import time
import traceback
from musicbot import _func_, _get_variable, exceptions, factory
from musicbot.bot import MusicBot
from musicbot.constructs import Response
from musicbot.opus_loader import load_opus_lib
from musicbot.utils import fixg, ftimedelta
load_opus_lib()
log... | nilq/baby-python | python |
def const_ver():
return "v8.0"
def is_gpvdm_next():
return False
| nilq/baby-python | python |
from setuptools import setup, find_packages
import codecs
import os
import re
import sys
here = os.path.abspath(os.path.dirname(__file__))
min_requires = [
"pycarol>=2.45.0" ,
"pandas"
]
extras_require = {
}
extras_require["complete"] = sorted(
{v for req in extras_require.values() for v in req}
)
d... | nilq/baby-python | python |
from MeioDeTransporte import MeioDeTransporte
class Aereo(MeioDeTransporte):
def __init__(self, numAsa):
super()
self.__numAsa = numAsa
#Geters e Seters
#*******************************#
def get_numAsas(self):
return self.__numAsa
def set_numAsas(self, num:int):
self.__numAsa =... | nilq/baby-python | python |
import os
from unittest import TestCase
from xml.etree import ElementTree as ET
from xam import Addon
try:
from collections import OrderedDict
except ImportError:
from collective.ordereddict import OrderedDict
class TestAddon(TestCase):
def assert_attrs(self, obj, attrs):
for attr_name, expected_... | nilq/baby-python | python |
import modi
import time
"""
Example script for the usage of dial module
Make sure you connect 1 dial module and 1 speaker module to your network module
"""
if __name__ == "__main__":
bundle = modi.MODI()
dial = bundle.dials[0]
speak = bundle.speakers[0]
while True:
speak.tune = 800, dial.degr... | nilq/baby-python | python |
# DS3231 library for micropython
# tested on ESP8266
#
# Author: Sebastian Maerker
# License: mit
#
# only 24h mode is supported
#
# features:
# - set time
# - read time
# - set alarms
import machine
from math import floor
i2cAddr = 0x68 # change I2C Address here if neccessary
class DS3231:
def _... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
module.name
~~~~~~~~~~~~~~~
Preamble...
"""
from __future__ import absolute_import, print_function, unicode_literals
# TEST SETTINGS
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# Django replaces this, but it still wants it. *shrugs*
DATABASES = {
'default': {
... | nilq/baby-python | python |
"""
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Module to hold helper classes and functions to determine run-time test IP
information. Currently,
"""
import flogging
import ipaddress
import netifaces
import socket
import fit_common
logs = flogging.get_loggers()
class TestHostInterfacer(objec... | nilq/baby-python | python |
import sqlite3 as lite
import datetime
import json
from time import *
class Database:
con = None
cur = None
def __init__(self, dbname):
self.con = lite.connect(dbname + ".db")
self.cur = self.con.cursor()
def createIfNotExists(self):
self.cur.execute("CREATE TABLE if not exi... | nilq/baby-python | python |
import os
import uuid
import time
from aim.engine.aim_repo import AimRepo
def init(overwrite=False):
# Init repo if doesn't exist and return repo instance
repo = AimRepo.get_working_repo()
if not repo:
repo = AimRepo(os.getcwd())
repo.init()
# Check if repo index is empty or not
... | nilq/baby-python | python |
from datetime import date
from django import forms
from django.core.exceptions import ValidationError
from petstagram.common.helps import BootstrapFormMixin, DisabledFieldsFormMixin
from petstagram.main.models import Pet
class CreatePetForm(BootstrapFormMixin, forms.ModelForm):
def __init__(self, user, *args, *... | nilq/baby-python | python |
# grid relative
from .environment_manager import EnvironmentManager
from .group_manager import GroupManager
from .user_manager import UserManager
| nilq/baby-python | python |
# Copyright 2017 BBVA
#
# 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, softwar... | nilq/baby-python | python |
from yunorm.db import models
from yunorm.db import field
CE_DB = {
'host': '10.x.x.x',
'port': 3306,
'user': 'root',
'password': '123456',
'database': 'ce',
'charset': 'utf8mb4',
'pool_size': 10,
}
class Feed(models.Model):
url = field.CharField()
name = field.CharField()
desc... | nilq/baby-python | python |
from .. import db
class Email(db.Model):
""" Email Model for storing contact emails """
__tablename__ = 'email'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
email = db.Column(db.String(100), unique=True)
contact_id = db.Column(db.Integer, db.ForeignKey('contact.id'))
... | nilq/baby-python | python |
# Generated by Django 3.2.8 on 2021-11-09 18:34
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', '0003_auto_202111... | nilq/baby-python | python |
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SubmitField, SelectField, HiddenField
from wtforms.validators import DataRequired, Length, Required, Email
class QuestionForm(FlaskForm):
"""Question form."""
products = [
('learn-ultra', 'Blackboard Learn Ultra'),
... | nilq/baby-python | python |
"""Common constants used in Agtor."""
# volume
ML_to_mm = 100.0
mm_to_ML = 100.0
# distance
km_to_ha = 100.0
ha_to_km = 100.0
# time
SEC_IN_DAY = 86400.0
# amount
MILLION = 1e6
ML = 1e6 # Litres in a megaliter
| nilq/baby-python | python |
import random
from pylons.i18n import set_lang
import sqlalchemy.exc
import ckan.logic
import ckan.lib.maintain as maintain
from ckan.lib.search import SearchError
from ckan.lib.base import *
from ckan.lib.helpers import url_for
CACHE_PARAMETER = '__cache'
class HomeController(BaseController):
repo = model.rep... | nilq/baby-python | python |
##########################################################################
#
# Copyright 2012 Jose Fonseca
# All Rights Reserved.
#
# 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 res... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import json
import shutil
import sys
from copy import deepcopy
from pathlib import Path
import pytest
import requests
from micropy import config, main, project
@pytest.fixture
def mock_requests(mocker, requests_mock, test_archive):
mock_source = {
"name": "Micropy Stubs",
... | nilq/baby-python | python |
import os
def get_records(base_url,
http_get,
data_record,
target,
from_ = '-1min',
until_ = None,
http_connect_timeout_s_ = 0.1,
http_read_timeout_s_ = 1.0):
url = ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('entity', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='EntityActivationEvent',
fie... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# @Time: 2020/7/2 11:50
# @Author: GraceKoo
# @File: interview_31.py
# @Desc: https://leetcode-cn.com/problems/1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof/
class Solution:
def countDigitOne(self, n: int) -> int:
s = ""
while n:
s += str(n)
n -= 1
... | nilq/baby-python | python |
import time
from datetime import datetime, timedelta
import mysql.connector
from openpyxl import load_workbook
from decimal import Decimal
import config
################################################################################################################
# PROCEDURES:
# STEP 1: get all 'new' offline meter f... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
description = 'ZEA-2 counter card setup'
group = 'optional'
tango_base = 'tango://phys.dns.frm2:10000/dns/'
devices = dict(
timer = device('nicos_mlz.jcns.devices.fpga_new.FPGATimerChannel',
description = 'Acquisition time',
tangodevice = tango_base + 'count/timer',
),... | nilq/baby-python | python |
import numpy as np
import coveval.core.losses as losses
def test_normal_scaled():
"""
Asserts that the normalised loss is the same for different `(y_true, y_pred)` where the ratio
`(y_true-y_pred)/y_pred` is constant.
"""
# using default values
ns = losses.normal_scaled()
v1 = ns.comp... | nilq/baby-python | python |
import pygame
screen_x_max = 240
screen_y_max = 320
# colors
RED = pygame.Color(255, 0, 0)
GREEN = pygame.Color(0, 255, 0)
BLUE = pygame.Color(0, 0, 255)
WHITE = pygame.Color(255, 255, 255)
BLACK = pygame.Color(0, 0, 0)
GRAY = pygame.Color(39, 37, 37)
LIGHT_GRAY = pygame.Color(130, 100, 100)
# path to pifidelity
pif... | nilq/baby-python | python |
from .base_public import *
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
SITE_URL = "http://test.com"
| nilq/baby-python | python |
from project.appliances.fridge import Fridge
from project.appliances.stove import Stove
from project.appliances.tv import TV
from project.rooms.room import Room
class OldCouple(Room):
def __init__(self, family_name: str, pension_one: float, pension_two: float):
super().__init__(family_name, (pension_one +... | nilq/baby-python | python |
""" wxyz top-level automation
this should be executed from within an environment created from
the .github/locks/conda.*.lock appropriate for your platform. See CONTRIBUTING.md.
"""
import json
import os
# pylint: disable=expression-not-assigned,W0511,too-many-lines
import shutil
import subprocess
import time
... | nilq/baby-python | python |
class Cell:
def __init__(self):
'''
Initializes all cells as 'Dead'.
Can set the state with accompanying functions.
'''
self.status = 'Dead'
def set_dead(self):
'''
Sets <i>this</i> cell as dead.
'''
self.status = 'Dead'
def set_alive... | nilq/baby-python | python |
class NesteggException(Exception): pass
def first(it) :
try :
return next(it)
except StopIteration :
return None
| nilq/baby-python | python |
from typing import List, Optional
import torch
from torch import Tensor
from tha2.nn.backbone.poser_encoder_decoder_00 import PoserEncoderDecoder00Args, PoserEncoderDecoder00
from tha2.nn.util import apply_color_change, apply_grid_change, apply_rgb_change
from tha2.nn.batch_module.batch_input_module import Bat... | nilq/baby-python | python |
a = str(input('digite seu nome completo: ')).strip().lower()
print('seu nome tem silva ? {}'.format('silva' in a))
| nilq/baby-python | python |
import math
from typing import List
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
# sort the array first
nums.sort()
triplet, min_diff = 0, math.inf
for i in range(len(nums) - 3 + 1):
# skip the same elements to a... | nilq/baby-python | python |
"""
================
DBus wire format
================
This module de/serialize objects from/to dbus wire format.
The spec for this code can be found here:
- https://dbus.freedesktop.org/doc/dbus-specification.html
- https://github.com/GNOME/glib/blob/master/gio/gdbusmessage.c
But if you are like me that prefer some... | nilq/baby-python | python |
from collections import deque
working_bees = deque([int(el) for el in input().split()])
nectar_to_collect = [int(el) for el in input().split()]
honey_process = deque(input().split())
total_honey_collect = 0
def get_honey_value(bee, honey, symbol):
if symbol == "+":
result = bee + honey
elif symbol... | nilq/baby-python | python |
"""Module contains http hmac request, supports HTTP persistent connection."""
import httphmac
import requests
class HttpRequest(httphmac.Request):
"""Class to represent HTTP keep-alive hmac Request."""
_session = None
def __init__(self):
"""Initialize HTTP Request object with requests.Session."... | nilq/baby-python | python |
# @lc app=leetcode id=174 lang=python3
#
# [174] Dungeon Game
#
# https://leetcode.com/problems/dungeon-game/description/
#
# algorithms
# Hard (33.61%)
# Likes: 2439
# Dislikes: 50
# Total Accepted: 128.5K
# Total Submissions: 381.5K
# Testcase Example: '[[-2,-3,3],[-5,-10,1],[10,30,-5]]'
#
# The demons had cap... | nilq/baby-python | python |
import csv
import numpy as np
import tensorflow as tf
import cv2
import os
#import keras
#print(keras.__version__)
#print(tf.__version__)
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten, Dropout
from keras.layers import Conv2D
from keras.utils import to_categorical
from ... | nilq/baby-python | python |
import pickle
import gzip
import threading
def dump(object, filename, protocol=0, compresslevel=1, async=False):
"""Saves a compressed object to disk
"""
def run():
file = gzip.GzipFile(filename, 'wb', compresslevel=compresslevel)
pickle_dump = pickle.dumps(object, protocol=protocol)
... | nilq/baby-python | python |
# Lint as: python3
# Copyright 2019 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 ... | nilq/baby-python | python |
"""Controller for ingest and parsing of character files"""
import logging
import re
from configparser import ConfigParser
from pathlib import Path
class CharfileIngest:
HEADER_PATTERN = r"\bLocation\sName\sID\sCount\sSlots\b"
ROW_PATTERN = r"^.*?\s.*?\s[0-9]*?\s[0-9]*?\s[0-9]*?$"
def __init__(self, confi... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright 2021 Google LLC 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... | nilq/baby-python | python |
import glob
import os
import pytest
import motor.motor_asyncio as motor
# We can either be on the host or in the docker-compose network
def pytest_addoption(parser):
parser.addoption(
"--in-docker-compose",
action="store",
default="",
help="Assume inside a docker network",
)
... | nilq/baby-python | python |
from simple_rl.amdp.AMDPPolicyGeneratorClass import AMDPPolicyGenerator
#from simple_rl.amdp.abstr_domains.grid_world.AbstractGridWorldStateMapperClass import AbstractGridWorldL1StateMapper
from simple_rl.apmdp.AP_MDP.cleanup.CleanupQMDPClass import CleanupQMDP
from simple_rl.apmdp.AP_MDP.cleanup.CleanupQStateClas... | nilq/baby-python | python |
from osbot_aws.apis.shell.Lambda_Shell import lambda_shell
@lambda_shell
def run(event, context):
return 'testing lambda layer ... ' | nilq/baby-python | python |
# -*- coding: utf-8 -*- #
# Copyright 2018 Google Inc. 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 requir... | nilq/baby-python | python |
from imutils.video import VideoStream
from datetime import datetime
import imutils
import cv2
import numpy as np
import sys
import json
import os
import time
import inspect
# Configuration from MMM
CONFIG = json.loads(sys.argv[1])
# Computer vision lib files needed by OpenCV
path_to_file = os.path.dirname(os.path.ab... | nilq/baby-python | python |
# This code is a part of XMM: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner (david.turner@sussex.ac.uk) 10/01/2021, 16:51. Copyright (c) David J Turner
import numpy as np
from astropy.units import Quantity
from ...models.misc import power_law
from ... | nilq/baby-python | python |
def insertion_sort(A):
for i in range(len(A)-1):
while i >= 0 and A[i+1] < A[i]:
A[i], A[i+1] = A[i+1], A[i]
i -= 1
return A
if __name__ == '__main__':
import random
arr = [random.randint(1, 10) for _ in range(10)]
assert insertion_sort(arr) == sorted(arr)
assert... | nilq/baby-python | python |
#
# The MIT License (MIT)
#
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# 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 l... | nilq/baby-python | python |
#https://www.acmicpc.net/problem/2775
testCase = int(input())
for i in range(testCase):
list_base = [i for i in range(1, 15)]
list_new = []
k = int(input())
n = int(input())
for j in range(k):
for l in range(n):
if l-1 >= 0:
list_new.append(list_new[l-1] + list_... | nilq/baby-python | python |
import tornado.ioloop, tornado.web, tornado.websocket, tornado.template
import logging, uuid, subprocess, pykka
from datetime import datetime
from tornado.escape import json_encode, json_decode
logger = logging.getLogger(__name__)
# container for all current pusher connections
connections = {}
frontend = {}
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-03 13:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('democracy', '0004_lengthen_type_field'),
]
operations = [
migrations.AlterFi... | nilq/baby-python | python |
#encoding=utf-8
# bankfile_psr2000.py
# This file is part of PSR Registration Shuffler
#
# Copyright (C) 2008 - Dennis Schulmeister <dennis -at- ncc-1701a.homelinux.net>
#
# This 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 S... | nilq/baby-python | python |
from rest_framework import serializers
from .models import EnrollmentSecret, MetaBusinessUnit, Tag
class MetaBusinessUnitSerializer(serializers.ModelSerializer):
api_enrollment_enabled = serializers.BooleanField(required=False)
class Meta:
model = MetaBusinessUnit
fields = ("id", "name", "api... | nilq/baby-python | python |
from discord.ext import commands
from discord.utils import get
import discord
from datetime import datetime
from bot import Shiro
from util import strfdelta
from apis.anilist_api import find_anime_by_id
import asyncio
class ModsCog(commands.Cog):
def __init__(self, bot: Shiro):
self.bot = bot
@comm... | nilq/baby-python | python |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
##
## Test weakref
##
## * Since the IronPython GC heavily differs from CPython GC (absence of reference countin... | nilq/baby-python | python |
#Done by Lauro Ribeiro (12/02/2021)
# Tutorial 7 - Use the Where Clause
import sqlite3
#Connect to database
conn = sqlite3.connect('customer.db')
#Create a cursor
c = conn.cursor()
#Query the database
c.execute("SELECT * FROM customers WHERE email LIKE '%gmail.com'")
items = c.fetchall()
for item in items:
... | nilq/baby-python | python |
import os, sys
# Kiny passou aqui XD
def restart():
python=sys.executable;os.excl(python, python, *sys.argv)
try:
import colorama, requests
except:
os.system('pip install -r requirements.txt');restart()
try:
from data import ui, numero, cpf, nome, rg, email
except Exception as e:
print('ARQUIVO CORROMPI... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
YieldInComprehensionViolation,
)
from wemake_python_styleguide.visitors.ast.loops import (
WrongComprehensionVisitor,
)
list_comprehension = """
def container():
nodes = [{0} for xy in "abc"]
"""
gener... | nilq/baby-python | python |
# ##################################################################
# SAMPLE USAGE
# ##################################################################
if __name__ == '__main__':
# ####################
# IMPORT
# ####################
import json
import cProfile
from .client import deltaClie... | nilq/baby-python | python |
from .currency import *
from .profile import *
from .account import *
from .base import *
from .transaction import *
from .budget import *
| nilq/baby-python | python |
from kratos import *
import kratos as kts
def create_port_pkt(data_width,
consumer_ports):
return PackedStruct(f"port_pkt_{data_width}_{consumer_ports}",
[("data", data_width, False),
("port", consumer_ports, False),
("v... | nilq/baby-python | python |
from __future__ import division
from __future__ import print_function
def elink_module(elink_intf, emesh_intf):
""" The Adapteva ELink off-chip communication channel.
Interfaces:
elink_intf: The external link signals
emesh_intf: The internal EMesh packet interface
"""
# keep track ... | nilq/baby-python | python |
import os
import re
import sys
from functools import partial
from datetime import datetime
from jinja2 import Template
from traitlets.config.configurable import Configurable
from traitlets import Integer, CBool, Unicode, Float, Set, Dict, Unicode
from jupyterhub.traitlets import Callable
from wtforms import Boolea... | nilq/baby-python | python |
import yaml
from boardgamegeek import BGGClient
def main(user, member_data_file):
bgg = BGGClient()
with open(member_data_file, "r") as data_file:
member_data = yaml.load(data_file)
user_data = member_data[user]
del member_data[user]
user_collection_size = len(user_data)
member_scor... | nilq/baby-python | python |
# Generated by Django 2.2 on 2020-10-20 18:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('library', '0003_librarysubscription_nightshift'),
]
operations = [
migrations.AlterField(
model_name='librarybranch',
... | nilq/baby-python | python |
import mock
from util.factory import channel_factory
from util.factory import new_podcast_factory
from util.factory import requested_podcast_factory
from podcast.download import _download_from_url
from podcast.download import download_channel
from podcast.models import NewStatus
from podcast.models import RadioDirecto... | nilq/baby-python | python |
import mne
import os
import numpy as np
import pandas as pd
#from .kcmodel import scoring_algorithm_kc
from ..features.spectral_features import compute_absol_pow_freq_bands
from .base import BaseMethods
import sys
from scipy.signal import find_peaks
import pywt
import joblib
try:
wd = sys._MEIPASS
except Attribute... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.