content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# Copyright (c) 2013 Riccardo Lucchese, riccardo.lucchese at gmail.com
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any p... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Wrapper for running Oncotator
"""
from snakemake.shell import shell
__author__ = "Manuel Holtgrewe"
__email__ = "manuel.holtgrewe@bihealth.de"
shell(
r"""
# -----------------------------------------------------------------------------
# Redirect stderr to log file by default and enable... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module to resolve the current platform and bitness that works across
infrastructure systems.
"""
import itertools
import platf... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module: plot_model
-------------------
Contains the main driver function and some helper functions.
F. G. Ramon-Fox 2021
Last revision: May 2021
"""
import numpy as np
import iofunctions as io
import visualization as vis
from units import Units
from galrotcurve ... | nilq/baby-python | python |
def sieve_of_atkin(limit: int) -> None:
"""
2 and 3 are known to be prime
"""
if limit > 2:
print(2, end=" ")
if limit > 3:
print(3, end=" ")
# Initialise the sieve array with False values
sieve: list[bool] = [False] * (limit + 1)
for i in range(0, limit + 1):
si... | nilq/baby-python | python |
import cv2 as cv
import numpy as np
import glob
from tqdm import tqdm
import matplotlib.pyplot as plt
from math import degrees as dg
def cv_show(img,name='Figure'):
cv.namedWindow(name,cv.WINDOW_AUTOSIZE)
cv.imshow(name,img)
cv.waitKey(0)
cv.destroyAllWindows()
Path1 = 'F:\PyCharm\Camera_calibratio... | nilq/baby-python | python |
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * File:
# * engine.py
# *
# * Library:
# * ebpf_ic/
# *
# * Author:
# * Lucas Duarte (lucas.f.duarte@ufv.br)
# *
# * Description:
# * Conversion and translation methods
# *
from Instruction import *
from data import *
from ... | nilq/baby-python | python |
import os
import shutil
import hashlib
from django.contrib.auth.models import User
from django.core import mail
from django.urls import reverse
from django.test import TestCase
from django.conf import settings
from tagging.utils import edit_string_for_tags
from djangopeople.djangopeople.models import DjangoPerson, C... | nilq/baby-python | python |
import unittest
from smart_energy_api import solaredge_api as s
class SolaredgeApiSideEffects(unittest.TestCase):
def test_solaredgemeters_meterdata(self):
d = s.solaredgemeters.meterdata()
print(d)
self.assertIsInstance(d, dict)
def test_siteenergy_energydata(self):
d = s.si... | nilq/baby-python | python |
from django.utils.translation import ugettext_lazy as _
from fluent_pages.integration.fluent_contents.models import FluentContentsPage
from parler.models import TranslatableModel
from parler.utils.context import switch_language
from fluent_blogs.models import get_entry_model
class BlogPage(FluentContentsPage):
... | nilq/baby-python | python |
from math import prod
from typing import List
from digits import champernowne_digit
def p40(positions: List[int]) -> int:
return prod(champernowne_digit(n) for n in positions)
if __name__ == '__main__':
print(p40([1, 10, 100, 1000, 10000, 100000, 1000000]))
| nilq/baby-python | python |
#!/usr/bin/env python
import logging
from typing import Union
from expiringdict import ExpiringDict
from .cognito import CognitoUserPassAuth, CognitoBase, CognitoTokenAuth
from .entities import User, JWTToken, JWTPublicKeyRing
from . import __appname__
__author__ = "Giuseppe Chiesa"
__copyright__ = "Copyright 2017, ... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 12 16:11:08 2019
Analyze performance of multi sensor localization algorithms
@author: anantgupta
"""
import numpy as np
import matplotlib.pyplot as plt
import multiprocessing as mp
import pickle
# from IPython import get_ipython
from functools import... | nilq/baby-python | python |
a = "hello"
print(a[1])
# this gets the character at the 1st position
| nilq/baby-python | python |
# Generated by Django 2.2.17 on 2021-04-15 15:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('autoemails', '0015_auto_20210405_1920'),
('consents', '0003_term_help_text'),
]
operations = [
migrations.AddField(
mod... | nilq/baby-python | python |
# coding: utf-8
import numpy as np
import cPickle
import utils
import h5py
import os
def convert_files(file_paths, vocabulary, punctuations, output_path):
inputs = []
outputs = []
punctuation = " "
for file_path in file_paths:
with open(file_path, 'r') as corpus:
for line in c... | nilq/baby-python | python |
from __future__ import division
from ev3.lego import ColorSensor
from time import time, sleep
tick = 0.05
color = ColorSensor()
def median(lst):
lst = sorted(lst)
if len(lst) < 1:
return None
if len(lst) %2 == 1:
return lst[((len(lst)+1)//2)-1]
if len(lst) %2 == 0:
... | nilq/baby-python | python |
# SPDX-FileCopyrightText: 2009 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# This module implements the basic functions needed
# to interface to rrdtool
#
# Author:
# Igor Sfiligoi
#
import shlex
import string
import subproces... | nilq/baby-python | python |
# Write a program that outputs whether today is a weekday or a weekend.
import datetime
x = datetime.datetime.now()
y = x.weekday()
z = str(input('Ask me a tricky question, like "Weekday or weekend?"'))
question = ("Weekday or weekend?")
while z == question:
if y <= 3: ... | nilq/baby-python | python |
#! /usr/bin/env python3
"""
unittest for hello solution
"""
__author__ = "Ram Basnet"
__copyright__ = "Copyright 2020"
__license__ = "MIT"
import unittest
from hello import answer
class TestHello(unittest.TestCase):
def test1_answer(self):
self.assertEqual(answer(), 'Hello World!', "Test failed...")
i... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Collection of tests for :mod:`orion.core.worker.consumer`."""
import logging
import os
import signal
import subprocess
import tempfile
import time
import pytest
import orion.core.io.experiment_builder as experiment_builder
import orion.core.io.resolve_config as resolve... | nilq/baby-python | python |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | nilq/baby-python | python |
import time
from os import environ
import grpc
import lnd_grpc.protos.rpc_pb2 as ln
import lnd_grpc.protos.rpc_pb2_grpc as lnrpc
from lnd_grpc.base_client import BaseClient
from lnd_grpc.config import defaultNetwork, defaultRPCHost, defaultRPCPort
# tell gRPC which cypher suite to use
environ["GRPC_SSL_CIPHER_SUITES... | nilq/baby-python | python |
# Generated by Django 2.1.7 on 2019-05-15 13:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("ecommerce", "0010_remove_ecommerce_course_run_enrollment"),
("courses", "0007_add_enrollment_models"),
]
op... | nilq/baby-python | python |
from django.test import TestCase
from django.urls import reverse
from books.models import Book, Genre
class GenresListViewTest(TestCase):
def test_uses_genres_list_template(self):
response = self.client.get(reverse('books:genres-list'))
self.assertTemplateUsed(response, "books/genres_list.html")... | nilq/baby-python | python |
# coding : utf-8
class Route:
def __init__(self, bp, prefix):
self.bp = bp
self.prefix = prefix
| nilq/baby-python | python |
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from altfe.interface.root import interRoot
from app.lib.core.dl.model.dler_aria2 import Aria2Dler
from app.lib.core.dl.model.dler_dl import DlDler
from app.lib.core.dl.model.dler_dl_single import DlSingleDler
@interRoot.bind("dl", "LIB_CORE")
... | nilq/baby-python | python |
from yowsup.layers.protocol_ib.protocolentities.ib import IbProtocolEntity
from yowsup.structs import ProtocolTreeNode
from yowsup.structs.protocolentity import ProtocolEntityTest
import unittest
class IbProtocolEntityTest(ProtocolEntityTest, unittest.TestCase):
def setUp(self):
self.ProtocolEntity = IbPro... | nilq/baby-python | python |
from .general import *
from .run import *
from .project import *
| nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 03:47:45 2020
@author: Maryam
"""
import numpy as np
import argparse
import pickle
import time
from scipy.sparse.linalg import svds
from utils.read_preprocss_data import read_preprocss_data
parser = argparse.ArgumentParser()
# Set Path
parse... | nilq/baby-python | python |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
import smcat.common
def serializeDateTime(dt):
return smcat.common.datetimeToJsonStr(dt)
class DocumentItem(scrapy.Item):
"""
Attributes:
id: A unique id... | nilq/baby-python | python |
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#! \file ~/doit_doc_template/templates/base/library/type_page.py
#! \author Jiří Kučera, <sanczes AT gmail.com>
#! \stamp 2019-07-04 09:41:22 +0200
#! \project DoIt! Doc: Sphinx Extension for DoIt! Documentation
#! \license MIT
#! \ve... | nilq/baby-python | python |
import sys
from .commands import main
sys.exit(main())
| nilq/baby-python | python |
import logging
from hearthstone.battlebots.priority_storage_bot import priority_st_ad_tr_bot
from hearthstone.battlebots.random_bot import RandomBot
from hearthstone.host import RoundRobinHost
def main():
logging.basicConfig(level=logging.DEBUG)
host = RoundRobinHost({"random_action_bot":RandomBot(2),
... | nilq/baby-python | python |
BUMP_LIMIT = 20
THREAD_LIMIT = 5
SQL_CONST_OP = 0
MAX_FILE_SIZE = 1 << 21 # 2 MB
MAX_OP_IMG_WH = 250
MAX_IMG_WH = 150
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif', 'tiff', 'bmp'])
MAX_POST_LEN = 5000
class FlaskRestConf(object):
RESTFUL_JSON = {'default': str}
| nilq/baby-python | python |
#!/usr/bin/env python
import glob
import os
import shlex
import sys
import platform
script_dir = os.path.dirname(__file__)
jc3_handling_editor_root = os.path.normpath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.abspath(os.path.join(jc3_handling_editor_root, 'tools')))
sys.path.insert(0, os.path.j... | nilq/baby-python | python |
from DownloadData import DownloadData, UnzipData
DownloadData()
UnzipData()
| nilq/baby-python | python |
import argparse
from getpass import getpass
from classes.Application import Application
if __name__ == "__main__":
CONFIG_PATH = "./config/config.yaml"
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='function')
# Create accounts parser
parser_create_accounts = subpar... | nilq/baby-python | python |
from django.db import models
from django.contrib.auth.models import User
import uuid
# Question user
class Quser(models.Model):
id= models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
email = models.EmailField(unique=... | nilq/baby-python | python |
## @file
## @brief metacircular implementation in metaL/py
## @defgroup circ Metacircular
## @brief `implementation in metaL/py`
## @{
from metaL import *
## `<module:metaL>` reimplements itself using host VM metainfo
MODULE = vm['MODULE']
## `~/metaL/$MODULE` target directory for code generation
diroot = Dir(MODUL... | nilq/baby-python | python |
# coding=utf-8
"""Provides utilities for serialization/deserialization of
Tempo data types.
"""
from six import string_types
from rest_framework import serializers
from tempo.recurrenteventset import RecurrentEventSet
# pylint: disable=no-init,no-self-use,no-member
class RecurrentEventSetField(serializers.Field):
... | nilq/baby-python | python |
# -*- encoding: utf-8 -*-
#
# Copyright © 2018–2021 Mergify SAS
#
# 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 appl... | nilq/baby-python | python |
import GPyOpt
import chaospy
import matplotlib
import math
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
np.set_printoptions(linewidth=200, precision=4)
def equation(x, selection_index):
target_region = {'x': (0, 1), 'y': (0, 1)}
def function(selection_index, h=1): #1 is just a dummy... | nilq/baby-python | python |
"""Used to plan actions by comparing what is live and what is defined locally.
.. note:: Currently only supported for `AWS CDK`_, `CloudFormation`_,
`Terraform`_, and `Troposphere`_.
When run, the environment is determined from the current git branch
unless ``ignore_git_branch: true`` is specified in the
:r... | nilq/baby-python | python |
import logging
import subprocess
import mlflow
import mlflow.deployments.cli
import pandas as pd
import requests
from mlflow.models.signature import infer_signature
from sklearn.metrics import accuracy_score, precision_score, recall_score, roc_auc_score
from sklearn.pipeline import Pipeline
from dataset import Datase... | nilq/baby-python | python |
'''LC1460: Make Two Arrays Equal by Reversing Sub-arrays
https://leetcode.com/problems/make-two-arrays-equal-by-reversing-sub-arrays/
Given two integer arrays of equal length target and arr.
In one step, you can select any non-empty sub-array
of arr and reverse it. You are allowed to make any
number of steps.
Return T... | nilq/baby-python | python |
import os
import ctypes
import numpy as np
import copy
from envs import make_env
from envs.utils import goal_distance
from policy.replay_buffer import goal_concat
def c_double(value):
return ctypes.c_double(value)
def c_int(value):
return ctypes.c_int(value)
def gcc_complie(c_path, so_path=None):
assert c_path... | nilq/baby-python | python |
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import password_validation
from django.utils.translation import ugettext_lazy as _
from django import forms
from .models import Profile, User
class LoginForm(AuthenticationForm):
username = forms.CharField(label="Username", max_len... | nilq/baby-python | python |
import difflib
import os.path
import subprocess
import sys
from testconfig import config
from functools import partial
from six import print_, iteritems
tests_dir = partial(os.path.join, config['dirs']['tests'])
forth_dir = partial(os.path.join, config['dirs']['forth'])
logs_dir = partial(os.path.join, config['dirs'... | nilq/baby-python | python |
import os
import urllib.parse
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig:
"""Base configuration"""
APP_NAME = 'Sunway Innovators'
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.environ.get('SECRET_KEY')
UPLOAD_FOLDER = 'uplo... | nilq/baby-python | python |
"""Tests for soft actor critic."""
from absl.testing import absltest
import acme
from acme import specs
from acme.testing import fakes
from acme.utils import loggers
from magi.agents import sac
class SACTest(absltest.TestCase):
def test_sac(self):
# Create a fake environment to test with.
environ... | nilq/baby-python | python |
from abc import ABCMeta, abstractclassmethod
import numpy as np
from keras.layers import Input, Lambda
from keras.models import Model
from model.Autoencoder import Autoencoder
from model.loss.kullbackLeiberLoss import kullbackLeiberLossConstructor
from model.loss.variationalAutoencoderLoss import variationalAutoencod... | nilq/baby-python | python |
import os
from utils import *
DATADIVR_PATH = os.path.realpath(os.path.join(os.path.dirname(os.getcwd()), "DataDiVR"))
LAYOUTS_DIR = os.path.join(DATADIVR_PATH, "viveNet/Content/data/layouts")
LINKS_DIR = os.path.join(DATADIVR_PATH, "viveNet/Content/data/links")
LABELS_DIR = os.path.join(DATADIVR_PATH, "viveNet/Conten... | nilq/baby-python | python |
from app import app
from flask import render_template, request
from forms import GetLucky
from random import randint
@app.route('/')
def lucky_static():
lucky_num = randint(1, 10)
return render_template('simple.html', lucky_num=lucky_num)
@app.route('/<max>/')
def lucky_max(max):
lucky_num = randint(1, int(max))... | nilq/baby-python | python |
import unittest
from stock_prices import fetchStockData
import io
import sys
class TestFileName(unittest.TestCase):
def test_function1(self):
symbol = 'AAPL'
self.assertTrue(fetchStockData(symbol), None)
if __name__ == '__main__':
unittest.main()
| nilq/baby-python | python |
import re
from rdp.symbols import Regexp, flatten
letters = Regexp(r'[a-zA-Z]+')
digits = Regexp(r'[0-9]+')
hexdigits = Regexp(r'[0-9a-fA-F]+')
octdigits = Regexp(r'[0-7]+')
whitespace = Regexp(r'\s+')
word = Regexp(r'[a-zA-Z0-9_]+')
hyphen_word = Regexp(r'[a-zA-Z0-9_-]+')
identifier = Regexp(r'[a-zA-Z_][a-zA-Z0-9_]... | nilq/baby-python | python |
__author__ = 'admin'
import pretender_defaults
import pretend_helpers
class Request:
def __init__(self):
self.url = pretender_defaults.url
self.headers = {}
self.body = pretender_defaults.request_body
self.method = pretender_defaults.method
def set_request_entities(self,request_json):
self.u... | nilq/baby-python | python |
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to ... | nilq/baby-python | python |
# Kubos SDK
# Copyright (C) 2016 Kubos 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
#
# Unless required by applicable law or ... | nilq/baby-python | python |
import pygame
import attore
# Classe specifica per i pesci che eredita dalla classe Attore
class Pesce(attore.Attore):
pass
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Various utilities for interacting with the API."""
import os
import re
import pyodbc
from django.conf import settings
from djimix.constants import TERM_LIST
from djimix.core.database import get_connection
from djimix.core.database import xsql
from djpsilobus.core.data import DEPARTMENTS
fr... | nilq/baby-python | python |
#!/usr/bin/env python
import sys
from pyxl.codec.transform import pyxl_invert_string, pyxl_transform_string
if __name__ == '__main__':
invert = invertible = False
if sys.argv[1] == '-i':
invertible = True
fname = sys.argv[2]
elif sys.argv[1] == '-r':
invert = True
fname = ... | nilq/baby-python | python |
"""Support for the PrezziBenzina.it service."""
import datetime as dt
from datetime import timedelta
import logging
from prezzibenzina import PrezziBenzinaPy
import voluptuous as vol
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_TIME, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeas... | nilq/baby-python | python |
import numpy as np
import skfuzzy as fuzz
class cluster():
def __init__(self,x,y,U,n_clusters):
data = np.reshape(U,(1,-1))
cntr, u, u0, d, jm, p, fpc = fuzz.cluster.cmeans(data,n_clusters,2,error=0.0001, maxiter=10000, init=None)
self.labels = np.reshape(np.argmax(u,axis=0),U.shape)
self.lab... | nilq/baby-python | python |
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDialog
from src.ui_elements.bonusingredient import Ui_addingredient
from src.config_manager import shared
from src.logger_handler import LoggerHandler
from src.display_controller import DP_CONTROLLER
from src.database_commander imp... | nilq/baby-python | python |
#!/usr/bin/env python3
# coding: UTF-8
#---------------------------------------------------------------
# author:"Haxhimitsu"
# date :"2021/01/06"
# cite :
#Usage
# python3 src/tf_sample_ver2.0.py --dataset_path "{your input directory}" --log_dir "{your output directry}
#---------------------------------------------... | nilq/baby-python | python |
#!/usr/bin/python3
"""
Defines a class Review.
"""
from models.review import Review
import unittest
import models
import os
class TestReview(unittest.TestCase):
"""Represent a Review."""
def setUp(self):
"""SetUp method"""
self.review = Review()
def TearDown(self):
"""Tea... | nilq/baby-python | python |
import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import GaussianNB
... | nilq/baby-python | python |
#!/usr/bin/env python3.6
# -*- coding:utf-8 -*-
__author__ = 'Lu ShaoAn'
__version__ = '1.0'
__date__ = '2021.05.13'
__copyright__ = 'Copyright 2021, PI'
import torch
res = torch.nn.functional.softmax(torch.tensor([13,9,9], dtype=torch.float32))
print(res) | nilq/baby-python | python |
from drf_yasg.utils import swagger_auto_schema
from product.models import Category, Ingredient, Pizza
from product.serializers import (CategorySerializer, IngredientSerializer,
PizzaSerializer)
from product.utils import resource_checker
from rest_framework import status
from rest_framew... | nilq/baby-python | python |
import streamlit as st
import pandas as pd
import os
import math
st.set_page_config(
page_title="ID4D", layout="wide"
)
#st.write(os.listdir('.'))
open('test.tmp','w').write('test')
st.sidebar.write('The following app will help to select standards should be utilized as part of a foundational identity syst... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# jacobian column s0 s1 e0 e1 w0 w1 w2
# -----------------------------------------
# Imports
# -----------------------------------------
import pdb
import os # used to clear the screen
import math
from numpy import *
from numpy.linalg... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('myapp', '0005_imagedetails'),
]
operations = [
migrations.CreateModel(
name='GoodsList',
fields=[
... | nilq/baby-python | python |
#!/usr/bin/python3
__author__ = "blueShard (ByteDream)"
__license__ = "MPL-2.0"
__version__ = "1.1"
# Startscript um zu check, ob python3, pip3 + alle benötigten externen python3 libraries installiert sind (wenn nicht wird das benötigte nachinstalliert), das danach die main.py startet:
"""
#!/bin/bash
which python3 ... | nilq/baby-python | python |
import requests
import reconcile.utils.threaded as threaded
import reconcile.queries as queries
from reconcile.dashdotdb_base import DashdotdbBase, LOG
QONTRACT_INTEGRATION = 'dashdotdb-dvo'
class DashdotdbDVO(DashdotdbBase):
def __init__(self, dry_run, thread_pool_size):
super().__init__(dry_run, threa... | nilq/baby-python | python |
#coding=utf-8
#
# Copyright (C) 2015 24Hours TECH Co., Ltd. All rights reserved.
# Created on Mar 21, 2014, by Junn
#
#
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
import settings
from managers import ... | nilq/baby-python | python |
from harmony_state import harmony_state
# this module opens MIDI input can receive MIDI signals from... some port. Which port? Let's see.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 7 10:34:59 2020
@author: johntimothysummers
"""
import mido
from harmony_state import harmony_state
fro... | nilq/baby-python | python |
import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from urllib import urlencode
import hashlib
import csv
from product_spiders.item... | nilq/baby-python | python |
# Generated by Django 3.0.7 on 2020-09-03 13:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Job', '0005_auto_20200903_0602'),
]
operations = [
migrations.AddField(
model_name='certificates',
name='image',
... | nilq/baby-python | python |
"""
This is meant for loading the definitions from an external file.
"""
import os.path
from .backend import EmptyBackend
from .driver import Driver
from .errors import CompilerError
from .lexer import Lexer
from . import symbols
from . import types
# Since a file isn't going to change in the middle of our run, there... | nilq/baby-python | python |
from requests import Session
from uuid import uuid4
from base64 import b64encode
from hashlib import sha1
from datetime import datetime
from adobe_analytics.config import BASE_URL
from adobe_analytics.exceptions import ApiError
class OmnitureSession:
def __init__(self, username=None, secret=None, comp... | nilq/baby-python | python |
maximoImpar = int(input("Até que número gostaria de lista os impares?: "))
for x in range(maximoImpar):
if x % 2 != 0:
print(x) | nilq/baby-python | python |
#!/usr/bin/env python
"""
BA 08 NGA model
"""
from .utils import *
class BA08_nga:
"""
Class of NGA model of Boore and Atkinson 2008
"""
def __init__(self):
"""
Model initialization
"""
# 0. Given parameters (period independent parameters)
self.a1 = 0.03 # in ... | nilq/baby-python | python |
import permstruct
import permstruct.dag
from permstruct.lib import Permutations
def loc_max(w):
'''
Helper function for stack-sort and bubble-sort. Returns the index of the
maximal element in w. It is assumed that w is non-empty.
'''
m = w[0]
i = 0
c = 0
for j in w[1:]:
c = c+... | nilq/baby-python | python |
from Othello.Cell import Cell
from .Decorator import Decorator
class Decorator_MaximizeOwnDisc(Decorator):
def _scoring(self, case):
score = {Cell.BLACK: case.blackDisc,
Cell.WHITE: case.whiteDisc}[self._discType]
return (self._rate * score) + self._agent._scoring(case)
def ... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright 2013 Netflix, Inc.
"""Utility classes
"""
from contextlib import contextmanager
import logging
import signal
import sys
class TimeoutError(Exception):
"""Timeout Error"""
pass
@contextmanager
def timeout(seconds, error_message="Timeout"):
"""Timeout context manager u... | nilq/baby-python | python |
from typing import Any, List
from PySide6.QtGui import QColor
from PySide6.QtWidgets import QComboBox
from .ui import ColorPicker
class Optionable:
def __init__(self, **options):
self.options = options
def add_options(self, **options):
self.options.update(options)
def set_option(self, ... | nilq/baby-python | python |
import os
from django.conf import settings
DEBUG = False
TEMPLATE_DEBUG = True
DATABASES = settings.DATABASES
# Update database configuration with $DATABASE_URL.
import dj_database_url
# import os
# import psycopg2
# import urllib.parse as up
# up.uses_netloc.append("postgres")
# url = up.urlparse(os.environ["DAT... | nilq/baby-python | python |
import os
broker_url = os.environ['REDIS_URL']
result_backend = os.environ['REDIS_URL']
broker_transport_options = {
'max_connections': 20
}
task_serializer = 'json'
result_serializer = 'json'
accept_content = ['json']
task_routes = {
# '{{cookiecutter.code_name}}.apps.app-name.tasks.*': {'queue': '{{cookiec... | nilq/baby-python | python |
#!/usr/bin/env python
import numpy as np
from scipy.io.matlab import loadmat
from sklearn.metrics import pairwise_distances
import os
_ROOT = os.path.abspath(os.path.dirname(__file__))
lps_neighbor_shifts = {
'a': np.array([ 0, -1, 0]),
'ai': np.array([ 0, -1, -1]),
'as': np.array([ 0, -1, 1]),
'i': np.array([ 0... | nilq/baby-python | python |
from post_processing_class import PostProcess
from post_processing_class import update_metrics_in_report_json
from post_processing_class import read_limits
from post_processing_class import check_limits_and_add_to_report_json | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import random
import time
import pytest
from fixture.application import Application
from fixture.orm import ORMFixture
from model.contact import Contact
from model.group import Group
@pytest.mark.skip(reason="XAMPP 8 ver")
def test_add_contact_to_group(app: Application, orm: ORMFixture):
... | nilq/baby-python | python |
import unittest
from collatz import collatz_sequence as collatz
class CollatzTestCase(unittest.TestCase):
def test_base_case(self):
base_case = collatz(1)
self.assertListEqual(base_case, [1])
def test_3(self):
sequence = collatz(3)
self.assertListEqual(sequence, [3, 10, 5, 16,... | nilq/baby-python | python |
from django.urls import re_path
from . import views
app_name = "curator"
urlpatterns = [
re_path(r"^upload$", views.UploadSpreadSheet.as_view(), name="upload_file"),
]
| nilq/baby-python | python |
"""
Anisha Kadri 2017
ak4114@ic.ac.uk
A Module containing methods to create networks from different models.
1) For pure preferential attachement:-
pref_att(N, m)
2) For random attachment:-
rand_att(N,m)
3) For a mixture of the two, attachment via random walk:-
walk_att(N,m,L)
References
----------
[1]... | nilq/baby-python | python |
import queue
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import de... | nilq/baby-python | python |
from typing import Dict
from .logger import Logger
from google.cloud.logging_v2.client import Client
from google.cloud.logging_v2.resource import Resource
class StackDriverLogger(Logger):
def __init__(self, project_id, service_name, region):
self.client = Client(project=project_id)
self.project_i... | nilq/baby-python | python |
import unittest
from utils.transliteration import transliterate
class TestTransliterate(unittest.TestCase):
def test_english_string(self):
original = 'The quick brown fox jumps over the lazy dog'
result = transliterate(original)
self.assertEqual(original, result)
def test_english_st... | nilq/baby-python | python |
__author__ = 'Gaston C. Hillar'
import pyupm_th02 as upmTh02
import pyupm_i2clcd as upmLcd
import pyupm_servo as upmServo
import time
import paho.mqtt.client as mqtt
import json
class TemperatureServo:
def __init__(self, pin):
self.servo = upmServo.ES08A(pin)
self.servo.setAngle(0)
def prin... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.