content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
a,b = [int(x) for x in input().split(' ')] print(str(a+b))
nilq/baby-python
python
# Source: https://stackoverflow.com/questions/9282967/how-to-open-a-file-using-the-open-with-statement def filter(txt, oldfile, newfile): '''\ Read a list of names from a file line by line into an output file. If a line begins with a particular name, insert a string of text after the name before append...
nilq/baby-python
python
""" SLM test for the cortex-to-hippocampus connectivity for individual subfields usage: $ python s16_cortex_testSLM.py LSUB """ import os, sys import h5py import numpy as np from numpy import genfromtxt # definde data directories ddir = '../data/' # data dir cordir = ...
nilq/baby-python
python
import csbuilder from csbuilder.standard import Protocols, Roles, States @csbuilder.protocols class SFTProtocols(Protocols): SFT = 8888 @csbuilder.roles(protocol=SFTProtocols.SFT) class SFTRoles(Roles): SENDER = 0 RECEIVER = 1 @csbuilder.states(SFTProtocols.SFT,SFTRoles.SENDER) class SFTSenderStates(S...
nilq/baby-python
python
from django.core.management.base import BaseCommand from django.db.models import Count from project.pastebin.models import Country class Command(BaseCommand): help = 'countries statistics' def handle(self, *args, **kwargs): countries = Country.objects.annotate( pastes_count=Count('users__...
nilq/baby-python
python
"""Hass cmd.""" def breaking_change(number, cli=False): """Create breaking_change list for HA.""" import json import requests import os from github import Github comp_base = "https://www.home-assistant.io/components/" pull_base = "https://github.com/home-assistant/home-assistant/pull/" ...
nilq/baby-python
python
import logging import boto3 import os import pandas as pd import argparse from datetime import datetime from dataactcore.models.domainModels import DUNS from dataactcore.utils.parentDuns import sam_config_is_valid from dataactcore.utils.duns import load_duns_by_row from dataactvalidator.scripts.loader_utils import cle...
nilq/baby-python
python
from datetime import datetime, timedelta from cymepy.common import DATE_FORMAT import math import os class Solver: def __init__(self, cymepy, settings, logger): self.Settings = settings self._Logger = logger self.cymepy = cymepy self._mStepRes = settings['project']['time_step_min'...
nilq/baby-python
python
from flask import Flask, render_template, request from github_api import GithubUser from pprint import pprint app = Flask('git connect') MATCHED_PROFILES = {} userororg = 'user' ghuser = None @app.route('/') def hello(): return render_template('app/index.html', err='') @app.route('/login', methods=['GET', 'PO...
nilq/baby-python
python
import urllib2 import logging from random import choice, randint from os.path import exists from time import sleep from os import getenv logging.basicConfig( format='[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s', datefmt="%d/%b/%Y %H:%M:%S", level=getenv('LOG_LEVEL', logging.DEBUG) ) logg...
nilq/baby-python
python
""" polarAWB.py Copyright (c) 2022 Sony Group Corporation This software is released under the MIT License. http://opensource.org/licenses/mit-license.php """ import json from pathlib import Path import shutil import numpy as np from myutils.imageutils import MAX_16BIT, my_read_image, my_write_image from myutils.data...
nilq/baby-python
python
# !/usr/bin/env python # -*- coding: utf-8 -*- from collections import OrderedDict, defaultdict from traceback import print_exc import wx from wx import EVT_MENU from .Controls import CheckBox, RadioButton, Row, StaticText class FormDialog(wx.Dialog): def __init__( self, parent, ...
nilq/baby-python
python
''' Integration Test for creating KVM VM with all nodes shutdown and recovered. @author: Quarkonics ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_state as test_state import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.operations.resource_operations as res_...
nilq/baby-python
python
notebook_list = list() first_entry=int(input("Enter your first value in the list: ")) second_entry=int(input("Enter your second value in the list: ")) notebook_list.append(first_entry) notebook_list.append(second_entry) # for i in range(5): # val=(int(input("enter a value "))) # arr.append(val) # print (ar...
nilq/baby-python
python
#!/usr/bin/python #partially based on: http://john.nachtimwald.com/2009/08/15/qtextedit-with-line-numbers/ (MIT license) from __future__ import print_function import sys, os, subprocess from ..share import (Share, Signal, dbg_print, QtCore, QtGui, QtSvg, temp_dir) ##LMY: from highlighter import PythonHighlighter clas...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import yaml import json import requests from copy import deepcopy from lxml import html from dateutil.parser import ParserError, parse # loading external configuration CONFIG = yaml.safe_load(open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'conf...
nilq/baby-python
python
#!/usr/bin/env python3 from putarm_ur3e_moveit_config.srv import GoToObj,GoToObjResponse import sys import copy import rospy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg from math import pi from std_msgs.msg import String from moveit_commander.conversions import pose_to_list import tf import...
nilq/baby-python
python
from os import environ from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs import os import json from flask import Flask, jsonify, request import requests from flask_cors import CORS def fetch_location(): """ gets the geocode data for the searched location, ...
nilq/baby-python
python
def emulate_catchup(replica, ppSeqNo=100): replica.on_catch_up_finished(last_caught_up_3PC=(replica.viewNo, ppSeqNo), master_last_ordered_3PC=replica.last_ordered_3pc) def emulate_select_primaries(replica): replica.primaryName = 'SomeAnotherNode' replica._setup_for_non_mas...
nilq/baby-python
python
""" A tomography library for fusion devices See: https://github.com/ToFuProject/datastock """ # Built-in import os import subprocess from codecs import open # ... setup tools from setuptools import setup, find_packages # ... local script import _updateversion as up # == Getting version ===========================...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Tue Dec 24 20:47:24 2019 @author: elif.ayvali """ import pandas as pd import numpy as np import matplotlib.collections as mc import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.patches import Rectangle def create_uniform_grid(low, high, bins=(1...
nilq/baby-python
python
import sys from je_web_runner import get_desired_capabilities from je_web_runner import get_desired_capabilities_keys from je_web_runner import get_webdriver_manager try: print(get_desired_capabilities_keys()) for keys in get_desired_capabilities_keys(): print(get_desired_capabilities(keys)) dr...
nilq/baby-python
python
# Generated by Django 3.1.8 on 2021-04-07 15:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('unievents', '0014_auto_20210407_1416'), ] operations = [ migrations.RemoveField( model_name='event_tag', name='event...
nilq/baby-python
python
from . import db from flask import current_app from flask_login import UserMixin, AnonymousUserMixin from werkzeug.security import generate_password_hash, check_password_hash from datetime import datetime import hashlib, os import markdown class User(UserMixin, db.Model): __tablename__ = 'user' id = db.Column...
nilq/baby-python
python
import colander from cryptography.fernet import Fernet class EncryptedExportField(colander.String): """ Serialize non-encrypted appstruct into encrypted cstruct. """ def __init__(self, fernet_key, *args, **kwargs): self.fernet_key = fernet_key self.fernet = Fernet(fernet_key) ...
nilq/baby-python
python
import torch import torch.nn as nn from packaging import version from mmcv.cnn import kaiming_init, normal_init from .registry import INPUT_MODULES from .utils import build_norm_layer def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, ...
nilq/baby-python
python
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright © 2010, RedJack, LLC. # All rights reserved. # # Please see the LICENSE.txt file in this distribution for license # details. # ---------------------------------------------------------------------- import unitt...
nilq/baby-python
python
#-*- coding: utf-8 -*- #!/usr/bin/env python from os import path # dirs BASE_DIR = path.dirname(path.realpath(__file__)) + '/' MODULES_DIR = BASE_DIR + 'modules/' AUDIO_DIR = BASE_DIR + 'audio/' # api url (server) SERVER_API_URL = 'http://localhost:3000/' # voice lang LANG = 'en-EN'
nilq/baby-python
python
""" Main entrypoint for starttls-policy CLI tool """ import argparse import os from starttls_policy_cli import configure GENERATORS = { "postfix": configure.PostfixGenerator, } def _argument_parser(): parser = argparse.ArgumentParser( description="Generates MTA configuration file according to STARTTL...
nilq/baby-python
python
import numpy as np class ValueLog(): """Implemements a key/value aggregating dictionary log with optional grouping/precision and custom aggregation modes""" def __init__(self): self.log_values = {} def log(self, key, val, agg="mean", scope="get", group=None, precision=None): ...
nilq/baby-python
python
from time import sleep import threading import datetime import paho.mqtt.client as mqtt #### CONSTANTS #### #MQTTServer="home.bodhiconnolly.com" MQTTServer="192.168.1.100" MQTTPort=1882 waitTime=datetime.timedelta(milliseconds=50) ledTopic="room/lights/strips/" functionTopic="room/function/#" systemTopic="system/fun...
nilq/baby-python
python
import json import string import random import os import httplib2 import requests # Flask Imports from flask import Flask, render_template, request, redirect, url_for, jsonify from flask import abort, g, flash, Response, make_response from flask import session as login_session from flask_httpauth import HTTPBasicAuth ...
nilq/baby-python
python
# BaseOperator.py # # Base class for all machines and human operators. # # Attributes: # name # states: a list of states that this operator can be in, at any time. For example: ["busy", idle"] # start_time: the time at which the behavior starts. # # Member functions: # methods to change state, and print the fra...
nilq/baby-python
python
# coding=utf-8 import os import unittest from parameterized import parameterized from conans.client.conf import default_settings_yml from conans.model.editable_cpp_info import EditableCppInfo from conans.model.settings import Settings def _make_abs(base_path, *args): p = os.path.join(*args) if base_path: ...
nilq/baby-python
python
from dags.spark_common import SparkJobCfg, spark_job, user_defined_macros, EntityPattern from dags.spark_common import dag_schema_path, hadoop_options, LOCAL_INPUT, LOCAL_DATAWAREHOUSE from datetime import timedelta from airflow import DAG args = { 'owner': 'alexey', 'start_date': '2021-06-10' } dag = DAG( ...
nilq/baby-python
python
from .mesh import import_mesh from .curve import import_curve from .brep import import_brep #from .default import import_default
nilq/baby-python
python
#!/usr/bin/python import sdk_common # Block in charge of tagging the release class SDKNewsAndTag(sdk_common.BuildStep): def __init__(self, logger=None): super(SDKNewsAndTag, self).__init__('SDK News & Tag', logger) self.branch_name = self.common_config.get_config().get_branch_name() self.g...
nilq/baby-python
python
from .ast_transformers import InvertGenerator, transformAstWith from .descriptor_magic import \ wrapMethodAndAttachDescriptors, BindingExtensionDescriptor import six import inspect def coroutine(func): def start(*args, **kwargs): g = func(*args, **kwargs) six.next(g) return g retur...
nilq/baby-python
python
import re import xmlsec from lxml import etree def parse_tbk_error_message(raw_message): message_match = re.search(r'<!--(.+?)-->', raw_message) if message_match: message = message_match.group(1).strip() match = re.search(r'(.+?)\((\d+?)\)', message) if match: error = mat...
nilq/baby-python
python
import os import djcelery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'findingaids.settings') os.environ['PYTHON_EGG_CACHE'] = '/tmp' os.environ['VIRTUAL_ENV'] = '/home/httpd/findingaids/env/' djcelery.setup_loader() # from django.core.handlers.wsgi import WSGIHandler # application = WSGIHandler() from django.co...
nilq/baby-python
python
from acme import Product import random ADJECTIVES = ['Awesome', 'Shiny', 'Impressive', 'Portable', 'Improved'] NOUNS = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', '???'] def generate_products(n=30, price_range=(5, 10), weight_range=(5, 100)): """Generate n number of products within a specified price and weigh...
nilq/baby-python
python
import sys, os sys.path.append('/Users/syrus/Proyectos/exercita/website/') sys.path.append('/Users/syrus/Sites/exercita/') os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' TEMPLATE_EXAMPLE = '''<ul> {% for gender in gender_list %} <li>{{ gender.grouper }} <ul> {% for item in gender.list %} ...
nilq/baby-python
python
""" My purpose in life is to take the NWS AWIPS Geodata Zones Shapefile and dump them into the PostGIS database! I was bootstraped like so: python ugcs_update.py z_16mr06 2006 03 16 python ugcs_update.py z_11mr07 2007 03 11 python ugcs_update.py z_31my07 2007 05 31 python ugcs_update.py z_01au07 2007 08 01 python ugc...
nilq/baby-python
python
import requests import logging from lxml import html class HTDownloader(): def __init__(self, htid, res, i): self.htid = htid self.i = i self.res = res def get(self): logging.debug("Download image: {}".format(self.i)) return down_img(self.htid, self.i, self.res) ...
nilq/baby-python
python
import asyncio from contextlib import asynccontextmanager from sys import version_info from typing import AsyncIterator import pytest from aioredis import create_redis_pool from aiohttp_client_cache.backends.redis import DEFAULT_ADDRESS, RedisBackend, RedisCache from aiohttp_client_cache.session import CachedSession ...
nilq/baby-python
python
from django.contrib import admin from .models import Book, Author, Publisher, Loaned # Register your models here. class BookAdmin(admin.ModelAdmin): list_display = ('name', 'date_added') search_fields = ["name"] ordering = ["name"] admin.site.register(Book, BookAdmin) admin.site.register(Author) admin.site.register...
nilq/baby-python
python
from .manage import *
nilq/baby-python
python
#!/usr/bin/env python ## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
nilq/baby-python
python
import blocksci import re import sys chain = blocksci.Blockchain("/home/hturki/bitcoin-blocksci.bak") address_file = open("/home/hturki/stackoverflow_addr_raw.txt", "r").read() addresses = address_file[1:-1].split("', '") len(addresses) blocksci_addresses = {} bad_addresses = set({addresses[10], addresses[18], addre...
nilq/baby-python
python
#!/usr/bin/env python ''' We get the lidar point cloud and use it to determine if there are any obstacles ahead Author: Sleiman Safaoui Email: snsafaoui@gmail.com Github: The-SS Date: Oct 3, 2018 ''' # python from __future__ import print_function import numpy as np import copy import math from numpy import pi # RO...
nilq/baby-python
python
from rdflib import Literal from .namespaces import BRICK, TAG, OWL parameter_definitions = { "Parameter": { "tags": [TAG.Point, TAG.Parameter], "subclasses": { "Delay_Parameter": { "tags": [TAG.Point, TAG.Delay, TAG.Parameter], "subclasses": { ...
nilq/baby-python
python
input = """ male(john). republican(john). male(matt). republican(matt). female(joana). republican(joana). female(luise). democrat(luise). moreMaleRepublicans :- #count{X:republican(X), female(X)} < N, #count{Y: republican(Y), male(Y)} = N. """ output = """ male(john). republican(john). ...
nilq/baby-python
python
from auto_yolo import envs from yolo_air_stage1 import durations, distributions, config readme = "Running simple on addition task." envs.run_experiment( "addition-stage1", config, readme, alg="simple", task="arithmetic2", durations=durations, distributions=distributions )
nilq/baby-python
python
from singledispatch import singledispatch from sqlalchemy import types from sqlalchemy.dialects import postgresql from sqlalchemy.orm import interfaces from graphene import (ID, Boolean, Dynamic, Enum, Field, Float, Int, List, String) from graphene.types.json import JSONString try: from sqla...
nilq/baby-python
python
#!/usr/bin/python # TrayIcon # Access to various monitoring capabilities (HIDS, dashboard, ip configuration, network recognition, etc.) # Alerting plugin (IM notifications, irssi, OSSEC) that can help to display and monitor notification informations) # Deamon plugin (sort of tail -f over selected files, RSS gathering...
nilq/baby-python
python
""" Pipeline object class for EmrActivity """ from .activity import Activity from ..config import Config from .schedule import Schedule from ..utils import constants as const from ..utils.exceptions import ETLInputError config = Config() MAX_RETRIES = config.etl.get('MAX_RETRIES', const.ZERO) class EmrActivity(Acti...
nilq/baby-python
python
from django.test import TestCase from . models import Urls, Statistics class UrlsTestClass(TestCase): ''' Class that test the characterics of the Urls objects and its methods ''' def setUp(self): ''' Method that runs at the beginning of each test ''' self.url = Urls(shor...
nilq/baby-python
python
import ipdb import numpy as np import os from multiprocessing import Process, Queue, Lock from moviepy.video.io.VideoFileClip import VideoFileClip as Video import skvideo.measure as skv from glob import glob import csv from tqdm import tqdm def job(item): fn, indir, outdir = item outdir = os.path.splitext(fn....
nilq/baby-python
python
from biocrnpyler import * kb, ku, ktx, ktl, kdeg = 100, 10, 3, 2, 1 parameters = {"kb": kb, "ku": ku, "ktx": ktx, "ktl": ktl, "kdeg": kdeg} myMixture = BasicExtract(name="txtl", parameters=parameters) A1 = DNAassembly(name="G1", promoter="pBest", rbs="BCD2", transcript="T1", protein="GFP", initial_co...
nilq/baby-python
python
from django.db import models from django.conf import settings from django import forms # Create your models here. class Dataset(models.Model): name = models.CharField(max_length=200, null=True, blank=True) owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) columns = models.Intege...
nilq/baby-python
python
""" OpenVINO DL Workbench Class for annotate dataset job Copyright (c) 2021 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ...
nilq/baby-python
python
from bs4 import BeautifulSoup from contextlib import suppress RUN_EXAMPLE = 2 class Match: """ This class stores information about a class """ def __init__(self, team1: str, team2: str, state, _, score1: int, score2: int): self.team1 = self._sanitize(team1) self.team2 = se...
nilq/baby-python
python
from django.apps import AppConfig class AwewardsConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'awewards'
nilq/baby-python
python
from setuptools import setup, find_packages with open("requirements.txt") as f: requirements = f.readlines() long_description = "Automated tool to provision Greengrass 2.0" setup( name="ggv2_provisioner", version="0.0.8", author="Gavin Adams", author_email="gavinaws@amazon.com", url="https://...
nilq/baby-python
python
''' Load the CIOD module tables from DICOM Standard PS3.3, Annex A. All CIOD tables are defined in chapter A of the DICOM Standard. Output the tables in JSON format, one entry per CIOD. ''' from typing import List, Tuple import sys import re from bs4 import Tag from dicom_standard import parse_lib as pl from dicom_st...
nilq/baby-python
python
import requests import json import yaml def checkDomains(domains): url = 'https://www.virustotal.com/vtapi/v2/url/report' scans = [] for dom in domains: params = {'apikey':getApiKey('vt'), 'resource':dom} try: response = requests.get(url, params=params) scans.append...
nilq/baby-python
python
from torchvision import models import torch.nn as nn class model(nn.Module): def __init__(self, input_dim, output_dim): super(model, self).__init__() self.restored = False self.input_dim = input_dim self.output_dim = output_dim num = len(input_dim) feature = [] for i in range(num): feature.append( ...
nilq/baby-python
python
INSTRUCTIONS = """ """ from utils.decorators import time_this @time_this def solution(inputs): """ """ test_case_inputs = [ ]
nilq/baby-python
python
class SilkObject: __slots__ = [] def __ne__(self, other): return not self.__eq__(other) class SilkStringLike(SilkObject): __slots__ = [] from . import primitives
nilq/baby-python
python
from .transpose import transpose
nilq/baby-python
python
from functools import partial from flask import Blueprint, current_app, g from api.client import SecurityTrailsClient, ST_OBSERVABLE_TYPES from api.mappings import Mapping from api.schemas import ObservableSchema from api.utils import get_json, jsonify_data, get_key, jsonify_result enrich_api = Blueprint('enrich', _...
nilq/baby-python
python
from sqlite3 import dbapi2 as sqlite3 from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash, _app_ctx_stack import requests, os from bs4 import BeautifulSoup # configuration try: DATABASE = 'simply-billboard.db' DEBUG = True SECRET_KEY = 'development key' USERNAME = ...
nilq/baby-python
python
#!/usr/bin/env python # Copyright 2015 Dmitriy Robota. # # 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
from settings import * class BonusBox: def __init__(self, data, gui): self.boxID = int(data["boxID"]) self.x = int(data["x"]) self.y = int(data["y"]) self.type = int(data["type"]) self.size = 2 self.gui = gui if self.type == 1: # cargo ...
nilq/baby-python
python
# Copyright (c) 2016, Ethan White # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and...
nilq/baby-python
python
from validator.rule_pipe_validator import RulePipeValidator as RPV from validator import rules as R from validator import Validator, validate, validate_many, rules as R def test_rpv_001_simple(): data = "10" # with integer rules = [R.Integer(), R.Size(10)] rpv = RPV(data, rules) assert rpv.execut...
nilq/baby-python
python
import os import random class Hangman(): def __init__(self): self.word = self.pick_random_word() self.word = self.word.upper() self.hidden_word = ["-" for character in self.word] self.word_length = len(self.word) self.used_letters = [] self.running = True ...
nilq/baby-python
python
def test_add_pet(client, jwt): r = client.post( "/pets", json=dict( pet_type="cat", name="tospik", breed="persian", owner="emreisikligil" ), headers=dict(Authorization=f"Bearer {jwt}") ) assert r.status_code == 201 body = r....
nilq/baby-python
python
import asyncio import youtube_dl import urllib.request import datetime from bot_client import * global queue queue = [] global nowPlaying nowPlaying = [] global ytdl_opts ytdl_opts = { 'format': 'bestaudio/best', #'ignoreerrors': True, #'no_warnings': True, #'debug_pr...
nilq/baby-python
python
# --- import -------------------------------------------------------------------------------------- import os import numpy as np import WrightTools as wt from . import _pulse from ._scan import Scan # --- define -------------------------------------------------------------------------------------- here = os.pa...
nilq/baby-python
python
import torch from torch import nn from torch.nn import functional as F from typing import List from resnet_layer import ResidualLayer class ConvDecoder(nn.Module): def __init__(self, in_channels: int, embedding_dim: int, hidden_dims: List = [128, 256], ...
nilq/baby-python
python
from dassl.engine import TRAINER_REGISTRY from dassl.engine.trainer import TrainerMultiAdaptation from dassl.data import DataManager from dassl.utils import MetricMeter from torch.utils.data import Dataset as TorchDataset from dassl.optim import build_optimizer, build_lr_scheduler from dassl.utils import count_num_para...
nilq/baby-python
python
''' A data model focused on material objects. ''' import synapse.lib.module as s_module class MatModule(s_module.CoreModule): def getModelDefs(self): modl = { 'types': ( ('mat:item', ('guid', {}), {'doc': 'A GUID assigned to a material object.'}), ('mat:spec', (...
nilq/baby-python
python
from .test_utils import * print('#############################################') print('# TESTING OF MainDeviceVars MODEL FUNCTIONS #') print('#############################################') @tag('maindevicevars') class MainDeviceVarsModelTests(TestCase): def setUp(self): from utils.BBDD import...
nilq/baby-python
python
from flask import request from .argument import ListArgument class QueryStringParser: """ A class to parse the query string arguments""" @staticmethod def parse_args(qs_args_def): """ Parse the query string """ qs_args_dict = QueryStringParser.args_def_to_args_dict(qs_args_def) ...
nilq/baby-python
python
from machine import Pin, Timer import utime SOUND_SPEED = 0.0343 # in second CM_TO_INCH = 0.393701 CM_TO_FEET = 0.0328084 trigger = Pin(16, Pin.OUT) echo = Pin(17, Pin.IN) def get_distance(timer): trigger.high() utime.sleep(0.0001) trigger.low() start = 0 stop = 0 while echo.value()...
nilq/baby-python
python
# Copyright (c) 2019 Microsoft Corporation # Distributed under the MIT software license from ..postprocessing import multiclass_postprocess import numpy as np def test_multiclass_postprocess_smoke(): n = 1000 d = 2 k = 3 b = 10 X_binned = np.random.randint(b, size=(d, n)) feature_graphs = []...
nilq/baby-python
python
import requests import base64 from datetime import datetime from datetime import timedelta from collections import UserString class RefreshingToken(UserString): def __init__(self, token_url, client_id, client_secret, initial_access_token, initial_token_expiry, refresh_token, expiry_offset=60, p...
nilq/baby-python
python
#FLM: AT Font Info: Andres Torresi #configurar nombreFamilia='Tagoni' nombreDisenador='Andres Torresi' emailDisenador='andres@huertatipografica.com.ar' urlDisenador='http://www.andrestorresi.com.ar' urlDistribuidor='http://www.huertatipografica.com.ar' year='2012' ## from robofab.world import CurrentFont # all the ...
nilq/baby-python
python
#import sys import select, queue from .pool import Pool from .io import open_listenfd, sys def main(*args, **kwargs): """ @params: init project """ if len(sys.argv) != 2: print("Usage: %s ports", sys.argv[0]) sys.exit(1) assert len(sys.argv) != 2 port = sys.argv[1] #type: in...
nilq/baby-python
python
# -*- coding:utf-8 -*- # coding=<utf8> from django.db import models # Модели для логирования действий пользователей с активами class Logging(models.Model): user = models.CharField(max_length=140) request = models.TextField(blank = True, null = True) goal = models.TextField(blank = True, null = True) d...
nilq/baby-python
python
#%% [markdown] # # Basic of Beamforming and Source Localization with Steered response Power # ## Motivation # Beamforming is a technique to spatially filter out desired signal and surpress noise. This is applied in many different domains, like for example radar, mobile radio, hearing aids, speech enabled IoT devices. #...
nilq/baby-python
python
import os import shutil import click from datetime import datetime, timedelta from flask import current_app as app from sqlalchemy.sql.expression import false from alexandria.settings.extensions import db __author__ = 'oclay' @click.command() @click.option('--username', prompt=True, help='The username for the admin...
nilq/baby-python
python
#!/usr/bin/python from singularity.package import calculate_similarity from singularity.utils import check_install import pickle import sys import os pkg1 = sys.argv[1] pkg2 = sys.argv[2] output_file = sys.argv[3] # Check for Singularity installation if check_install() != True: print("You must have Singularity i...
nilq/baby-python
python
#!/usr/bin/env python """odeint.py: Demonstrate solving an ordinary differential equation by using odeint. References: * Solving Ordinary Differential Equations (ODEs) using Python """ from scipy.integrate import odeint import numpy as np import matplotlib.pyplot as plt # pylint: disable=invalid-name # Solve y''(t...
nilq/baby-python
python
print('-='*20) print('Analisador de Triângulos') print('-='*20) r1 = float(input('Primeiro Segmento: ')) r2 = float(input('Segundo Segmento: ')) r3 = float(input('Terceiro Segmento: ')) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print('Os segmentos acima PODEM formar um triângulo.') else: print('Os segm...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This command generates cs_pb2.py and cs_pb2_grpc.py files from cs.proto. These files are necessary for the execution of gRPC client and gRPC control server. """ from subprocess import call call("python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. cloud...
nilq/baby-python
python
from .account import GroupSerializer, UserSerializer from .resource import ResourceSerializer __all__ = ["UserSerializer", "GroupSerializer", "ResourceSerializer"]
nilq/baby-python
python
#!/usr/bin/python3.7 # Copyright 2020 Aragubas # # 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...
nilq/baby-python
python
import sys sentence = '' with open(sys.argv[1],'r') as file: for i in file: data = i.split() if (len(data) != 0): if(data[-1] =='E'): sentence += data[0]+" " else: sentence += data[0] ...
nilq/baby-python
python