content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
def fib(n): if (n==0): return 0 elif (n==1): return 1 else: x = fib(n-1) + fib(n-2) return x print(fib(6))
nilq/baby-python
python
#!/usr/bin/python from hashlib import sha1 from subprocess import check_output import hmac import json import os import sys # Due to |hmac.compare_digest| is new in python 2.7.7, in order to be # compatible with other 2.7.x version, we use a similar implementation of # |compare_digest| to the Python implementation....
nilq/baby-python
python
import os from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = 'ix4hnvelil^q36!(bg#)_+q=vkf4yk)@bh64&0qc2z*zy5^kdz' DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'user', 'job', 'ckeditor', 'django_filters', 'widget_tweaks', 'django.contrib.admin', ...
nilq/baby-python
python
import io import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import time class Analyzer: '''Controls plotting of different object properties''' def __init__(self): self.plot_number = 1 self.xdata = [] self.reactors = [] self.reactor_numbe...
nilq/baby-python
python
from ..gl import AGLObject, GLHelper from ...debugging import Debug, LogLevel from ...constants import _NP_UBYTE from ...autoslot import Slots from OpenGL import GL import numpy as np import time class TextureData(Slots): __slots__ = ("__weakref__", ) def __init__(self, width: int, height: int): self.width: int ...
nilq/baby-python
python
# This is a work in progress - see Demos/win32gui_menu.py # win32gui_struct.py - helpers for working with various win32gui structures. # As win32gui is "light-weight", it does not define objects for all possible # win32 structures - in general, "buffer" objects are passed around - it is # the callers responsibility to...
nilq/baby-python
python
import numpy as np from numba import njit @njit def linspace(x1,x2,n): ''' Jit compiled version of numpy.linspace(). ''' x = np.zeros(n) x[0] = x1 x[-1] = x2 for i in range(1,n-1): x[i] = x[0] + i*(x2-x1)/(n-1) return x @njit def trapezoid(x,y): ''' Jit compiled versio...
nilq/baby-python
python
from setuptools import setup, find_packages setup( name='k8sfoams', version='1.0.2', long_description=open('README.md').read(), long_description_content_type='text/markdown', url='https://github.com/mmpyro/k8s-pod-foamtree', description='K8s pod foamtree visualizer', author="Michal Marszale...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Andreas Bunkahle # Copyright (c) 2019 Bohdan Horbeshko # # 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 th...
nilq/baby-python
python
import threading import datetime from elasticsearch import Elasticsearch from elasticsearch.helpers import scan import pandas as pd import numpy as np import time from functools import reduce import dash import dash_core_components as dcc import dash_bootstrap_components as dbc from dash.dependencies import Input, Ou...
nilq/baby-python
python
largura = float(input('Qual a largura da parede? ')) altura = float(input('Qual a altura da parede? ')) area = largura*altura qtd_tinta = area/2 print(qtd_tinta)
nilq/baby-python
python
import os from unittest.mock import call import numpy as np import pytest import sparse from histolab.slide import Slide from histolab.tiler import RandomTiler, Tiler from histolab.types import CoordinatePair from ..unitutil import ( ANY, PILImageMock, SparseArrayMock, function_mock, initializer_...
nilq/baby-python
python
import numpy as np import pandas as pd import talib as ta from cryptotrader.utils import safe_div def price_relative(obs, period=1): prices = obs.xs('open', level=1, axis=1).astype(np.float64) price_relative = prices.apply(ta.ROCR, timeperiod=period, raw=True).fillna(1.0) return price_relative def momen...
nilq/baby-python
python
""" @author : Krypton Byte """ import requests def igdownload(url): req=requests.get(url, params={"__a":1}) if ('graphql' in req.text): media=req.json()["graphql"]["shortcode_media"] if media.get("is_video"): return {"status": True,"result":[{"type":"video", "url":media["video_url"]}...
nilq/baby-python
python
import requests from bs4 import BeautifulSoup #https://en.wikipedia.org/wiki/List_of_companies_operating_trains_in_the_United_Kingdom def main(): urlList = ['https://twitter.com/ScotRail','https://twitter.com/LDNOverground','https://twitter.com/AvantiWestCoast','https://twitter.com/c2c_Rail','https://twitte...
nilq/baby-python
python
# coding: utf-8 nms = ['void', 'Front bumper skin', 'Rear bumper skin', 'Front bumper grille', 'network', 'Hood', 'Front fog lamp', 'Headlamp', 'Front windshield', 'Roof panel', 'Front fender', 'Rear fender', 'Front door shell outer plate', 'Rear door shell outer plate', 'Door glass front', 'Door glass rear', 'Rearvi...
nilq/baby-python
python
import httpretty from tests import FulcrumTestCase class MembershipTest(FulcrumTestCase): @httpretty.activate def test_search(self): httpretty.register_uri(httpretty.GET, self.api_root + '/memberships', body='{"memberships": [{"id": 1},{"id": 2}], "total_count": 2, "current_page": 1, "tot...
nilq/baby-python
python
import pytest from picorss.src.domain import entities @pytest.fixture() def rss_page() -> entities.RssPage: return entities.RssPage(url="https://example.com") def test_rss_page_has_url(rss_page: entities.RssPage) -> None: assert rss_page.url
nilq/baby-python
python
def process(self): self.edit("LATIN") self.replace("CAPITAL LETTER D WITH SMALL LETTER Z", "Dz") self.replace("CAPITAL LETTER DZ", "DZ") self.edit("AFRICAN", "african") self.edit("WITH LONG RIGHT LEG", "long", "right", "leg") self.edit('LETTER YR', "yr") self.edit("CAPITAL LETTER O WITH...
nilq/baby-python
python
#!/usr/bin/env python3 # Write a program that computes typical stats # Count, Min, Max, Mean, Std. Dev, Median # No, you cannot import the stats library! import sys import math units = [] #Create your list of integers/floating-point numnbers making sure to covert from strings for i in sys.argv[1:]: units.append(f...
nilq/baby-python
python
""" Copyright (c) 2014, Samsung Electronics Co.,Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions ...
nilq/baby-python
python
import os from config.config import get_config import shutil def main(): config = get_config() if not os.path.exists(config.dataset): print(f"[!] No dataset in {config.dataset}") return for image_transfer in os.listdir(config.dataset): print(image_transfer) if not '2' in ...
nilq/baby-python
python
''' Created on 2020-02-13 @author: wf ''' from flask import Flask from flask import render_template from flask import request from dgs.diagrams import Generators,Generator,Example import os from flask.helpers import send_from_directory import argparse import sys from pydevd_file_utils import setup_client_server_paths ...
nilq/baby-python
python
import boto3 import codecs import xmltodict import re class Example: '''Represents a single source line and all corresponding target lines we would like a Turker to evaluate. ''' def __init__(self, source_line, key): self.source_line = source_line # The single source line self.target_lines = [] # Lis...
nilq/baby-python
python
def inputMatrix(m,n, vektori = False): if vektori: border = "border-right: 2px solid black; border-left: 2px solid black; border-top: none; border-bottom: none;" else: border = "border: none;" tmp = "" tmp+= """ <div class="container"> <div style="border-left: ...
nilq/baby-python
python
from django.contrib import admin from .models import Trailer # Register your models here. admin.site.register(Trailer)
nilq/baby-python
python
from sklearn.datasets import load_breast_cancer dataset=load_breast_cancer() x=dataset.data y=dataset.target from sklearn.model_selection import train_test_split x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.2) from logistic_regression import LogisticRegression clf=LogisticRegression(lr=0.01,n_iters=10...
nilq/baby-python
python
# En este ejercicio se nos solicitó: # 1.- El retorno total y anualizado de tres stocks: SPY, VWO y QQQ entre 2015 y 2021 (ambos inclusive) # 2.- Graficar el retorno acumulado de los stocks indicados durante ese mismo período # Para ambos ejercicios se nos indicó que utilizáramos la free API key de Alpha Vantage impor...
nilq/baby-python
python
# Aula 13 (Estrutura de Repetição for) from time import sleep for c in range(10, -1, -1): print(c) sleep(1) print('BOOM!')
nilq/baby-python
python
# Collaborators: https://www.decodeschool.com/Python-Programming/Branching-Statements/Divisible-by-3-or-not-in-python#:~:text=Program%20Explanation,3%20using%20print()%20method. # for x in range (2, 51): if x % 3==0: print ("{} is divisible by 3".format(x)) else: print ("{} is not divisible b...
nilq/baby-python
python
import argparse import os from watermark_add_dct import do_singleRun_dct from watermark_add_dwt import do_singleRun_dwt from image_utils import encoding if __name__ == "__main__": parser = argparse.ArgumentParser(description="main") # general options parser.add_argument( "--inFolder", type...
nilq/baby-python
python
"""Filters that are used in jobfunnel's filter() method or as intermediate filters to reduce un-necessesary scraping Paul McInnis 2020 """ import logging from collections import namedtuple from copy import deepcopy from datetime import datetime from typing import Dict, List, Optional, Tuple import nltk import numpy as...
nilq/baby-python
python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .ctdet import CtdetTrainer from .exdet import ExdetTrainer train_factory = { 'exdet': ExdetTrainer, 'ctdet': CtdetTrainer, }
nilq/baby-python
python
p1 = int(input('digite o primeiro termo:')) r = int(input('digite a razõ da P.A')) d= p1 + (10-1) * r for c in range(p1-1,d,r): print(c)
nilq/baby-python
python
import factory import time import random from spaceone.core import utils class MetricFactory(factory.DictFactory): key = factory.LazyAttribute(lambda o: utils.generate_id('metric')) name = factory.LazyAttribute(lambda o: utils.random_string()) unit = { 'x': 'Datetime', 'y': 'Count' ...
nilq/baby-python
python
# Copyright © 2019 Province of British Columbia # # 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 agr...
nilq/baby-python
python
import lasagne from lasagne.regularization import regularize_network_params, l2, l1 import time import theano import numpy as np from theano.tensor import * import theano.tensor as T import gc import sys sys.setrecursionlimit(50000) #then import my own modules import seqHelper import lasagneModelsFingerprints #get m...
nilq/baby-python
python
"""Profile model.""" # Django from django.db import models # Utilities from feelit.utils.models import FeelitModel class Profile(FeelitModel): """ Profile model. Profile holds user's public data like bio, posts and stats. """ user = models.OneToOneField('users.User', on_delete=models.CASCADE) ...
nilq/baby-python
python
import re ncr_replacements = { 0x00: 0xFFFD, 0x0D: 0x000D, 0x80: 0x20AC, 0x81: 0x0081, 0x81: 0x0081, 0x82: 0x201A, 0x83: 0x0192, 0x84: 0x201E, 0x85: 0x2026, 0x86: 0x2020, 0x87: 0x2021, 0x88: 0x02C6, 0x89: 0x2030, 0x8A: 0x0160, 0x8B: 0x2039, 0x8C: 0x0152,...
nilq/baby-python
python
"""The Twinkly API client.""" import logging from typing import Any from aiohttp import ClientResponseError, ClientSession from .const import ( EP_BRIGHTNESS, EP_COLOR, EP_DEVICE_INFO, EP_LOGIN, EP_MODE, EP_TIMEOUT, EP_VERIFY, ) _LOGGER = logging.getLogger(__name__) class TwinklyClient:...
nilq/baby-python
python
"""add private column to group Revision ID: 9612aba86eb2 Revises: 789ac8c2844f Create Date: 2021-06-06 10:31:28.453405 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "9612aba86eb2" down_revision = "789ac8c2844f" branch_labels = None depends_on = None def upg...
nilq/baby-python
python
from stormberry.config import Config import signal import sys import stormberry.logging from stormberry.station import WeatherStation from stormberry.plugin import ISensorPlugin, IRepositoryPlugin, IDisplayPlugin, PluginDataManager from stormberry.plugin.manager import get_plugin_manager class SignalHandling(object):...
nilq/baby-python
python
from use_cases.encryption.makeEncryptString import * from use_cases.encryption.makeDecryptString import * from use_cases.encryption.makeCreateKeyPair import *
nilq/baby-python
python
# coding=utf-8 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------...
nilq/baby-python
python
import abc class Policy(object, metaclass=abc.ABCMeta): """ General policy interface. """ @abc.abstractmethod def get_action(self, observation): """ :param observation: :return: action, debug_dictionary """ pass def reset(self): pass class Ex...
nilq/baby-python
python
import os os.chdir("Python/Logging") # log_settings changes sys.excepthook to log_settings.log_exceptions, so # importing log_settings is sufficient to capture uncaught exceptions to the # log file, meanwhile they are also (still) printed to stdout import log_settings # adds 'Starting new program!' with timestamp to...
nilq/baby-python
python
class IBSException(Exception): pass #TODO: This doesn't make sense for negative numbers, should they even be allowed? class NumericValue(): """ To store a number which can be read to/from LE or BE """ def __init__(self, value): self.value = value @classmethod def FromLEBytes(cls, databytes...
nilq/baby-python
python
from pyrocko import automap import math import shutil from pyrocko import model, gmtpy from pyrocko.moment_tensor import magnitude_to_moment as mag2mom from pyrocko.moment_tensor import to6 from pyrocko.guts import Object, Float, String, List class ArrayMap(automap.Map): stations = List.T(model.Station.T(), optio...
nilq/baby-python
python
import sys import json from selenium import webdriver from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup class Fetcher: ''' The crawler class used for retrieving information from sodexo's menu page Note: Blitman Commons is not yet included in sodexo's page. The class should throw an ...
nilq/baby-python
python
import math def round_up(n, multiple): """ can be used to ensure that you have next multiple if you need an int, but have a float n = number to check multiple = number you'd like to round up to EX: num_ranks = 64 num_ios = 26252 this is not an even number if you divide returns t...
nilq/baby-python
python
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup # fetch values from package.xml setup_args = generate_distutils_setup( packages=["mushr_rhc_ros"], package_dir={"": "src"} ) setup(install_requires=["numpy"...
nilq/baby-python
python
# Copyright 2018 Google, Inc., # # 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 writin...
nilq/baby-python
python
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
nilq/baby-python
python
from nltk.stem.porter import PorterStemmer from nltk.tokenize import word_tokenize import random from tqdm import tqdm from summariser.ngram_vector.base import Sentence from summariser.ngram_vector.state_type import * from utils.data_helpers import * # from summariser.utils.data_helpers import * class Vectoriser: ...
nilq/baby-python
python
# coding: utf-8 # In[7]: import numpy as np #toy example of fixImages_stackocclusions #a = np.arange(16).reshape(4, 2, 2) #b = a + 2 #print("a") #print(a) #print(2*'\n') #print("b") #print(b) #print(2*'\n') #print("stack_axis = 0") #print(np.stack((a,b), axis=0)) #print(2*'\n') #print("stack_axis = 1") #print(np.s...
nilq/baby-python
python
# Copyright 2020 Antonio Macaluso # # 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 writ...
nilq/baby-python
python
# Generated by Django 3.0.3 on 2020-09-10 12:25 import django.contrib.gis.db.models.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sequence', '0026_sequence_coordinates_ele'), ] operations = [ migrations.AddField( mo...
nilq/baby-python
python
# -*- coding: utf-8 -*- """Query web services.""" import gzip import logging from ._bouth23 import bstream, s from ._exceptions import ISBNLibHTTPError, ISBNLibURLError from ..config import options # pylint: disable=import-error # pylint: disable=wrong-import-order # pylint: disable=no-name-in-module try: # pragma:...
nilq/baby-python
python
# Copyright 2014, Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain # rights in this software. """Functionality for managing scene graphs. Note that the scenegraph is an internal implementation detail for developers adding new functionalit...
nilq/baby-python
python
__all__ = ["analysis", "data", "geometry", "io", "util"]
nilq/baby-python
python
# coding: utf-8 # from tornado.web import RequestHandler from tornado.escape import json_decode class BaseRequestHandler(RequestHandler): pass class IndexHandler(BaseRequestHandler): def get(self): self.write("Hello ATX-Storage")
nilq/baby-python
python
import os from Crypto.Protocol.KDF import scrypt KEY_LENGTH = 32 N = 2**16 ##meant for ram R = 10 P = 10 import binascii import bcrypt from loguru import logger def generate_bcrypt(password): if isinstance(password, str): password = password.encode() hashed =bcrypt.hashpw(password, bcrypt.gensalt())...
nilq/baby-python
python
# -*- coding: utf-8 -*- from django.conf.urls import url from django.views.generic import TemplateView from . import views app_name = 'url_shorter' urlpatterns = [ url(r'user_url_list/', views.UserURLListView.as_view(), name="user_url_list"), url(r'user_url_create/', views.UserURLCreateView.as_view(), name="use...
nilq/baby-python
python
#!/usr/bin/python3 #coding=utf-8 """ A flask based server for calculating. @author: vincent cheung @file: server.py """ from flask import Flask,render_template,request,redirect,url_for from flask import send_file, Response import os import sys sys.path.append('../') from calculate import * app = Flask(__name__) @ap...
nilq/baby-python
python
if ((True and True) or (not True and True)) and \ (True or True): pass
nilq/baby-python
python
value = '382d817119a18844865d880255a8221d90601ad164e8a8e1dd8a48f45846152255f839e09ab176154244faa95513d16e5e314078a97fdb8bb6da8d5615225695225674a4001a9177fb112277c45e17f85753c504d7187ed3cd43b107803827e09502559bf164292affe8aaa8e88ac898f9447119a188448692070056a2628864e6d7105edc5866b9b9b6ebcad6dc3982952a7674a62015025695225...
nilq/baby-python
python
from taichi.misc.util import * from taichi.two_d import * from taichi import get_asset_path if __name__ == '__main__': scale = 8 res = (80 * scale, 40 * scale) async = True if async: simulator = MPMSimulator( res=res, simulation_time=30, frame_dt=1e-1, base_delta_t=1e-6, ...
nilq/baby-python
python
#!/usr/bin/python # -*- coding: utf-8 -*- import sqlite3 as lite import sys con = lite.connect('Database.db') with con: cur = con.cursor() #Create data for the user table cur.execute("CREATE TABLE users(UserId INT, UserName TEXT, Password TEXT)") cur.execute("INSERT INTO users VALUES(1,'Adm...
nilq/baby-python
python
import itertools import logging import os.path import sys import time import click import pychromecast from pychromecast.error import PyChromecastError import pylast import toml logger = logging.getLogger(__name__) # Default set of apps to scrobble from. APP_WHITELIST = ['Spotify', 'Google Play Music', 'SoundCloud'...
nilq/baby-python
python
from this_is_a_package import a_module a_module.say_hello("ITC")
nilq/baby-python
python
# coding: utf-8 """ CMS Audit Logs Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. # noqa: E501 The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from hubspot.cms.a...
nilq/baby-python
python
import numpy as np import time # Number of random numbers to be generated nran = 1024 # Generate a random number from the normal distribution result = [np.random.bytes(nran*nran) for x in range(nran)] print(len(result), "======>>> random numbers") # Wait for tsleep seconds tsleep = 40 print("I am sleeping for {...
nilq/baby-python
python
# Example of using StagingAreaCallback for GPU prefetch on a simple convnet # model on CIFAR10 dataset. # # https://gist.github.com/bzamecnik/b9dbd50cdc195d54513cd2f9dfb7e21b import math from keras.layers import Dense, Input, Conv2D, MaxPooling2D, Dropout, Flatten from keras.models import Model from keras.utils impor...
nilq/baby-python
python
from requests import get READ_SUCCESS_CODE = 200 class ConfigurationGateway(object): def __init__(self, url, executables_path, repositories_path, results_key): self.url = url self.executables_path = executables_path self.repositories_path = repositories_path self.results_key = r...
nilq/baby-python
python
# !/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals # -------------------------------------------# # author: sean lee # # email: xmlee97@gmail.com # #--------------------------------------------# """MIT License Copyright ...
nilq/baby-python
python
import flask class RequestDictionary(dict): def __init__(self, *args, default_val=None, **kwargs): self.default_val = default_val super().__init__(*args, **kwargs) def __getattr__(self, key): # Enable rd.key shorthand for rd.get('key') or rd['key'] return self.get(key, self.de...
nilq/baby-python
python
# library import pandas as pd import matplotlib.pyplot as plt import datetime import gif import seaborn as sns import warnings warnings.filterwarnings("ignore") # 関数化する ## git.frameデコレターを使用する @gif.frame def my_plot(df, date, x_min, x_max, y_min, y_max): # 可視化するデータ d = df[df["date"] <= date] ...
nilq/baby-python
python
from collections import defaultdict from collections.abc import MutableMapping from copy import deepcopy from pathlib import Path from typing import (Any, Dict, List, Literal, Mapping, NamedTuple, Sequence, Tuple, Union) import yaml from more_itertools import unique_everseen from .md import merge_...
nilq/baby-python
python
from secml.array.tests import CArrayTestCases import numpy as np import copy from secml.array import CArray from secml.core.constants import inf class TestCArrayUtilsDataAlteration(CArrayTestCases): """Unit test for CArray UTILS - DATA ALTERATION methods.""" def test_round(self): """Test for CArray...
nilq/baby-python
python
from setuptools import setup setup( name='__dummy_package', version='0.0.0', install_requires=['html-linter==0.1.9'], )
nilq/baby-python
python
import json, glob FILES = glob.glob('download/*/*/*/*.json') good = {} dups = 0 total = 0 for f in FILES: with open(f, 'r') as fi: j = json.load(fi) for post in j['data']['children']: i = post['data']['id'] if i == '4hsh42': continue if i not in good: good[i] = post with...
nilq/baby-python
python
import torch import matplotlib.pyplot as plt import imageio import numpy as np # Create data, 100 points evenly distributed from -2 to 2 # Use unsqueeze to add one more dimension, torch needs at least 2D input (batch, data) x = torch.unsqueeze(torch.linspace(-2,2,100), dim=1) # y = x^2 + b y = x.pow(2) + 0.5 * torch....
nilq/baby-python
python
import logging import re import nltk from django.utils.text import slugify from oldp.apps.backend.processing import ProcessingError, AmbiguousReferenceError from oldp.apps.cases.models import Case from oldp.apps.cases.processing.processing_steps import CaseProcessingStep from oldp.apps.laws.models import LawBook from...
nilq/baby-python
python
num = int(input("Digite um número inteiro de 0 a 9999: ")) u = num // 1 % 10 d = num // 10 % 10 c = num // 100 % 10 m = num // 1000 % 10 print(f"O numero {num} possui {u} unidades.") print(f"O numero{num} possui {d} dezenas.") print(f"O numero{num} possui {c} centenas.") print(f"O numero{num} possui {m} milhares.")
nilq/baby-python
python
facts=[ 'Mumbai was earlier known as Bombay.', 'Mumbai got its name from a popular goddess temple - Mumba Devi Mandir, which is situated at Bori Bunder in Mumbai.', 'On 16 April 1853, Mumbai witnessed the first train movement in India. \ With 14 carriages and 400 passengers, the first train left Bori Bunder, now called...
nilq/baby-python
python
# Copyright (c) ZenML GmbH 2021. 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 applica...
nilq/baby-python
python
import os SQLALCHEMY_DATABASE_URI = os.environ.get('FLASK_DATABASE_URI', 'postgres://user:pass@host/db') SQLALCHEMY_ENGINE_OPTIONS = {'pool_pre_ping':True} SQLALCHEMY_TRACK_MODIFICATIONS = False SECRET_KEY = b'\xb0\xe2\x16\x16\x15\x16\x16\x16'
nilq/baby-python
python
# Copyright (c) 2014, 2020, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # # This program is also distributed with certain software (including # ...
nilq/baby-python
python
from target import TargetType import os import re import cv2 import time import subprocess import numpy as np TARGET_DIR = './assets/' TMP_DIR = './tmp/' SIMILAR = { '1': ['i', 'I', 'l', '|', ':', '!', '/', '\\'], '2': ['z', 'Z'], '3': [], '4': [], '5': ['s', 'S'], '6': [], '7': [], '8...
nilq/baby-python
python
from horse import Horse import random import os money = 100 colours = [ "red", "blue", "yellow", "pink", "orange", ] def race_horses(horses): return random.choice(horses) while money > 0: print(f"Welcome to the race! You have £{money:.2f}. Your horses are: ") horses = [Horse.rando...
nilq/baby-python
python
""" Django settings for sandbox project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
nilq/baby-python
python
from django.contrib.auth import password_validation, get_user_model from rest_framework import serializers from rest_framework.generics import get_object_or_404 from rest_framework.exceptions import ValidationError from rest_framework.validators import UniqueValidator from rest_framework_simplejwt.exceptions import In...
nilq/baby-python
python
import math import cmath import cairo from random import randint IMAGE_SIZE = (5000, 5000) NUM_SUBDIVISIONS = 6 def chooseRatio(): return randint(0, 6) colors = [(1.0, 0.35, 0.35), (0.4, 0.4, 1.0), (0.1, 1.0, 0.2), (0.7, 0.1, 0.8)] def chooseColor(): return colors[randint(0, len(colors) - 1)] Ratio = chooseRat...
nilq/baby-python
python
from preprocess.load_data.data_loader import load_hotel_reserve customer_tb, hotel_tb, reserve_tb = load_hotel_reserve() # 本书刊登内容如下 # 将iloc函数二维数组的第一维度指定为“:”,提取所有行 # 将iloc函数二维数组的第二维度指定为由列号组成的数组,提取相应的列 # 0:6和[0, 1, 2, 3, 4, 5]表示相同的意思 reserve_tb.iloc[:, 0:6]
nilq/baby-python
python
""" @authors: # ============================================================================= Information: The purpose of this script is to serve as the main code for the user. Use the user's guide that still has not been written to find out how to use this tool. Use your python skills to understand...
nilq/baby-python
python
from django.conf.urls import url, include #from django.contrib import admin #from django.urls import path from usuario.views import registar_usuario,editar_usuario,eliminar_usuario app_name = 'usuario' urlpatterns = [ url(r'^nuevo$',registar_usuario.as_view() , name="new"), url(r'^edit_book/(?P<pk>\d+)/$',edita...
nilq/baby-python
python
from hashlib import md5 from app import app, db import sys if sys.version_info >= (3, 0): enable_search = False else: enable_search = True import flask_whooshalchemy as whooshalchemy # This is a direct translation of the association table. # use the lower level APIs in flask-sqlalchemy to create the table without...
nilq/baby-python
python
import numpy as np import pickle from collections import defaultdict import spacy from spacy.symbols import nsubj, VERB from models import load_models, generate import argparse import torch nlp = spacy.load("en") def get_subj_verb(sent): "Given a parsed sentence, find subject, verb, and subject modifiers." s...
nilq/baby-python
python
# HTTP Error Code # imported necessary library import tkinter from tkinter import * import tkinter as tk import tkinter.messagebox as mbox import json # created main window window = Tk() window.geometry("1000x700") window.title("HTTP Error Code") # ------------------ this is for adding gif image in the main window ...
nilq/baby-python
python
is_all_upper = lambda t: t.isupper()
nilq/baby-python
python