content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import time from adafruit_servokit import ServoKit kit = ServoKit(channels=16) def mouth(action): if(action == 0): print("openMouth") kit.servo[0].angle = 40 if(action == 1): print("close") kit.servo[0].angle = 180 if(action == 2): print("talk") #kit.servo[0...
nilq/baby-python
python
""" Perceptual decision-making task, loosely based on the random dot motion task. """ import numpy as np from pycog import Model, RNN, tasktools #------------------------------------------------------------------------------- # Network structure #----------------------------------------------------------------------...
nilq/baby-python
python
from OpenGL.GL import * import threading import random import time class Block: """ Block * Base block class """ def __init__(self, name, renderer): """ Block.__init__ :name: name of the block :texture: texture of the block :parent: the parent window ...
nilq/baby-python
python
from django.conf import settings from .filebased import FileBackend from .s3 import S3Backend DEFAULT_CLASS = FileBackend def get_backend_class(): if settings.FILE_STORAGE_BACKEND == "s3": return S3Backend elif settings.FILE_STORAGE_BACKEND == "file": return FileBackend else: ...
nilq/baby-python
python
from setuptools import setup setup(name='data_loader', version='0.1', description='Hackathon data loader', url='https://github.com/snowch-labs/or60-ocado-ibm-hackathon', author='Chris Snow', author_email='chris.snow@uk.ibm.com', license='Apache 2.0', packages=['data_loader'], ...
nilq/baby-python
python
from json import loads from gtts import gTTS import urllib.request import time import random link = "http://suggestqueries.google.com/complete/search?client=firefox&q=" rap = "" def editLinkWithUserInput(link): magicWord = str(input("What do you want your starting words to be? ")) if " " in magicWord: ...
nilq/baby-python
python
import sys import os cur = os.path.dirname(os.path.abspath(__file__)) sys.path.append(cur) sys.path.append(cur+"/..") sys.path.append(cur+"/../common") from SearchRepository import ISearchRepository import unittest from IQRServer import QRContext from IQRRepository import IQRRepository from search_service import * fro...
nilq/baby-python
python
# =============================================================================== # Copyright 2015 Jake Ross # # 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...
nilq/baby-python
python
#!/usr/bin/python from __future__ import division, print_function import multiprocessing from subprocess import call import numpy as np import pandas as pd import numpy.linalg as linalg from math import sqrt import ld.ldscore as ld import ld.parse as ps from ldsc_thin import __filter_bim__ from scipy.stats import norm ...
nilq/baby-python
python
file1=open("./protein1.pdb","r") file2=open("./protein2.pdb","r") from math import * model1=[] model2=[] for line in file1: line=line.rstrip() if "CA" in line: list1=line.split() model1.append([float(list1[6]),float(list1[7]),float(list1[8])]) for line in file2: line=line.rstrip() if "CA" in line: list2=line....
nilq/baby-python
python
""" 关键点解析 链表的基本操作(删除指定节点) 虚拟节点dummy 简化操作 其实设置dummy节点就是为了处理特殊位置(头节点),这这道题就是如果头节点是给定的需要删除的节点呢? 为了保证代码逻辑的一致性,即不需要为头节点特殊定制逻辑,才采用的虚拟节点。 如果连续两个节点都是要删除的节点,这个情况容易被忽略。 eg: // 只有下个节点不是要删除的节点才更新current if (!next || next.val !== val) { current = next; } """ """ Before writing any code, it's good to make a list of edge cases ...
nilq/baby-python
python
""" Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2:...
nilq/baby-python
python
import redis rds=redis.StrictRedis('db', 6379)
nilq/baby-python
python
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django.contrib.auth.forms import PasswordChangeForm class CreateProject(forms.Form): projectname = forms.SlugField(label="Enter project name", max_length=50, required=True) helper = FormHelper() ...
nilq/baby-python
python
from JumpScale import j def cb(): from .HttpClient import HttpClient return HttpClient() j.base.loader.makeAvailable(j, 'clients') j.clients._register('http', cb)
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Assumes: Python 3 (>= 3.6) # selenium ($ pip install selenium) # ChromeDriver (http://chromedriver.chromium.org) # Chrome binary (> v61) # __author__ = "Adam Mikeal <adam@tamu.edu>" __version__ = "0.8" import os import sys import logging i...
nilq/baby-python
python
""" Azdevman Consts This module contains constant variables that will not change """ # Environment Variables AZDEVMAN_ENV_PREFIX = "AZDEVMAN_" # Azure Devops AZ_BASE_URL = "https://dev.azure.com/" AZ_DEFAULT_ORG = "ORGANIZATION" AZ_DEFAULT_PAT = "UEFUCg==" AZ_DEFAULT_PROJECT = "PROJECT" # Config file CONFIG_DIR = "...
nilq/baby-python
python
class JintaroException(Exception): """Base class for Jintaro exceptions""" class ConfigError(JintaroException): """Base class for config exceptions""" class UnknownOptionError(ConfigError): """""" class ConfigValueError(ConfigError): """""" class InputListError(JintaroException): """""" cl...
nilq/baby-python
python
#! /usr/bin/env python def read_file(): """Opens Project Euer Name file. Reads names, sorts and converts str into a list object""" a = open('names.txt', 'r') data = a.read() names = data.split(",") a.close() names.sort() return names def name_score(): """Calculates the total nam...
nilq/baby-python
python
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
nilq/baby-python
python
#!/usr/bin/env python # J-Y Peterschmitt - LSCE - 09/2011 - pmip2web@lsce.ipsl.fr # Test the use of hatches and patterns in the isofill # and fill area graphics methods # Import some standard modules from os import path # Import what we need from CDAT import cdms2 import vcs # Some data we can plot from the 'sampl...
nilq/baby-python
python
from thresher.scraper import Scraper from thresher.query_share import QueryShare import furl import csv import os from slugify import slugify import wget import json ### Possibly convert this to docopt script in the future ### class Thresher: #assumes that links is a list of dictionaries with the keys as a conten...
nilq/baby-python
python
from hknweb.academics.views.base_viewset import AcademicEntityViewSet from hknweb.academics.models import Instructor from hknweb.academics.serializers import InstructorSerializer class InstructorViewSet(AcademicEntityViewSet): queryset = Instructor.objects.all() serializer_class = InstructorSerializer
nilq/baby-python
python
import sys if len(sys.argv) == 2: print("hello, {}".format(sys.argv[1])) #print("hello,"+(sys.argv[1])) else: print("hello world")
nilq/baby-python
python
import pydot # I like to use the full path for the image as it seems less error prone. # Therefore, first we find the current path of this file and use that to locate the image - assuming the image, # is in the same folder as this file. import pathlib current_path = pathlib.Path(__file__).parent.resolve() # Create t...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Copyright [2020] [Sinisa Seslak (seslaks@gmail.com) 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/lice...
nilq/baby-python
python
import numpy as np class Kalman(object): DIMENSIONS = 3 MEASUREMENT = 1 def __init__(self, q, r): #initialise self.Q = np.matrix(np.eye(Kalman.DIMENSIONS)*q) self.R = np.matrix(np.eye(Kalman.MEASUREMENT)*r) self.H = np.matrix(np.zeros((Kalman.MEASUREMENT, Kalman.DIMENSIO...
nilq/baby-python
python
# Databricks notebook source # MAGIC %run ./_databricks-academy-helper $lesson="dlt_demo" # COMMAND ---------- try: dbutils.fs.unmount("/mnt/training") except: pass # %run ./mount-datasets # COMMAND ---------- class DataFactory: def __init__(self): self.source = f"{DA.paths.data_source}/tracker/streamin...
nilq/baby-python
python
r""" bilibili_api.live 直播相关 """ import time from enum import Enum import logging import json import struct import base64 import asyncio from typing import List import aiohttp import brotli from aiohttp.client_ws import ClientWebSocketResponse from .utils.Credential import Credential from .utils.ne...
nilq/baby-python
python
import sys import os import torch import librosa import soundfile as sf import numpy as np import tkinter as tk from tkinter import filedialog import openunmix from PySide6 import QtCore class Main(QtCore.QThread): def __init__(self): super(Main, self).__init__() self.global_objects = {} de...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: train-atari.py # Author: Yuxin Wu import numpy as np import sys import os import uuid import argparse import cv2 import tensorflow as tf import six from six.moves import queue from tensorpack import * from tensorpack.tfutils import optimizer from tensorpack.util...
nilq/baby-python
python
#!/usr/bin/env python import os import sys import socket import rospy from robotiq_control.cmodel_urscript import RobotiqCModelURScript from robotiq_msgs.msg import CModelCommand, CModelStatus def mainLoop(urscript_topic): # Gripper is a C-Model that is connected to a UR controller. # Commands should be published...
nilq/baby-python
python
import torch import torch.nn.functional as F class DynamicsModel(torch.nn.Module): # transitioin function def __init__(self, D_in, D_out, hidden_unit_num): print("[DynamicsModel] H =",hidden_unit_num) super(DynamicsModel, self).__init__() # zero hidden layer #self.l1 = torch.nn.Li...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Script to plot storage IO timing usage from profiling data. This script requires the matplotlib and numpy Python modules. """ from __future__ import print_function from __future__ import unicode_literals import argparse import glob import os import sys import numpy ...
nilq/baby-python
python
# -*- coding: utf-8 -*- import datetime from django.db import models from django.core.validators import MaxValueValidator, MinValueValidator from taxi_online_example.utils import date_now_or_future_validator, UTC from django.forms.models import model_to_dict class TaxiLocation(models.Model): taxi_id = models.Cha...
nilq/baby-python
python
from get_data import *
nilq/baby-python
python
import os import gzip import shutil import struct import urllib import numpy as np import matplotlib.pyplot as plt import tensorflow as tf os.environ['TF_CPP_MIN_LOG_LEVEL']='2' def read_data(filename): """ :param filename :return: array """ text = open(filename, 'r').readlines()...
nilq/baby-python
python
#!/usr/bin/env python """ DBSCAN Project - M2 SSI - Istic, Univ. Rennes 1. Andriamilanto Tompoariniaina <tompo.andri@gmail.com> This module is an implementation of K-mean algorithm to confront it with our implementation of the DBSCAN one. """ # -- Imports import sys import random import operator from pandas import D...
nilq/baby-python
python
import csv from stations import Station, Stations csvfile="./source/stations_aod.csv" def readCSV(csv_file): stations_aod=dict(); with open(csv_file,'rb') as csvfile: spamreader=csv.reader(csvfile,delimiter=",",quotechar='|') for row in spamreader: stations_aod[row[0]]=(row) ...
nilq/baby-python
python
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None from math import log class Solution: # @param {TreeNode} root # @return {integer[]} def rightSideView(self, root): def df...
nilq/baby-python
python
#Ejercicio 2 - Cuaderno 2 """ Implementa un programa modularizado que, leyendo de teclado los valores necesarios, muestre en pantalla el área de un círculo, un cuadrado y un triángulo. Utiliza el valor 3.1416 como aproximación de П (pi) o importa el valor del módulo “math”. """ import math print ('Círculo') radio= f...
nilq/baby-python
python
import sys def main(): infile=open(sys.argv[1],"r") counter=0 tf="" for l in infile: if (">" in l): s=l.split() if (tf!=""): print(tf+'\t'+str(counter)) counter=0 tf=s[1].upper() elif ("#" not in l): counter+=1 print(tf+'\t'+str(counter)) infile.close() main()
nilq/baby-python
python
# -*- coding: utf-8 -*- """ @author: Hiromasa Kaneko """ import pandas as pd from sklearn.neighbors import NearestNeighbors # k-NN k_in_knn = 5 # k-NN における k rate_of_training_samples_inside_ad = 0.96 # AD 内となるトレーニングデータの割合。AD のしきい値を決めるときに使用 dataset = pd.read_csv('resin.csv', index_col=0, header=0) x_pr...
nilq/baby-python
python
from BogoBogoSort import bogoBogoSort from BogoSort import bogoSort from BozoSort import bozoSort from CommunismSort import communismSort from MiracleSort import miracleSort from StalinSort import stalinSort from SlowSort import slowSort import numpy as np import time import matplotlib import matplotlib.pyplot a...
nilq/baby-python
python
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """Django model mixins and utilities.""" class RunTextFieldValidators: """ Mixin to run all field validators on a save method call This mixin should appear BEFORE Model. """ def save(self, *args, **kwargs): """ ...
nilq/baby-python
python
#! python3 # voicechannelcontrol.py """ ============================================================================== MIT License Copyright (c) 2020 Jacob Lee 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...
nilq/baby-python
python
""" Copyright MIT and Harvey Mudd College MIT License Summer 2020 Lab 3B - Depth Camera Cone Parking """ ######################################################################################## # Imports ######################################################################################## import sys import cv2 as...
nilq/baby-python
python
import pytest class RespIs: @staticmethod async def no_content(resp): assert resp.status == 204 @staticmethod async def bad_gateway(resp, message="Bad gateway"): """ Check whether a response object is a valid Virtool ``bad gateway``. """ assert resp.status == 5...
nilq/baby-python
python
""" Some examples playing around with yahoo finance data """ from datetime import datetime from pandas.compat import zip import matplotlib.finance as fin import numpy as np from pylab import show from pandas import Index, DataFrame from pandas.core.datetools import BMonthEnd from pandas import ols startDate = date...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import math import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo import torch.autograd as autograd from torch.autograd.variable import Variable from threading import Lock from torch.distributions import Categorical global_lock = Lock() model_urls...
nilq/baby-python
python
from sqlalchemy import Table, Column, Integer, String, ForeignKey from utils import metadata category = Table( "category", metadata, Column("id", Integer, primary_key=True), Column("parent_fk", Integer, ForeignKey("category.id"), nullable=True), Column("label", String(length=60), unique=True, n...
nilq/baby-python
python
import lark from foyer.exceptions import FoyerError GRAMMAR = r""" start: _string // Rules _string: _chain _nonlastbranch* _lastbranch? _chain: atom _chain | atom _nonlastbranch: "(" branch ")" _lastbranch: branch branch: _string atom: ("[" weak_and_expression "]" | atom_symbol) atom_...
nilq/baby-python
python
""" Created on 13-Apr-2018 @author: jdrumgoole """ import unittest import pymongo from dateutil.parser import parse from pymongoimport.audit import Audit class Test_Audit(unittest.TestCase): def setUp(self): self._client = pymongo.MongoClient(host="mongodb://localhost/TEST_AUDIT") self._databa...
nilq/baby-python
python
# search target number in the list. class LinearSearch : def __init__(self,target, data): self.data = data self.target = target print(self.doSearch()) def doSearch(self): for current in self.data : if current == self.target : return "Target Number...
nilq/baby-python
python
import numpy as np from flask import Flask, render_template, request import jinja2 from MBScalc import * #Init Flask App app = Flask(__name__) @app.route('/', methods = ['GET','POST']) def main(): number = int(request.form['number']) if request.method == 'POST': result = number else: result = 0 # mass = float...
nilq/baby-python
python
# -*- coding: utf-8 -*- import logging from random import randint import re import six import os from datetime import datetime __author__ = "Arun KR (kra3) <the1.arun@gmail.com>" __license__ = "Simplified BSD" RE_IP = re.compile(r'^[\d+]{1,3}\.[\d+]{1,3}\.[\d+]{1,3}\.[\d+]{1,3}$', re.I) RE_PRIV_IP = re.compile(r'^(?...
nilq/baby-python
python
from Cimpl import load_image, create_color, set_color, show, Image, save_as, copy from typing import NewType image = load_image('p2-original.jpg') # loads the original colourless picture def createBlue( image ): """ the function createBlue displays the original image, once closed it displays the image with a bl...
nilq/baby-python
python
import os import sys from random import Random import numpy as np from os.path import join import re from gpsr_command_understanding.generator.grammar import tree_printer from gpsr_command_understanding.generator.loading_helpers import load, GRAMMAR_YEAR_TO_MODULE, load_paired from gpsr_command_understanding.generato...
nilq/baby-python
python
#!/usr/bin/env python3 from sys import argv,stderr,exit import json, os, yaml, pynetbox, re, ipaddress from collections import defaultdict from pprint import pprint doc = """ Get config context from netbox for specified device. ## Usage %s "FQDN" """ % (argv[0]) def assume_ip_gateway(network): return str(ipadd...
nilq/baby-python
python
from scipy.optimize import shgo import numpy as np from numpy.linalg import norm class VectorCubicSpline: """ a0, a1, a2, a3 are numpy vectors, they form the spline a0 + a1*s + a2*s^2 + a3*s^3 """ def __init__(self, a0, a1, a2, a3): self.a0 = np.array(a0) self.a1 = np.array(a1) self.a2...
nilq/baby-python
python
class Fonction: def calcul(self, x): pass class Carre(Fonction): def calcul(self, x): return x*x class Cube(Fonction): def calcul(self, x): return x*x*x def calcul_n_valeur (l,f): res = [ f(i) for i in l ] return res l = [0,1,2,3] l1 = calcul_n_valeur(l, Carre().cal...
nilq/baby-python
python
import findspark findspark.init() from pyspark import SparkConf,SparkContext from pyspark.streaming import StreamingContext from pyspark.sql import Row,SQLContext import sys import requests def aggregate_tags_count(new_values, total_sum): return sum(new_values) + (total_sum or 0) def get_sql_context_instance(spark_...
nilq/baby-python
python
""" API serializers """ from rest_framework import serializers from groups.models import CustomUser, Group, Link class CustomUserBaseSerializer(serializers.ModelSerializer): """ CustomUser base serializer """ class Meta: model = CustomUser fields = ('id', 'username', 'email', 'date_jo...
nilq/baby-python
python
import argparse import json from pathlib import Path from typing import Iterable, Set import pandas as pd from hyperstyle.src.python.review.inspectors.inspector_type import InspectorType from hyperstyle.src.python.review.inspectors.issue import BaseIssue, IssueType from hyperstyle.src.python.review.reviewers.utils.pri...
nilq/baby-python
python
""" The STDIO interface for interactive CIS. Authors: Hamed Zamani (hazamani@microsoft.com) """ import time import traceback from macaw import util from macaw.interface.interface import Interface from macaw.core.interaction_handler.msg import Message class StdioInterface(Interface): def __init__(self, params):...
nilq/baby-python
python
from rest_framework import status from webfront.tests.InterproRESTTestCase import InterproRESTTestCase from webfront.models.interpro_new import Release_Note class UtilsAccessionTest(InterproRESTTestCase): def test_can_read_structure_overview(self): response = self.client.get("/api/utils") self.ass...
nilq/baby-python
python
import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" os.environ["CUDA_VISIBLE_DEVICES"] = "3" import warnings warnings.filterwarnings('ignore') import pickle as pickle import numpy as np import datetime from keras import Model import keras import queue from keras.layers import Dense, Activation, Dropout, Layer...
nilq/baby-python
python
boot_list = [ "anklet", "boots", "clogs", "feet", "footguards", "footpads", "footsteps", "footwraps", "greatboots", "greaves", "heels", "sabatons", "sandals", "slippers", "sneakers", "socks", "sprinters", "spurs", "stompers", "treads", "walkers", "warboots", "wraps", "zoomers"] body_list = [ "bande...
nilq/baby-python
python
# -*- coding: utf-8 -*- import cv2 import numpy as np from typing import Tuple, List, Union from image_registration.keypoint_matching.kaze import KAZE from image_registration.exceptions import (CreateExtractorError, NoModuleError, NoEnoughPointsError) class ORB(KAZE): METHOD_NAME = "ORB" def __init__(self, t...
nilq/baby-python
python
""" functions for deterministically preprocessing 2D images (or 3D with color channels) mostly for the consumption of computer vision algorithms """ import math import numpy as np import skimage.transform from .. import utils def _center_coords_for_shape(shape): """ returns the center of an ndimage with a gi...
nilq/baby-python
python
# This file is a part of Arjuna # Copyright 2015-2020 Rahul Verma # Website: www.RahulVerma.net # 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
# Copyright (c) 2019, Ahmed M. Alaa # Licensed under the BSD 3-clause license (see LICENSE.txt) import pandas as pd import numpy as np def draw_ihdp_data(fn_data): # Read the covariates and treatment assignments from the original study # -----------------------------------------------------------------...
nilq/baby-python
python
import numpy as np from numba import njit, prange from SZR_contact_tracing import nb_seed, update_cell, szr_sample, mszr_sample @njit def cluster_size(L: int, seed: int, alpha: float = 0.25, occupancy: float = 1, mszr: bool = True): # Initialize a lattice, run it, and return the cluster size. nb_seed(L) l...
nilq/baby-python
python
"""Constants for the Kostal Plenticore Solar Inverter integration.""" from typing import NamedTuple from homeassistant.components.sensor import ( ATTR_STATE_CLASS, SensorDeviceClass, SensorStateClass, ) from homeassistant.const import ( ATTR_DEVICE_CLASS, ATTR_ICON, ATTR_UNIT_OF_MEASUREMENT, ...
nilq/baby-python
python
import pdb import uuid from decimal import Decimal from django.apps import apps from ahj_app.models import User, Edit, Comment, AHJInspection, Contact, Address, Location, AHJ, AHJUserMaintains from django.urls import reverse from django.utils import timezone import pytest import datetime from fixtures import create_u...
nilq/baby-python
python
from flask import Blueprint, g, request, current_app import json import logging from ..utils import datetime_to_json, get_time_string, get_default_runtime, match_movie import datetime from ..pick_algo import pick_movies_by_num, pick_movies_by_time from .auth import login_required import pandas import pathlib from .. i...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # from "SuperShape2D" (Daniel Shiffman) # Video: https://youtu.be/ksRoh-10lak # supershapes: http://paulbourke.net/geometry/supershape/ import sys, os from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import math import numpy as np def...
nilq/baby-python
python
"""Convert all the old posts. Author: Alex Alemi Date: 2019-01-23 """ import os import logging CURRENT_DIR = os.path.dirname(__file__) POSTS_DIR = os.path.normpath(os.path.join(CURRENT_DIR, '../posts/old')) def fix_front(line): """Redo the front of the metadata lines for the nikola format.""" return '.. ' +...
nilq/baby-python
python
# Generated by Django 2.2.24 on 2021-07-26 14:50 import django.core.validators from django.db import migrations, models def split_dates(apps, schema_editor): CompanyObjective = apps.get_model('exportplan', 'CompanyObjectives') for objective in CompanyObjective.objects.all(): if objective.start_date: ...
nilq/baby-python
python
"""https://gist.github.com/alopes/5358189""" stopwords = [ "de", "a", "o", "que", "e", "do", "da", "em", "um", "para", "é", "com", "não", "uma", "os", "no", "se", "na", "por", "mais", "as", "dos", "como", "mas", "foi", ...
nilq/baby-python
python
import pygame from . import GameEnv, GameEnv_Simple, Ball, Robot, Goal from typing import Tuple, List, Dict import random class AbstractPlayer: def __init__(self, env: GameEnv, robot: Robot): self.env = env self.robot = robot def get_action(self) -> Tuple[float, float]: raise Exception...
nilq/baby-python
python
class Solution: def XXX(self, head: ListNode) -> ListNode: try: new_head = new_tail = ListNode(head.val) p = head.next while p: if new_tail.val != p.val: node = ListNode(p.val) new_tail.next = node ...
nilq/baby-python
python
from PIL import Image # Charger l'image img = Image.open('/home/popschool/Documents/GitHub/projet_recoplante/Images_test/bruyere_des_marais_NB.jpg') # Afficher l'image chargée img.show() # Récupérer et afficher la taille de l'image (en pixels) w, h = img.size print("Largeur : {} px, hauteur : {} px".format(w, h)...
nilq/baby-python
python
import unittest from Config import Config from MossResultsRetriever import MossResultsRetriever from Result import Result class MossURLsTests(unittest.TestCase): def setUp(self): self.config = Config() self.validUrl = self.config.getMagicsquare() self.retriever = MossResultsRetriever() ...
nilq/baby-python
python
import io import os.path import shutil import sys import tempfile import re import unittest from types import ModuleType from typing import Any, List, Tuple, Optional from mypy.test.helpers import ( assert_equal, assert_string_arrays_equal, local_sys_path_set ) from mypy.test.data import DataSuite, DataDrivenTest...
nilq/baby-python
python
# Generated by Django 3.2.12 on 2022-02-16 23:46 import django.core.validators from django.db import migrations, models import re class Migration(migrations.Migration): dependencies = [ ('customer', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='custom...
nilq/baby-python
python
###################################################################### # # File: b2/download_dest.py # # Copyright 2019 Backblaze Inc. All Rights Reserved. # # License https://www.backblaze.com/using_b2_code.html # ###################################################################### from b2sdk.download_dest import *...
nilq/baby-python
python
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"index_flow": "00_core.ipynb", "query_flow": "00_core.ipynb", "slugify": "01_loader.ipynb", "get_image_files": "01_loader.ipynb", "verify_image": "01_loader.ipynb", ...
nilq/baby-python
python
from checkov.common.models.enums import CheckCategories from checkov.terraform.checks.resource.base_resource_negative_value_check import BaseResourceNegativeValueCheck class VMDisablePasswordAuthentication(BaseResourceNegativeValueCheck): def __init__(self): name = "Ensure that Virtual machine does not en...
nilq/baby-python
python
"""Tests for encoder routines to tf.train.Exammple.""" from absl.testing import parameterized import tensorflow as tf from tensorflow_gnn.graph import graph_constants as gc from tensorflow_gnn.graph import graph_tensor as gt from tensorflow_gnn.graph import graph_tensor_encode as ge from tensorflow_gnn.graph import gr...
nilq/baby-python
python
from django import forms from fir_nuggets.models import NuggetForm from incidents import models as incident_models class LandingForm(NuggetForm): new = forms.BooleanField(initial=True, required=False) event = forms.ModelChoiceField(queryset=incident_models.Incident.objects.exclude(status='C'), required=False) st...
nilq/baby-python
python
#!/usr/bin/env python #==================================================== import copy import uuid import numpy as np import threading from Utilities.decorators import thread #==================================================== class CircuitCritic(object): def __init__(self, circuit_params): self.circuit_p...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ easybimehlanding This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ import easybimehlanding.models.travel_insurance_policy_extend class TravelInsurancePolicyExtendView(object): """Implementation of the 'TravelInsurancePolicyExtend...
nilq/baby-python
python
# Copyright (c) 2016-2020, The Bifrost Authors. 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 conditi...
nilq/baby-python
python
from .clock import Clock from .identity import Identity from .license import License from .note import Note from .resource import Resource __all__ = ["Clock", "Identity", "License", "Note", "Resource"]
nilq/baby-python
python
from behave import * from src.hamming import distance from assertpy import assert_that use_step_matcher("re") @given("two strands") def step_impl(context): context.distance = distance @when("(?P<strand1>.+) and (?P<strand2>.+) are same length") def step_impl(context, strand1, strand2): context.result = conte...
nilq/baby-python
python
# # This file is an example to set the environment. # The configs will be used in dmrgci.py and chemps2.py # import os from pyscf import lib # To install Block as the FCI solver for CASSCF, see # http://sunqm.github.io/Block/build.html # https://github.com/sanshar/Block BLOCKEXE = '/path/to/Block/block.sp...
nilq/baby-python
python
from nipype.interfaces.base import BaseInterface, \ BaseInterfaceInputSpec, traits, File, TraitedSpec, InputMultiPath, Directory from nipype.utils.filemanip import split_filename import nibabel as nb import numpy as np import os class ConsensusInputSpec(BaseInterfaceInputSpec): in_Files = traits.Either(InputMu...
nilq/baby-python
python
#!/usr/bin/env python ## Program: VMTK ## Module: $RCSfile: vmtksurfacedistance.py,v $ ## Language: Python ## Date: $Date: 2005/09/14 09:49:59 $ ## Version: $Revision: 1.6 $ ## Copyright (c) Luca Antiga, David Steinman. All rights reserved. ## See LICENSE file for details. ## This software is d...
nilq/baby-python
python
# -*- coding: utf-8 -*- #______________________________________________________________________________ #______________________________________________________________________________ # # Coded by Daniel González Duque #______________________________________________________________________________...
nilq/baby-python
python