content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
""" A coordinate transformation module. Made as a separate chunk of code to allow for easier implementation of newer/better reference frame translation methods. Generally used to project a trajectory in ECEF coordinates (eg lat/lon) into a projected reference system. ##just getting started! """ #collect dependenci...
nilq/baby-python
python
from __future__ import absolute_import from six.moves.urllib.parse import urlparse from django.utils.translation import ugettext_lazy as _ from django import forms from sentry import http from sentry.web.helpers import render_to_response from sentry.identity.pipeline import IdentityProviderPipeline from sentry.identi...
nilq/baby-python
python
''' Created by Sidhant Nagpal Feb 1, 2018 ''' from matplotlib import pyplot as plt from random import shuffle import numpy as np import json plt.figure(figsize=(12,6)) data = json.load(open('data.json')) a = [(k,v) for k, v in data.iteritems()] for i in xrange(2,len(a)): if a[i-2]>a[i] and a[i-2]>a[i-1]: a[i-2]...
nilq/baby-python
python
# -*- coding: utf-8 -*- """Simple ClaSP test.""" __author__ = ["patrickzib"] __all__ = [] import numpy as np from sktime.annotation.clasp import ClaSPSegmentation from sktime.datasets import load_gun_point_segmentation def test_clasp_sparse(): """Test ClaSP sparse segmentation. Check if the predicted chan...
nilq/baby-python
python
from string import ascii_uppercase from tkinter import * from analyst import BoardAnalyst from board import Board, Color class MainMenuWindow: """ A class that represents a Main Menu. Can branch to a NameWindow, to an AboutWindow or to a GoodByeWindow On button 1: Branch to a NameWindow, which will event...
nilq/baby-python
python
from typing import List class Solution: def plusOne(self, digits: List[int]) -> List[int]: carry = (digits[-1] + 1) > 9 digits[-1] = (digits[-1] + 1) % 10 for i in reversed(range(len(digits) - 1)): temp = carry carry = (digits[i] + carry > 9) digits[i] ...
nilq/baby-python
python
# Import libraries from collections import Counter, OrderedDict from itertools import chain from more_itertools import unique_everseen import numpy as np import pandas as pd import random import tensorflow as tf from keras import models import warnings import functools import operator warnings.filterwarnings("ignore")...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """Define linear function approximator. Dependencies: - `pyrobolearn.models` - `pyrobolearn.states` - `pyrobolearn.actions` """ from pyrobolearn.approximators.approximator import Approximator from pyrobolearn.models.basics.polynomial import Polynomial, PolynomialFunction ...
nilq/baby-python
python
import requests from bs4 import BeautifulSoup server_address = 'http://127.0.0.1:5000' def getElementById(html, theId): soup = BeautifulSoup(html, 'html.parser') r = soup.find(id=theId) return r def register(uname, pword, twofa, session=None): url = server_address + '/register' if session is None...
nilq/baby-python
python
import random import gym import numpy as np M = 5.0 T = 1.0 GOAL = 0.001 class WeightEnv(gym.Env): metadata = {'render.modes': ['human']} def __init__(self): super(WeightEnv, self).__init__() self.reward_range = (-float('inf'), 0.0) self.state = np.array([0, 0, 0]) # position, velocit...
nilq/baby-python
python
PATTERN = r"(doge|shib)" TRANSFORMER_MODEL = 'cardiffnlp/twitter-xlm-roberta-base-sentiment' SENTIMENT_MAPPING = { 'Positive' : 1, 'Neutral' : 0, 'Negative' : -1 }
nilq/baby-python
python
"""Two Number Sum Write a function that takes in a non-empy array of distinct integers and an integer representing a target sum. If any two numbers in the input array sum up to the target sum, the function should return them in an array, in any order. If no two numbers sum up to the target sum, the function should re...
nilq/baby-python
python
from .bmp180 import bmp180
nilq/baby-python
python
"""Pull git repos and update the local schemes and templates files """ import os import sys import shutil import asyncio from .shared import get_yaml_dict, rel_to_cwd, verb_msg, compat_event_loop def write_sources_file(): """Write a sources.yaml file to current working dir.""" file_content = ( "schemes: " "http...
nilq/baby-python
python
# This module is derived (with modifications) from # https://github.com/GoogleCloudPlatform/tensorflow-without-a-phd/blob/master/tensorflow-rl-pong/trainer/task.py # Special thanks to: # Yu-Han Liu https://nuget.pkg.github.com/dizcology # Martin Görner https://github.com/martin-gorner # Copyright 2019 Leigh Johnson #...
nilq/baby-python
python
# coding: utf-8 """ Project Euler problem #40. """ def problem(): u""" Solve the problem. An irrational decimal fraction is created by concatenating the positive integers: 0.12345678910(1)112131415161718192021... It can be seen that the 12th digit of the fractional part is 1. If dn repres...
nilq/baby-python
python
# Author: Mathurin Massias <mathurin.massias@gmail.com> # License: BSD 3 clause import os from pathlib import Path from bz2 import BZ2Decompressor import numpy as np from scipy import sparse from download import download from sklearn import preprocessing from sklearn.datasets import load_svmlight_file NAMES = { ...
nilq/baby-python
python
# Create class for weather module # Imports import requests import json import datetime import time import os import sys from dotenv import load_dotenv # Class class WeatherModule: """ Weather module class """ # Initialize def __init__(self, city): """ Initialize WeatherModule c...
nilq/baby-python
python
""" AWS Lambda entrypoint and Intent router """ from __future__ import print_function import json import logging import strings from manage_data import get_player_info from utility import ( get_household_and_person_ids, determine_welcome_message ) from play_new_game import play_new_game from handle_answer_reque...
nilq/baby-python
python
# Generated by Django 3.1.7 on 2021-03-12 16:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('recruiter', '0023_auto_20210312_2144'), ] operations = [ migrations.AddField( model_name='recruiter', name='overall_...
nilq/baby-python
python
"""Search views init.""" from src.views.index import show_index
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Created on Mar 31, 2018 @ Author: Frederich River ''' import atexit import os import signal import sys import time from apscheduler.executors.pool import ThreadPoolExecutor from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore from env import LOG_FILE, PID_FI...
nilq/baby-python
python
#!/usr/bin/env python # coding: utf-8 from argparse import ArgumentParser import pandas as pd import pyprojroot LOSS_FUNC_ML_TASK_MAP = { 'CE-largest': 'single-label, largest', 'CE-random': 'single-label, random', 'BCE': 'multi-label', } def main(source_data_root, rm_corr_csv_path, tes...
nilq/baby-python
python
name = 'controllers' from .constant_controller import ConstantController from .controller import Controller from .energy_controller import EnergyController from .fb_lin_controller import FBLinController from .linear_controller import LinearController from .lqr_controller import LQRController from .pd_controller import ...
nilq/baby-python
python
from message_bot.database.engines.base import BaseEngine from message_bot.database.engines.gsheet import GsheetEngine from message_bot.database.engines.json import JSONEngine
nilq/baby-python
python
array = input("Enter the string here: ").split() array.sort(key=len) print(array)
nilq/baby-python
python
import unittest from oletools.common.clsid import KNOWN_CLSIDS class TestCommonClsid(unittest.TestCase): def test_known_clsids_uppercase(self): for k, v in KNOWN_CLSIDS.items(): k_upper = k.upper() self.assertEqual(k, k_upper)
nilq/baby-python
python
import logging import os def setup_logger(log_directory='', log_filename="astronomaly.log"): """ Ensures the system logger is set up correctly. If a FileHandler logger has already been attached to the current logger, nothing new is done. Parameters ---------- log_directory : str, optional ...
nilq/baby-python
python
from unittest.mock import patch import pytest from peerscout.utils.bq_data_service import ( load_file_into_bq, ) import peerscout.utils.bq_data_service \ as bq_data_service_module @pytest.fixture(name="mock_bigquery") def _bigquery(): with patch.object(bq_data_service_module, "bigquery") as mock: ...
nilq/baby-python
python
import click from jinja2 import PackageLoader from dgen import jinja env = jinja.create_env(PackageLoader(package_name=__package__)) TEXT_FIELD = """ %s = models.TextField( verbose_name=_('%s') )""" INTEGER_FIELD = """ %s = models.IntegerField( verbose_name=_('%s') )""" BOOLEAN_FIE...
nilq/baby-python
python
from cocos.layer import Layer, director from cocos.menu import Menu, CENTER, ToggleMenuItem, MenuItem from cocos.scene import Scene from app import gVariables import sceneGenerator class CustomPauseScene(Scene): def __init__(self, gScene): super(CustomPauseScene, self).__init__() #ADD ALL TO MAIN L...
nilq/baby-python
python
#%% import numpy as np from scipy import sparse from scipy.linalg import block_diag #%% def sdp_ymat( lines, Ybus ): nbus = Ybus.shape[0] nline = len(lines) # busset = np.arange(0, nbus) # lineset = np.arange(0, nline) #%% def e(k): return np.eye(nbus)[:, k][np.newaxis] # size of e(k): (...
nilq/baby-python
python
while True: try: height = input("Height: ") while 9 > int(height) > 1: i = 0 while i <= int(height): a = int(height) - i print(a * ' ' + "#" * i) i = i + 1 exit() except ValueError: print("invalid numb...
nilq/baby-python
python
from typing import Dict, List, Tuple import pygame import pygame_gui from pygame.constants import TEXTINPUT from pygame.event import EventType from pygame_gui.core import UIContainer from pygame_gui.elements import UIButton from pygame_gui.elements.ui_label import UILabel from pygame_gui.ui_manager import UIManager i...
nilq/baby-python
python
# coding: utf-8 from __future__ import ( absolute_import, print_function, unicode_literals, ) from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.vml import Shape, Rect class Picture(XmlModel): XML_TAG = 'pict' children = XmlCollection(Shape, Rect)
nilq/baby-python
python
from typing import Union from pyppeteer.browser import Browser __all__ = ("BrowserContext",) class BrowserContext: def __init__(self) -> None: self._browser: Union[Browser, None] = None def set(self, browser: Browser) -> None: self._browser = browser def get(self) -> Union[Browser, Non...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ This script controls the head motors Altered by Johannes Sommerfeldt """ import os import sys import redis # ROS 2 Imports import rclpy from rclpy.node import Node from std_msgs.msg import Float32, String, Int16, Bool from head.msg import MotorPosition from syste...
nilq/baby-python
python
from hapServer import * import hapBack as hb import time import sys hs = hapserver() if sys.argv[1] == "1": hb.a1(int(sys.argv[2]),hs) time.sleep(1) if sys.argv[1] == "2": hb.a2(int(sys.argv[2]),hs) time.sleep(1) if sys.argv[1] == "3": hb.r1(int(sys.argv[2]),hs) time.sleep(1) if sys.argv[1] == "4": h...
nilq/baby-python
python
# Copyright 2018 Capital One Services, 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...
nilq/baby-python
python
# This sample is used in conjunction with protocolModule4.py. from typing import Protocol, TypeVar Y = TypeVar("Y", contravariant=True) class Fn(Protocol[Y]): def __call__(self, y: Y) -> None: ... def x(x: Fn[int]) -> None: print(x)
nilq/baby-python
python
#!/usr/bin/env python3 # Create C/C++ code for two lookup tables. import math # Size of static tables. kTableSize = 4096 # Scale factor for float arg to int index. kScaleFactor = 256.0 print("// Generated code with lookup tables") print('#include "functions.h"') print("namespace tesseract {") print("const double T...
nilq/baby-python
python
class FactorProfile: types = { 'question': str, 'questionText': str, 'answer': str, 'phoneNumber': str, 'credentialId': str } def __init__(self): # unique key for question self.question = None # str # display text for question self...
nilq/baby-python
python
""" Scheduler Service for starting flow :license: MIT """ import calendar import datetime import json import os from src.dependencies.dependency_typing import (PynamoDBCheckIn, PynamoDBConsultant, PynamoDBCustomers,...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2016 Christoph Reiter # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the right...
nilq/baby-python
python
#!/usr/bin/env python ################################################################################ # Created by Oscar Martinez # # o.rubi@esciencecenter.nl # #######################################################...
nilq/baby-python
python
#! /usr/bin/env python from __future__ import print_function import logging logging.getLogger(__name__).setLevel(logging.INFO) import os,sys,time #import yaml import signal from snowboy import snowboydecoder interrupted = False def signal_handler(signal, frame): global interrupted interrupted = True def in...
nilq/baby-python
python
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
nilq/baby-python
python
import os import unittest import numpy as np import pandas as pd from cgnal.core.data.model.ml import ( LazyDataset, IterGenerator, MultiFeatureSample, Sample, PandasDataset, PandasTimeIndexedDataset, CachedDataset, features_and_labels_to_dataset, ) from typing import Iterator, Generat...
nilq/baby-python
python
"""CheckingProxy derived from jsonrpc.proxy due to subclassing problems w/getattr. Converts service errors into ServiceError exceptions, otherwise call returns the jsonrpc "result" field. """ from __future__ import print_function from __future__ import division from __future__ import absolute_import import sys impo...
nilq/baby-python
python
import sys from PyQt5.QtWidgets import QAction,QHBoxLayout,QWidget,QApplication,QMainWindow from PyQt5.QtGui import QIcon class QToolBarDemo(QMainWindow): def __init__(self): super(QToolBarDemo, self).__init__() #设置窗口大小 self.resize(400, 150) #设置窗口标题 self.setWindowTitle("QTo...
nilq/baby-python
python
from django.contrib.auth.base_user import AbstractBaseUser from django.db import models from django.db.models import Manager class EqualizeMixin: equal_fields = () def __eq__(self, other): equal_fields = self._get_equal_fields() for field in equal_fields: if getattr(self, field) !...
nilq/baby-python
python
""" Cisco Intersight Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan...
nilq/baby-python
python
#!/usr/bin/env python3 # coding=utf8 """\ Our Standards Jill-Jênn Vie et Christoph Dürr - 2020 """ from sys import stdin def readint(): """ function to read an integer from stdin """ return int(stdin.readline()) def readstr(): """ function to read a string from stdin """ return stdin...
nilq/baby-python
python
import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go from ECAgent.Core import Model # Can be used to customize CSS of Visualizer external_stylesheets = ['https://rawgit.com/BrandonGower-Winter/ABMECS/master/Assets/VisualizerCustom.css', ...
nilq/baby-python
python
"""Test ``X-Forwarded-For`` middleware.""" from __future__ import annotations from ipaddress import _BaseNetwork, ip_network from typing import Dict, List, Optional import pytest from fastapi import FastAPI, Request from httpx import AsyncClient from safir.middleware.x_forwarded import XForwardedMiddleware def bu...
nilq/baby-python
python
# --------------------------------------------------------------------------- # MTDA Client # --------------------------------------------------------------------------- # # This software is a part of MTDA. # Copyright (c) Mentor, a Siemens business, 2017-2020 # # -------------------------------------------------------...
nilq/baby-python
python
"""Standard modules""" import sys import numpy as np import ldp import matplotlib.pyplot as plt class SimMesh(object): def __init__(self, mesh, neg, sep, pos): self.mesh = mesh self.neg = neg self.pos = pos self.sep = sep class SimData(object): def __init__(self, ce, cse, phi...
nilq/baby-python
python
# -*- coding: utf-8 -*- #""" # Created on Mon Oct 28 15:12:43 2013 # #@author: laure # # BROKEN : Doesn't work ########################## #""" # import sys # # import soma_workflow.constants as constants # from soma_workflow.test.job_tests.job_tests import JobTests # from soma_workflow.configuration import LIGHT_MODE ...
nilq/baby-python
python
from matplotlib import colors import matplotlib.pyplot as plt from copy import deepcopy import numpy as np import matplotlib.gridspec as gridspec from scipy.interpolate import interp1d class TrianglePlot(object): _default_contour_colors = [(colors.cnames['darkslategrey'], colors.cnames['black'], 'k'), ...
nilq/baby-python
python
from django.apps import AppConfig class CoinapiConfig(AppConfig): name = 'coinapi'
nilq/baby-python
python
import os import torch import numpy as np import torch.nn as nn # import torch.nn.functional as F import torch.distributed as dist import datetime import pandas as pd from asyncfeddr.utils.models import SimpleNetMNIST, SimpleNetFEMNIST from asyncfeddr.utils.serialization import ravel_model_params, unravel_model_param...
nilq/baby-python
python
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
nilq/baby-python
python
"""Utility functions for commissioning tests.""" # STDLIB import os import sys from collections import Iterable # THIRD-PARTY import numpy as np import pytest from numpy.testing import assert_allclose # ASTROLIB try: import pysynphot as S from pysynphot.spparser import parse_spec as old_parse_spec except Imp...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Thu Nov 28 19:11:30 2019 @author: wenbin """ """ 实现一个数据结构,使其具有以下方法:压栈,弹栈,取栈顶元素,判断栈是否为空以及获取栈中元素个数. 链表实现stack """ class LNode: def __init__(self , x = 0 , y = None): self.Data = x self.Next = y class MyStack: def __init__(self): ...
nilq/baby-python
python
# Digitar algorithm for plucked-string synthesis # Demo with "Frere Jacques" # Abe Karplus, 2016 import wave import array sampling = 48e3 # Hz bpm = 100 notenames = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11} def notepitch(n): step = notenames[n[0]] octind = 2 if n[1] == '#': step +...
nilq/baby-python
python
from django.test import SimpleTestCase from corehq.apps.app_manager.xpath import ( CaseSelectionXPath, CaseTypeXpath, LedgerdbXpath, XPath, ) class XPathTest(SimpleTestCase): def test_paren(self): xp = XPath('/data/q1') self.assertEqual('/data/q1', xp.paren()) self.assert...
nilq/baby-python
python
__version__ = "1.2.0" from .utils import drawLandmark_multiple, detection_adapter, bbox_from_pts, Aligner from .fast_alignment import * from .face_detection import * from .face_reconstruction import *
nilq/baby-python
python
import unittest class TestTransition(unittest.TestCase): @unittest.skip("") def test___init__(self): # transition = Transition(type_, element, nuclear_charge, charge, wavelength, temperature, density, pec) assert False # TODO: implement your test here @unittest.skip("") def test_energy...
nilq/baby-python
python
from django.test import TestCase from meadow.models import Book from meadow.tests.factories.book import BookFactory from meadow.utils.book_searcher import book_preview, search_by_title class BookPreviewTestCase(TestCase): def test_book_preview_book_exists(self): some_book = BookFactory() result ...
nilq/baby-python
python
def f(): pass a = f() b = f() c = f() str
nilq/baby-python
python
from itertools import islice from queue import Queue from typing import Iterator import numpy as np def limited_queue_iterator(queue: Queue, max_num_elements: int) -> Iterator: """Construct an iterator from a queue. The iterator will stop after max_num_elements.""" for _ in range(max_num_elements): y...
nilq/baby-python
python
""" This module illustrates code that accepts a single integer, a character, and an uppercase flag as positional arguments and print this character 'n' amount of times. If the uppercase flag is set to true, it prints uppercased. """ import argparse def main(character, number): print (character * number) if __name...
nilq/baby-python
python
""" Export module """ import os import os.path import sqlite3 import sys import regex as re # pylint: disable=E0611 # Defined at runtime from .index import Index class Export: """ Exports database rows into a text file line-by-line. """ @staticmethod def stream(dbfile, output): """ ...
nilq/baby-python
python
#!/usr/bin/env python import argparse import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional try: import comet_ml use_tensorboard = False except ImportError: use_tensorboard = True import datasets import numpy as np import torch import tran...
nilq/baby-python
python
import os import shutil import tempfile import ply.yacc as yacc import sympy from . import _node as node from ._qasmerror import QasmError from ._qasmlexer import QasmLexer class QasmParser(object): pass def __init__(self, filename): pass def __enter__(self): pass def __exit__(...
nilq/baby-python
python
from django.db import DatabaseError from django.test import TestCase from app.models import BigInteger class BigIntegerTests(TestCase): def setUp(self): self.int0_id = BigInteger.objects.create(big_integer=0).id self.int1_id = BigInteger.objects.create(big_integer=1111).id def test_create_in...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'burndown.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_CWidgetBurndown(object): def setupUi(self, CWidgetBurndown): ...
nilq/baby-python
python
import unittest from mock import MagicMock from abeja.datasets.dataset import Dataset, Datasets from abeja.datasets.dataset_item import DatasetItems class TestDataset(unittest.TestCase): def setUp(self): self.organization_id = '1234567890120' self.dataset_id = '1234567890121' self.datase...
nilq/baby-python
python
model.add(Dense(total_words, activation='softmax'))
nilq/baby-python
python
from django.urls import path, include from snippets import views from rest_framework.urlpatterns import format_suffix_patterns urlpatterns = [ path('pure/snippets/', views.pure_snippet_list), path('pure/snippets/<int:pk>/', views.pure_snippet_detail), path('func/snippets/', views.func_api_view_snippet_lis...
nilq/baby-python
python
import logging import sys from pathlib import Path import yaml def get_version() -> str: """Checks _version.py or build metadata for package version. Returns: str: Version string. """ try: from ._version import version return version except ModuleNotFoundError: ...
nilq/baby-python
python
from discord.ext import commands import asyncio import discord class Vcwhite(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_voice_state_update(self, member, before, after): #通知の対象としたいチャンネルidを入力 allow_01 = self.bot.get_chann...
nilq/baby-python
python
import unittest from biolinkml.generators.pythongen import PythonGenerator from tests.test_issues.environment import env from tests.utils.python_comparator import validate_python class Issue39UnitTest(unittest.TestCase): @unittest.skip("issue_38.yaml clinical profile conflicts with latest Biolink Model") de...
nilq/baby-python
python
# Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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 a...
nilq/baby-python
python
"""Module for representing, moving, shifting, stretching plotting and otherwise manipulating line segments in a convenient fashion. Caleb Levy, 2015. """ import numpy as np from .coordinates import Point, Coordinates __all__ = ["Line"] def parabola(sep, h, cut_short=0., n=100): """ Return the array of x + 1j*...
nilq/baby-python
python
from django.db import models from newsroom.models import Article from filebrowser.fields import FileBrowseField from .common import SCHEDULE_RESULTS # Create your models here. class TwitterHandle(models.Model): name = models.CharField(max_length=200, unique=True) slug = models.SlugField(max_length=200, uniqu...
nilq/baby-python
python
import pytest import numpy as np from funkyAD.helpers import count_recursive, unpack, nodify, recursive_append from funkyAD.base import Node def test_count_recursive_nparray(): x = np.array([2,3,1,0]) assert count_recursive(x)==4 def test_count_recursive_list(): x = [1,2,3] assert count_recursive(x)=...
nilq/baby-python
python
# Copyright (c) 2018 Stefan Marr <http://www.stefan-marr.de/> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, mo...
nilq/baby-python
python
#Crear una carpeta que se llame clases y adentro poner los$ # archivos dino.py persona.py # Crear una clase Persona() que tenga como atributos nombre, edad # y profesion. Al instanciar la clase tiene que saludar igual que el # dino diciendo sus atributos # Agregar un metodo a la clase persona, que se llame cumpleanh...
nilq/baby-python
python
import re class ReDict(dict): """ Special dictionary which expects values to be *set* with regular expressions (REs) as keys, and expects values to be retreived using input text for an RE as keys. The value corresponding to the regular expression which matches the input text will be returned. In th...
nilq/baby-python
python
# The MIT License (MIT) # # Copyright (c) 2018 UMONS # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, m...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 12 13:34:49 2020 @author: lukepinkel """ import numba import numpy as np import scipy as sp import scipy.special SQRT2 = np.sqrt(2) ROOT2PI = np.sqrt(2.0 * np.pi) def poisson_logp(x, mu, logp=True): p = sp.special.xlogy(x, mu) - sp.special.gam...
nilq/baby-python
python
# -*- coding: utf-8 -*- import json import os import sys import codecs import io import logging logging.basicConfig( filename='2_error.log', filemode='w', level='INFO', format='[%(levelname)s] %(asctime)s: %(message)s' ) asset_folder = 'assets' def cmd(line): return ' '+line def print_console(...
nilq/baby-python
python
""" Configuration file for https://github.com/karlicoss/HPI/ https://github.com/seanbreckenridge/HPI/ [Human Programming Interface] """ import sys import tempfile from os import environ, path, listdir from typing import Optional, Callable, List, Sequence from pathlib import Path from my.core.common import PathIsh, Pa...
nilq/baby-python
python
# DExTer : Debugging Experience Tester # ~~~~~~ ~ ~~ ~ ~~ # # Copyright (c) 2018 by SN Systems Ltd., Sony Interactive Entertainment Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # ...
nilq/baby-python
python
from krogon.config import Config from datetime import datetime from datetime import timedelta import krogon.yaml as yaml import krogon.either as E from base64 import b64decode import json import re from krogon.k8s.providers.k8s_provider import K8sProvider class GKEProvider(K8sProvider): def __init__(self, ...
nilq/baby-python
python
# INTEL CONFIDENTIAL # # Copyright (C) 2021 Intel Corporation # # This software and the related documents are Intel copyrighted materials, and # your use of them is governed by the express license under which they were provided to # you ("License"). Unless the License provides otherwise, you may not use, modify, copy, ...
nilq/baby-python
python
from typing import Optional from django.utils.crypto import get_random_string from django.db import transaction from rest_framework_simplejwt.tokens import RefreshToken from treeckle.common.constants import REFRESH, ACCESS, TOKENS, USER from users.models import User, UserInvite from users.logic import requester_to_...
nilq/baby-python
python
#!/home/jepoy/anaconda3/bin/python ## at terminal which python import platform print("This is python version {}".format(platform.python_version()))
nilq/baby-python
python
"""Test the interactive test runner.""" import six if six.PY2: import mock else: from unittest import mock import pytest from testplan import defaults from testplan import report from testplan import runners from testplan import runnable from testplan.common import entity from testplan.testing import filteri...
nilq/baby-python
python