content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= # Ural URL Extraction Unit Tests # ============================================================================= from ural import urls_from_text TEXT = """Facial-recognition technology is advan...
nilq/baby-python
python
"""Train the ASR model. Tested with Python 3.5, 3.6 and 3.7. No Python 2 compatibility is being provided. """ import time import tensorflow as tf from asr.input_functions import input_fn_generator from asr.model import CTCModel from asr.params import FLAGS, get_parameters from asr.util import storage RANDOM_SEED =...
nilq/baby-python
python
from typing import List, Union from datetime import datetime from mongoengine import * from regex import F class Prediction(Document): """ The GFI prediction result for an open issue. This collection will be updated periodically and used by backend and bot for GFI recommendation. Attributes: ...
nilq/baby-python
python
def func(a): return a + 1 ls = [func(a) for a in range(10)]
nilq/baby-python
python
from lxml import etree from re import search class Response: @classmethod def resultDict(cls, strResult): responseGroup = search("\<RetornoXML>(.*)\</Retorno", strResult).group(1) res = {} root = etree.fromstring(responseGroup) for i in root.iter(): text = i.text ...
nilq/baby-python
python
import requests from configparser import ConfigParser import pandas as pd from ipywidgets import widgets, interact from IPython.display import display from .appconfig import AppConfig from abc import ABC, abstractmethod class widget_container: def __init__(self, **wlist): interact(self.on_change, **wlist...
nilq/baby-python
python
# -*- coding:utf-8 -*- from DLtorch.trainer.base import BaseTrainer from DLtorch.trainer.CNNTrainer import CNNTrainer
nilq/baby-python
python
import pytest from rest_framework import status from rest_framework.reverse import reverse from .factories import JsonFactory pytestmark = pytest.mark.django_db @pytest.fixture def sample_json(box): return JsonFactory(box=box, data={"key": "value", "lol": {"name": "hue", "age": 1}}) @pytest.mark.parametrize("...
nilq/baby-python
python
import logging import logging.config from decimal import Decimal from pprint import pformat import time from sqlalchemy import Column, String from sqlalchemy.orm import relationship from trader.exchange.abstract_book import AbstractBook from trader.exchange.order import Order import config from trader.database.manage...
nilq/baby-python
python
# coding=utf-8 # *** WARNING: this file was generated by Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from . import _utilities from . im...
nilq/baby-python
python
import typing from uuid import uuid4 from pydantic import BaseModel IdentifierType = typing.NewType("IdentifierType", str) def create_identifier() -> IdentifierType: """Create an identifier""" return IdentifierType(str(uuid4())) class EmptyModel(BaseModel): pass OffsetVector = typing.Tuple[float, fl...
nilq/baby-python
python
import os, re import pandas as pd path = os.getcwd() files = os.listdir('C:/Users/Richard/Desktop/Database/嘉南AD_20200317') #print(files) files_xls = [f for f in files if f[-4:] == 'xlsx'] #print(files_xls) df = pd.DataFrame() for f in files_xls: data = pd.read_excel('C:/Users/Richard/Desktop/Database/嘉南AD_20200...
nilq/baby-python
python
def main(): #Lets Create the test dataset to build our tree dataset = {'Name':['Person 1','Person 2','Person 3','Person 4','Person 5','Person 6','Person 7','Person 8','Person 9','Person 10'], 'Salary':['Low','Med','Med','Med','Med','High','Low','High','Med','Low'], 'Sex':['Male','Male'...
nilq/baby-python
python
from django.db import models from django.conf import settings class Post(models.Model): ip = models.CharField(max_length=50) idUser = models.CharField(max_length=250) idClick = models.CharField(max_length=250, primary_key=True) classe = models.CharField(max_length=50) texto = models.TextField(max_l...
nilq/baby-python
python
from typing import Optional from botocore.client import BaseClient from typing import Dict from botocore.paginate import Paginator from botocore.waiter import Waiter from typing import Union from typing import List class Client(BaseClient): def associate_node(self, ServerName: str, NodeName: str, EngineAttributes...
nilq/baby-python
python
import media import fresh_tomatoes # Create movie instance for Toy Story john_wick = media.Movie("John Wick", "An ex-hitman comes out of retirement to track down the gangsters that took everything from him.", "https://upload.wikimedia.org/wikipedia/en/9/98/John_Wick_Teas...
nilq/baby-python
python
import pickle mv_grade = [0]*17771 for i in range(18): with open('temgrade/'+str(i)+'_tem_grade', 'rb') as tf: c = pickle.load(tf) for (mi, grade) in c.items(): mv_grade[int(mi)] = float(grade) print str(i)+ " DONE!" with open('movie_grade.list', 'wb') as mg: pickle.dump(mv_grade, mg)
nilq/baby-python
python
import json # alias # bind # bind # bind def loadCommand(data): return command(data[0], data[1], data[2]) def loadBind(data, key): return bind(loadCommand(data[0]), key, data[1], data[2]) def loadBKey(data, base=None): b = bKey(data[0], base) for i in data[1]: loadBind(i, b) return b ...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Collect the occupancy dataset. See the README file for more information. Author: G.J.J. van den Burg License: This file is part of TCPD, see the top-level LICENSE file. Copyright: 2019, The Alan Turing Institute """ import argparse import clevercsv import hashlib i...
nilq/baby-python
python
""" Test CLI References: * https://click.palletsprojects.com/en/7.x/testing/ ToDo: expand cli testing """ from __future__ import annotations from typing import Any from click.testing import CliRunner from pytest_mock import MockFixture from alsek import __version__ def test_version( cli...
nilq/baby-python
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals import tablib import pytz from datetime import datetime from decimal import Decimal, InvalidOperation from django.db.utils import IntegrityError from django.core.management.base import BaseCommand from django.utils import timezone from ...models impor...
nilq/baby-python
python
# -*- coding: utf-8 -*- from .eg import eg_hierarchy
nilq/baby-python
python
"""Dahua package constants""" __version__ = '0.0.2-2' __author__ = "Alexander Ryazanov <alryaz@xavux.com>" from .device import * from .channel import *
nilq/baby-python
python
import pygame from settings import * class Tile(pygame.sprite.Sprite): def __init__(self, pos, groups): super().__init__(groups) self.image = pygame.image.load('assets/rock.png').convert_alpha() self.rect = self.image.get_rect(topleft = pos)
nilq/baby-python
python
#id name color ## Cityscapes, kiti, vkiti CITYSCAPES_LABELS = \ [[ 0 , 'unlabeled' , ( 0, 0, 0)], [ 1 , 'ego vehicle' , ( 0, 0, 0)], [ 2 , 'rectification border' , ( 0, 0, 0)], [ 3 , 'out of roi' , ( 0, 0, 0)], [ 4 , 'static' , ( 0, ...
nilq/baby-python
python
"""FastApi Backend for my Portfolio Website. This doesn't have much purpose currently, but eventually I want to use this backend to interact with various Python-based projects I develop. """
nilq/baby-python
python
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
nilq/baby-python
python
# Generated by Django 2.2.5 on 2019-09-25 16:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('backend', '0002_squarefootlayout'), ] operations = [ migrations.AddField( model_name='squarefootlayout', name='fill_...
nilq/baby-python
python
from __future__ import absolute_import, division, print_function from stripe.api_resources.abstract import APIResource class Mandate(APIResource): OBJECT_NAME = "mandate"
nilq/baby-python
python
from django.contrib.auth import logout, authenticate, login from django.core.checks import messages from django.shortcuts import render, redirect from requests import auth from django.contrib.auth.models import User, auth from hotels.models import Reservation from .forms import * # Create your views here. def log(req...
nilq/baby-python
python
# -*- Mode: Python; tab-width: 8; indent-tabs-mode: nil; python-indent-offset:4 -*- # vim:set et sts=4 ts=4 tw=80: # This Source Code Form is subject to the terms of the MIT License. # If a copy of the ML was not distributed with this # file, You can obtain one at https://opensource.org/licenses/MIT # author: JackRed ...
nilq/baby-python
python
# Test MQTT and Async # 10 second button monitor from machine import Pin import pycom import time import uasyncio as asyncio from my_mqtt import MyMqtt pycom.heartbeat(False) class RGB: def __init__(self): self.colour = 0x000000 def set(self, colour): self.colour = colour pycom.rgble...
nilq/baby-python
python
#Sobreira Gustavo #Falta u, placar e repetições from random import randint def criar_tabuleiro(): #Cria a matriz para o jogo for l in range(3): linha = [] for c in range(3): linha.append('🟫') campo.append(linha) def enumerar_colunas(): print(' COLUNA'...
nilq/baby-python
python
# Copyright 2017-2018, Mohammad Haft-Javaherian. (mh973@cornell.edu). # 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...
nilq/baby-python
python
# Adapted from https://github.com/facebookresearch/fvcore/blob/master/fvcore/nn/precise_bn.py # noqa: E501 # Original licence: Copyright (c) 2019 Facebook, Inc under the Apache License 2.0 # noqa: E501 import logging import time import mmcv import torch from mmcv.parallel import MMDistributedDataParallel from mmcv....
nilq/baby-python
python
from flask import Flask, jsonify import RPi.GPIO as GPIO app = Flask(__name__) @app.route('/off/<int:pin>') def getOff(pin): GPIO.setmode(GPIO.BCM) GPIO.setup(pin, GPIO.OUT) state = GPIO.input(pin) GPIO.output(pin,GPIO.HIGH) return jsonify({'status':'LOW', 'pin_no':pin}) @app.route('/on/<int:pin>...
nilq/baby-python
python
#!/usr/bin/env python3 # -*-encoding: utf-8-*- # author: Valentyn Kofanov from kivy.lang import Builder from kivy.uix.screenmanager import Screen from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.recycleview import RecycleView Builder.load_file("style.kv") CHATS = ["Alex", "M...
nilq/baby-python
python
from data_exploration import explore_over_time, frame_count, generate_summary_plot from file_contents_gen import get_batches_multi_dir, multi_dir_data_gen import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers.core import Activation, Flatten, Dense, Lambda, Dropout # from tf.keras.laye...
nilq/baby-python
python
def print_title(): print('---------------------------') print(' HELLO WORLD') print('---------------------------') print() def main(): print_title() name_input = input('What is your name? ') print('Hello ' + name_input) if __name__ == '__main__': main()
nilq/baby-python
python
#!/usr/bin/python3 """ Module for the function to_json_string(my_obj) that returns the JSON representation of an object (string). """ import json def to_json_string(my_obj): """ Function that returns the JSON representation of an object. Args: my_obj (str): Surce object Returns: JSON...
nilq/baby-python
python
from rest_framework import status from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from apps.evaluation.serializers.monthlyMeliaEvaluationSerliazer import MonthlyMeliaEvaluationSerliazer from apps.hote...
nilq/baby-python
python
from json import loads from fastapi.testclient import TestClient from os.path import abspath, dirname, join from main import app class TestTopicsCRUDAsync: def test_bearer_token(self): client = TestClient(app) # Please create new user with the "credentials.json" info with open(join(dirname...
nilq/baby-python
python
from RecSearch.DataWorkers.Abstract import DataWorkers from RecSearch.ExperimentSupport.ExperimentData import ExperimentData import pandas as pd class Metrics(DataWorkers): """ Metric class adds metric data. """ # Configs inline with [[NAME]] @classmethod def set_config(cls): additiona...
nilq/baby-python
python
#!/usr/bin/env python # coding: utf-8 import logging import os import glob import pickle import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from apiclient.http import MediaFileUpload DIRECTORY = '/upload'...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Copyright (c) 2012 Wu Tangsheng(lanbaba) <wuts73@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the r...
nilq/baby-python
python
import os import midinormalizer from mido import MidiFile, MetaMessage from MusicRoll import * def iter_midis_in_path(folder_path): for root, dirs, files in os.walk(folder_path): for file in files: if file.endswith(".mid") or file.endswith(".MID"): yield (os.path.join(root, file), file) def perform(path): ...
nilq/baby-python
python
from ekstep_data_pipelines.audio_transcription.transcription_sanitizers import ( BaseTranscriptionSanitizer, ) from ekstep_data_pipelines.common.utils import get_logger LOGGER = get_logger("GujratiTranscriptionSanitizer") class GujratiSanitizer(BaseTranscriptionSanitizer): @staticmethod def get_instance(...
nilq/baby-python
python
from nose.plugins.attrib import attr from gilda import ground from indra.sources import hypothesis from indra.sources import trips from indra.statements import * from indra.sources.hypothesis.processor import HypothesisProcessor, \ parse_context_entry, parse_grounding_entry, get_text_refs from indra.sources.hypothe...
nilq/baby-python
python
from __future__ import absolute_import, print_function, unicode_literals from xml.dom.minidom import parseString from jinja2 import Template from .forward_parameter import ForwardParametersAction from .interface import Action from .multi_action import MultiAction _SYNC_DESCRIPTION_TEMPLATE = Template(""" <hudson...
nilq/baby-python
python
# -*- coding: UTF-8 -*- from __future__ import unicode_literals import attr from string import Formatter from ._core import Enum class EmojiSize(Enum): """Used to specify the size of a sent emoji""" LARGE = "369239383222810" MEDIUM = "369239343222814" SMALL = "369239263222822" class MessageReactio...
nilq/baby-python
python
from distutils.core import setup from setuptools import setup setup( name='pyflask', version='1.0', author='liuwill', author_email='liuwill@live.com', url='http://www.liuwill.com', install_requires=[ 'flask>=0.12.1', 'Flask-SocketIO>=2.8.6', 'Flask-Cors>=3.0.2', ...
nilq/baby-python
python
import torch import torch.nn as nn class DEM(nn.Module): def __init__(self, channel): """ Detail Emphasis Module """ super(DEM, self).__init__() self.conv1 = nn.Sequential(nn.ReflectionPad2d(1), nn.Conv2d(channel, channel, kernel_size=3, ...
nilq/baby-python
python
# encoding: utf-8 """ test.py """ import sys def data_from_body(body): if sys.version_info[0] < 3: return ''.join(chr(_) for _ in body) # python3 return bytes(body)
nilq/baby-python
python
def spring_summer(): #봄, 여름 함수 global soils global trees dead_trees = [[[] for _ in range(N)] for _ in range(N)] for i in range(N): for j in range(N): trees[i][j].sort() for idx in range(len((trees[i][j]))): if soils[i][j]>= trees[i][j][idx]: ...
nilq/baby-python
python
# -*- coding: utf-8 -*- from __future__ import division, print_function # coding=utf-8 import sys import os import glob import re import numpy as np import pandas as pd import cv2 import tensorflow as tf # Flask utils from flask import Flask, redirect, url_for, request, render_template from werkzeug.ut...
nilq/baby-python
python
from __future__ import print_function import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import math ## PyTorch implementation of CDCK2, CDCK5, CDCK6, speaker classifier models # CDCK2: base model from the paper 'Representation Learning with Contra...
nilq/baby-python
python
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer from sqlalchemy.orm import sessionmaker engine = create_engine("sqlite:///tmp.db") Base = declarative_base() class Signature(Base): __tablename__ = "signature" X = Column(Intege...
nilq/baby-python
python
#!/usr/bin/python3 from lib.utility.SystemUtility import * from lib.utility.SessionUtility import * from lib.utility.DocumentUtility import * from lib.utility.CustomJSONEncoder import *
nilq/baby-python
python
import asyncio import aiohttp from asynctest import TestCase from asynctest.mock import CoroutineMock from asgard.backends.chronos.impl import ChronosScheduledJobsBackend from asgard.clients.chronos import ChronosClient from asgard.conf import settings from asgard.http.client import http_client from asgard.models.acc...
nilq/baby-python
python
#!/usr/bin/env python import logging import os import string import sys import yaml from glob import iglob import django from foia_hub.models import Agency, Office, Stats, ReadingRoomUrls django.setup() logger = logging.getLogger(__name__) def check_urls(agency_url, row, field): # Because only some rows have ...
nilq/baby-python
python
import logging from re import search from flask import Blueprint from flask_restful import Api from com_cheese_api.cmm.hom.home import Home from com_cheese_api.usr.user.resource.user import User, Users from com_cheese_api.usr.user.resource.login import Login from com_cheese_api.usr.user.resource.signup import SignUp ...
nilq/baby-python
python
from unicon.plugins.iosxe import IosXEServiceList, IosXESingleRpConnection from .settings import IosXEIec3400Settings from . import service_implementation as svc from .statemachine import IosXEIec3400SingleRpStateMachine class IosXEIec3400ServiceList(IosXEServiceList): def __init__(self): super().__init...
nilq/baby-python
python
from typing import Any, Iterable, Optional, TypeVar from reactivex import Observable, abc from reactivex.disposable import ( CompositeDisposable, Disposable, SerialDisposable, SingleAssignmentDisposable, ) from reactivex.scheduler import CurrentThreadScheduler _T = TypeVar("_T") def catch_with_itera...
nilq/baby-python
python
from __future__ import division import sys, time, csv, h2o import pandas as pd import numpy as np arg = sys.argv print "Running script:", sys.argv[0] arg = sys.argv[1:] print "Arguments passed to script:", arg load_data_fp = arg[0] saving_meanImputed_fp = arg[1] saving_modelImputed_fp = arg[2] saving_means_fp = arg[3]...
nilq/baby-python
python
import hashlib from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QMessageBox from Model.Register import Register from Model.Values import Values from Model.dataUtils import sqlconn class Login_Window(QtWidgets.QMainWindow): def __init__(self, gui, reg): ...
nilq/baby-python
python
#!/bin/envrun import z3 import circ as ci print("z3------") # XOR test case # (A + B)* ~(AB) x = z3.Bool('x') y = z3.Bool('y') expr = z3.And( # 'z' z3.Or(x, y), z3.Not(z3.And(x, y)) ) print(expr) print("internal-------") ix, iy = ci.In(), ci.In() #ox = ci.Out() xor = ci.Circuit.fromRAW( ci.And( ...
nilq/baby-python
python
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import csv import io import logging import os.path as op import re import math import random import string from typing import Dict, List, Opti...
nilq/baby-python
python
from pyrogram import filters from pyrogram.types import Message from megumin import megux, Config from megumin.utils import get_collection from megumin.utils.decorators import input_str LOCK_TYPES = ["audio", "link", "video"] @megux.on_message(filters.command("lock", Config.TRIGGER)) async def lock(c: megux, m: ...
nilq/baby-python
python
import yaml import collections # Ordered loading of dictionary items in yaml files # Taken from: SO link: /questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts def yaml_ordered_load(fp): class OrderedLoader(yaml.Loader): pass def construct_mapping(loader, node): loader.f...
nilq/baby-python
python
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT Unit tests for ly_test_tools._internal.pytest_plugin.terminal_report """ import os import pytest import unittest.mo...
nilq/baby-python
python
import platform from datetime import datetime from typing import Optional import discord from discord.ext import commands class Stats(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): print(f"{self.__class__.__name__} Cog has been l...
nilq/baby-python
python
import urllib.request import sys import chardet from html.parser import HTMLParser from datetime import datetime pikabuUrl = 'http://pikabu.ru/top50_comm.php' startTag = 'profile_commented' endTag = 'b-sidebar-sticky' newsTag = 'a' classTag = 'class' headers = [] links = [] class MyHTMLParser(HTMLParser): def __...
nilq/baby-python
python
""" Recipes available to data with tags ['F2', 'IMAGE', 'CAL', 'FLAT'] Default is "makeProcessedFlat". """ recipe_tags = {'F2', 'IMAGE', 'CAL', 'FLAT'} # TODO: This recipe needs serious fixing to be made meaningful to the user. def makeProcessedFlat(p): """ This recipe calls a selection primitive, since K-band...
nilq/baby-python
python
""" Notifications -------------------------------------------- .. NOTE:: Coming soon 🛠 """
nilq/baby-python
python
# Copyright 2021 Massachusetts Institute of Technology # # @file image_gallery.py # @author W. Nicholas Greene # @date 2020-07-02 23:44:46 (Thu) import os import argparse def create_simple_gallery(image_dir, num_per_row=3, output_file="index.html", title="Image Gallery"): """Create a simple gallery with num_per_r...
nilq/baby-python
python
# %% # Imports import torch import torch.nn as nn import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer from torch.utils.data import Dataset, random_split from sklearn.feature_extraction.text import TfidfTransformer from sklearn.model_selection import train_test_split from...
nilq/baby-python
python
""" Ejercicio 02 Escriba un algoritmo, que dado como dato el sueldo de un trabajador, le aplique un aumento del 15% si su salario bruto es inferior a $900.000 COP y 12% en caso contrario. Imprima el nuevo sueldo del trabajador. Entradas Sueldo_Bruto --> Float --> S_B Salidas Sueldo_Neto --> Float --> S_N ...
nilq/baby-python
python
import os import shutil import cv2 import numpy as np import pandas as pd from self_driving_car.augmentation import HorizontalFlipImageDataAugmenter IMAGE_WIDTH, IMAGE_HEIGHT = 64, 64 CROP_TOP, CROP_BOTTOM = 30, 25 class DatasetHandler(object): COLUMNS = ('center', 'left', 'right', 'steering_angle', 'speed...
nilq/baby-python
python
# Copyright (c) 2021, Rutwik Hiwalkar and Contributors # See license.txt # import frappe import unittest class TestQMailScheduleRule(unittest.TestCase): pass
nilq/baby-python
python
#!/usr/bin/python #eval p@20 import sys if __name__ == '__main__': if len(sys.argv) < 2: print 'Usage:[pred]' exit(0) fi = open(sys.argv[1],'r') K = 20 #precision@k P = 0 unum = 943 rank = 0 for line in fi: rank = int(line.strip()) if rank < K: ...
nilq/baby-python
python
# Copyright (c) Facebook, Inc. and its affiliates. import random from typing import Optional, Tuple import torch from torch.nn import functional as F from detectron2.config import CfgNode from detectron2.structures import Instances from densepose.converters.base import IntTupleBox from .densepose_cse_base import De...
nilq/baby-python
python
try: raise KeyboardInterrupt finally: print('Goodbye, world!')
nilq/baby-python
python
from django.db import models class WelcomePage(models.Model): """ Welcome page model """ content = models.CharField(max_length=2000)
nilq/baby-python
python
import uuid import json from textwrap import dedent import hashlib from flask import Flask, jsonify, request from blockchain import Blockchain # Using Flask as API to communicate with Blockchain app = Flask(__name__) # Unique address for node node_identifier = str(uuid.uuid4()).replace("-", "") # instantiate Blockc...
nilq/baby-python
python
from pathlib import Path import numpy as np import pandas as pd import pytest from py_muvr import FeatureSelector from py_muvr.data_structures import ( FeatureEvaluationResults, FeatureRanks, InputDataset, OuterLoopResults, ) ASSETS_DIR = Path(__file__).parent / "assets" @pytest.fixture(scope="sess...
nilq/baby-python
python
from djitellopy import Tello tello=Tello() tello.connect() #tello.takeoff() # #move #tello.move_up(100) #tello.move_forward(50) #tello.rotate_clockwise(90) #tello.move_back(50) #tello.move_up(50) # #tello.land() import cv2 panel=cv2.imread('./DroneBlocks_TT.jpg') cv2.imshow('tello panel', panel) while True: ke...
nilq/baby-python
python
import pytest from lemur.auth.ldap import * # noqa from mock import patch, MagicMock class LdapPrincipalTester(LdapPrincipal): def __init__(self, args): super().__init__(args) self.ldap_server = 'ldap://localhost' def bind_test(self): groups = [('user', {'memberOf': ['CN=Lemur Access...
nilq/baby-python
python
import pyglet from inspect import getargspec from element import Element from processor import Processor from draw import labelsGroup from utils import font class Node(Element, Processor): ''' Node is a main pyno element, in fact it is a function with in/outputs ''' def __init__(self, x, y, batch, c...
nilq/baby-python
python
from . import account from . import balance from . import bigmap from . import block from . import commitment from . import contract from . import cycle from . import delegate from . import head from . import operation from . import protocol from . import quote from . import reward from . import right from . import sof...
nilq/baby-python
python
# Copyright 2019 The Vitess 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 i...
nilq/baby-python
python
# -*- coding: utf-8 -*- # @Author: Amar Prakash Pandey # @Co-Author: Aman Garg # @Date: 25-10-2016 # @Email: amar.om1994@gmail.com # @Github username: @amarlearning # MIT License. You can find a copy of the License # @http://amarlearning.mit-license.org # import library here import pygame import time import random...
nilq/baby-python
python
from django.urls import path from django_admin_sticky_notes.views import StickyNoteView urlpatterns = [ path("", StickyNoteView.as_view()), ]
nilq/baby-python
python
import os import pickle import cv2 if __name__ == '__main__': folder = './rearrangement-train/color/000001-2.pkl' with open(folder, 'rb') as f: tmp = pickle.load(f) for i in range(3): img = tmp[i, 0, ...] cv2.imshow('haha', img) cv2.waitKey(0)
nilq/baby-python
python
def numRescueBoats(people, limit): boats = 0 people.sort() left = 0, right = len(people)-1 while left <= right: if left == right: boats += 1 break current = people[left]+people[right] if current <= limit: left += 1 boats += 1 ...
nilq/baby-python
python
from django.apps import AppConfig from orchestra.core import accounts class ContactsConfig(AppConfig): name = 'orchestra.contrib.contacts' verbose_name = 'Contacts' def ready(self): from .models import Contact accounts.register(Contact, icon='contact_book.png')
nilq/baby-python
python
from ... import UndirectedGraph from unittest import TestCase, main class TestEq(TestCase): def test_eq(self) -> None: edges = { ("a", "b"): 10, ("b", "c"): 20, ("l", "m"): 30 } vertices = { "a": 10, "b": 20, "z": 30 ...
nilq/baby-python
python
from setuptools import setup, Extension, find_packages import os import glob sources = [] sources += glob.glob("src/*.cpp") sources += glob.glob("src/*.pyx") root_dir = os.path.abspath(os.path.dirname(__file__)) ext = Extension("factorizer", sources = sources, language = "c++", extra_compile_args =...
nilq/baby-python
python
import os import datetime try: from PIL import Image, ImageOps except ImportError: import Image import ImageOps from ckeditor import settings as ck_settings from .common import get_media_url def get_available_name(name): """ Returns a filename that's free on the target storage system, and av...
nilq/baby-python
python
# Generated by Django 1.11.23 on 2019-08-19 01:00 from django.conf import settings from django.db import migrations def set_site_domain_based_on_setting(apps, schema_editor): Site = apps.get_model('sites', 'Site') # The site domain is used to build URLs in some places, such as in password # reset emails,...
nilq/baby-python
python
#!/usr/bin/env python import csv import re from rdkit.Chem import AllChem from rdkit import Chem from rdkit import DataStructs compounds = {} def load_compounds(filename): comps = {} bad_count = 0 blank_count = 0 with open(filename) as csv_file: csvr = csv.DictReader(csv_file, delimiter='\t...
nilq/baby-python
python