content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
[ { 'inputs': ['formula'], 'output': 'Property Band gap' }, { 'inputs': ['formula', 'Temperature (Property Band gap)'], 'output': 'Property Band gap' }, { 'inputs': ['formula'], 'output': 'Property Color' },{ 'inputs': ['formula', 'Property Band ga...
nilq/baby-python
python
#-*- encoding:utf-8 -*- import json import unittest import responses try: from unittest import mock except: import mock from nta import ( NaverTalkApi ) from nta.models import( CompositeContent, Composite, ElementData, ElementList, ButtonText, ButtonLink, ButtonCalendar, QuickReply ) class TestN...
nilq/baby-python
python
from flask import Flask, request, Response import requests, json app = Flask(__name__) @app.route('/webhook', methods=["POST"]) def webhook(): print("Request received!") print(request.json); return relay(request.json) def relay(data): print("Relaying Request with data :" + json.dumps(data...
nilq/baby-python
python
import unittest.mock as mock from mtsync.action import ActionKind from mtsync.connection import Connection from mtsync.imagined import Imagined from mtsync.settings import Settings from mtsync.synchronizer import Synchronizer from rich.console import Console from testslide import StrictMock from testslide.dsl import c...
nilq/baby-python
python
# Generated by Django 2.0.2 on 2018-08-15 16:17 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wagtailcore', '0040_page_draft_title'), ('pymba', '0006_auto_20180316_1857'), ] operations = [ migr...
nilq/baby-python
python
''' This script has functions in it which are used in network which evaluate images. If this script here is run it returns the object_dc-score of each segmented object by the predicition with respect to the groundtruth ''' import os import skimage import scipy import numpy as np import matplotlib.pyplot as plt ######...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Wed Jan 13 06:41:54 2016 @author: piotr at nicecircuits.com """ from libraryManager.library import libraryClass from libraryManager.part import part from footprints.footprintSmdQuad import footprintQfp from footprints.footprintSmdDualRow import footprintTssop from libraryManager...
nilq/baby-python
python
''' Pattern: Enter the number of rows: 5 A A B A A B C A B A B C D A B C A B C D E A B C D ''' print('Alphabet Pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(1,number_rows+1): print(' '*(number_rows-row),end=' ') for column in range(1,row+1): pri...
nilq/baby-python
python
disliked_ids = { "items" : [ { "track" : { "album" : { "name" : "W Hotel (feat. Smokepurpp, Blueface)" }, "id" : "3Ap32KanuR59wfKcs9j2pb", "name" : "W Hotel (feat. Smokepurpp, Blueface)" } }, { "track" : { "album" : { "name" : "Me Molesta" }, "id...
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
#! /usr/bin/python import sys import os import sqlite3 import datetime import threading import Queue class SQLiteThread(threading.Thread): def __init__(self, config, logger): threading.Thread.__init__(self) self.setDaemon(True) self.filename = config.get_setting("sqlite_filename", "") ...
nilq/baby-python
python
""" Unit tests for our validators """ from dbas.database.discussion_model import ReviewDelete from dbas.tests.utils import TestCaseWithConfig, construct_dummy_request from dbas.validators.core import has_keywords_in_json_path, spec_keyword_in_json_body from dbas.validators.reviews import valid_not_executed_review cl...
nilq/baby-python
python
#!/usr/bin/python import pymysql import config def add_feedback(email,f_text): conn,cursor=config.connect_to_database() sql="insert into feedbacks(email,f_text) values('%s','%s')"%(email,f_text); try: cursor.execute(sql) conn.commit() return "11" except: conn.rollback() return "0" def check_same_feedback...
nilq/baby-python
python
import unittest from point import Point class PointTests(unittest.TestCase): """Tests for Point.""" def test_attributes(self): point = Point(1, 2, 3) self.assertEqual((point.x, point.y, point.z), (1, 2, 3)) point.x = 4 self.assertEqual(point.x, 4) def test_string_repres...
nilq/baby-python
python
from bigchaindb_driver import BigchainDB from bigchaindb_driver.crypto import generate_keypair from time import sleep from sys import exit def asset_creation(farmer, tomatos, tomatos_metadata, bdb): prepare_cr_tx = bdb.transactions.prepare( operation = 'CREATE', signers = farmer.public_key, asset = tomatos, ...
nilq/baby-python
python
from __future__ import print_function from memorytestgame.lib.game import Game import time import unittest class GameTestCase(unittest.TestCase): LEDS = () SWITCHES = () COUNTDOWN = 0 GAME_TIME = 0 SCORE_INCREMENT = 1 game = None def setUp(self): self.game = Game(self.LEDS, s...
nilq/baby-python
python
""" Otrzymujesz liste liczb oraz liczbe n. Lista reprezentuje ceny sznurka o dlugosci rownej indeksowi powiekszonemu o 1. Zaleznosc miedzy cenami i dlugoscia sznurka jest przypadkowa. Przykladowo sznurek o dlugosci rownej 2 jednostkom moze kosztowac tyle samo co sznurek o dlugosci rownej 3 jednostkom i byc piec razy dr...
nilq/baby-python
python
# PhotoBot 0.8 beta - last updated for NodeBox 1rc4 # Author: Tom De Smedt <tomdesmedt@trapdoor.be> # Manual: http://nodebox.net/code/index.php/PhotoBot # Copyright (c) 2006 by Tom De Smedt. # Refer to the "Use" section on http://nodebox.net/code/index.php/Use from __future__ import print_function ALL = ['canvas', '...
nilq/baby-python
python
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
nilq/baby-python
python
# =============================================================================== # # # # This file has been generated automatically!! Do not change this manually! # # ...
nilq/baby-python
python
from ..container import container from ..parallel import rank0_obj import logging logger: logging.Logger = rank0_obj(container.get(logging.Logger)) # logger: logging.Logger = container.get(logging.Logger)
nilq/baby-python
python
from django.contrib import admin from personal.models import ToDo from .to_do import ToDoAdmin admin.site.register(ToDo, ToDoAdmin)
nilq/baby-python
python
from swagger_server.models.beacon_concept import BeaconConcept # noqa: E501 from swagger_server.models.beacon_concept_with_details import BeaconConceptWithDetails # noqa: E501 from swagger_server.models.beacon_concept_detail import BeaconConceptDetail from swagger_server.models.exact_match_response import ExactMatchR...
nilq/baby-python
python
import pyautogui as pt import pyperclip as pc from pynput.mouse import Controller, Button from time import sleep from whatsapp_responses import response #Mause click workaround for MAc os mouse = Controller() #Instruction for our whatsapp Bot class WhatsApp: #define the starting values def __init__(self, sp...
nilq/baby-python
python
import json import logging import os import uuid from datetime import datetime, timedelta import boto3 import telegram from telegram import InlineKeyboardMarkup, InlineKeyboardButton logger = logging.getLogger() if logger.handlers: for handler in logger.handlers: logger.removeHandler(handler) logging.basic...
nilq/baby-python
python
import pandas as pd from IPython import embed import sys if __name__ == '__main__': if len(sys.argv) < 2: print('please input params: <tnse.csv> file') exit(1) path = sys.argv[1] df = pd.read_csv(path) filtered_df = [] i=0 for idx, r in df.iterrows(): if(r['domain']=='a...
nilq/baby-python
python
class TimePattern(object): def __str__(self): raise NotImplementedError('Please implement __str__ function') class SimpleTimer(TimePattern): def __init__(self, seconds=0, minutes=0, hours=0): self.seconds = seconds self.minutes = minutes self.hours = hours def __str__(se...
nilq/baby-python
python
from setuptools import setup, find_packages setup( name = "cascade", version = "0.1", packages = find_packages(), install_requires = ['progressbar', 'imaplib2'], author = "Oz Akan", author_email = "code@akan.me", description = "Cascade copies e-mails between IMAP servers", license = "Ap...
nilq/baby-python
python
# Fichier permettant de moduler les differentes methodes de clustering try: # Import generaux import numpy as np import pylab import sys import platform import matplotlib.pyplot as plt import re # Import locaux import kmeans import rkde except: exit(1) ...
nilq/baby-python
python
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, PasswordField from wtforms import HiddenField, TextAreaField, FileField, SubmitField from wtforms.validators import DataRequired, NumberRange ATTR_DATA = 'data' ATTR_ACTION = 'action' ATTR_MANAGER = 'manager' ATTR_KEY_LEN = 'length' ATTR_K...
nilq/baby-python
python
# coding=utf-8 import random from common import constant from common import errcode from dao.sms.sms_dao import SmsDao from handlers.base.base_handler import BaseHandler from mycelery.tasks import send_sms_task class SmsChangePhoneHandler(BaseHandler): methods = ['POST'] def __init__(self): expect_r...
nilq/baby-python
python
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ l1_unlinked = [] ...
nilq/baby-python
python
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/labelbox/1_CocoExporter.ipynb (unless otherwise specified). __all__ = ['UnknownFormatError', 'coco_from_json', 'make_coco_metadata', 'add_label', 'append_polygons_as_annotations', 'label_to_polygons', 'LOGGER'] # Cell """ Module for converting labelbox....
nilq/baby-python
python
# Copyright 2020 Makani Technologies 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...
nilq/baby-python
python
""" authentication/views.py Created on Oct. 23, 2017 by Jiayao """ from __future__ import (absolute_import) from django.shortcuts import render from django.http import HttpResponseRedirect from django.urls import reverse from django.views import generic from django.contrib.auth import (authenticate, login, logout) fro...
nilq/baby-python
python
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ a,b,c,d=[int(input())for _ in[0]*4] print('10'[a!=d or (a<1 and d<1 and c>0)])
nilq/baby-python
python
from flask import Blueprint from flask import Response from flask import abort from flask import g from flask import jsonify from flask import request from flask import current_app from gleague.api import admin_required from gleague.api import login_required from gleague.core import db from gleague.models import Match...
nilq/baby-python
python
# Notes: copied inspect.py, dis.py, and opcodes.py into Jython dir (replacing stub inspect.py) # Opcode will not work as using JVM, but required by dis.py, which was required by inspect.py # only want functionality of getting source lines. # Also copied textwrap.py? # support for using tk import java.io from java.lang...
nilq/baby-python
python
from selenium.webdriver.support.ui import Select class ContactHelper: def __init__(self, app): self.app = app def open_contact_page(self): wd = self.app.wd if not (wd.find_element_by_title("Search for any text") and wd.find_element_by_name("add")): wd.find_element_by_link_...
nilq/baby-python
python
def XXX(self, root: TreeNode) -> int: if root is None: return 0 m = 10 ** 5 # m为最小深度 def bfs(d, node): nonlocal m if node.left is None and node.right is None: m = min(m, d) return bfs(d + 1, node.left) if node.left else None bfs(d + 1, node.r...
nilq/baby-python
python
# Copyright 2022 The Balsa Authors. # # 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 wr...
nilq/baby-python
python
#!/usr/bin/python # Copyright 2017 Telstra Open Source # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
nilq/baby-python
python
# Copyright 2020 University of Groningen # # 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 i...
nilq/baby-python
python
import pandas as pd from koapy import KiwoomOpenApiContext from koapy.backend.cybos.CybosPlusComObject import CybosPlusComObject kiwoom = KiwoomOpenApiContext() cybos = CybosPlusComObject() kiwoom.EnsureConnected() cybos.EnsureConnected() kiwoom_codes = kiwoom.GetCommonCodeList() cybos_codes = cybos.GetCommonCodeLi...
nilq/baby-python
python
xs = [1, 2]
nilq/baby-python
python
# Copyright 2010-2011 Josh Kearney # # 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 agre...
nilq/baby-python
python
from django import forms from django.forms import ModelForm from auctions.models import Listing, Comment, Bid, Category categories = Category.objects.all().values_list('slug_name', 'name') class CreateListing(ModelForm): name = forms.ChoiceField(choices=categories, required=False) class Meta: ...
nilq/baby-python
python
from .utils import find_closest_equivalent, Snapshot from .find_init_weights import find_weights
nilq/baby-python
python
import schema229 import os ''' Unit tests ''' def test_resolve_ref(): schema = schema229.A229Schema(os.path.join(os.path.dirname(__file__),'..','build',"schema","ASHRAE229.schema.json")) node = schema.resolve_ref("ASHRAE229.schema.json#/definitions/ASHRAE229") assert('title' not in node) def test_get_sc...
nilq/baby-python
python
#!/usr/bin/python2 from math import sqrt from decimal import Decimal def check_prime(num): if not num % 2: return False for i in xrange(3, int(sqrt(num) + 1), 2): if not num % i: return False return True def reverse(num): rev_num = 0 while num: rev_num = 10 ...
nilq/baby-python
python
# Space: O(n) # Time: O(n) import collections class Solution: def topKFrequent(self, nums, k): counts = collections.Counter(nums) res = sorted(counts.keys(), key=lambda x: counts[x], reverse=True)[:k] return res
nilq/baby-python
python
import multiprocessing import os import signal import sys import time import WarBackend as War from blessings import Terminal def cleanexit(sig, frame): if os.system("clear") != 0: os.system("cls") print("\nStopping...") sys.exit() signal.signal(signal.SIGINT, cleanexit) # Catches ^c and stops term = Te...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
nilq/baby-python
python
#!/usr/bin/env python """ This is the base class to start the RESTful web service hosting the Blackboard API. """ import logging.config from logging.handlers import RotatingFileHandler from time import strftime from flask import Flask, Blueprint, request, jsonify from blackboard_api import settings from blackboard_...
nilq/baby-python
python
""" decoded AUTH_HEADER (newlines added for readability): { "identity": { "account_number": "1234", "internal": { "org_id": "5678" }, "type": "User", "user": { "email": "test@example.com", "first_name": "Firstname", "is_active":...
nilq/baby-python
python
""" Plot a traced WE trajectory onto 2D plots. # TODO: integrate into h5_plot """ import numpy as np import matplotlib.pyplot as plt import h5py def get_parents(walker_tuple, h5_file): it, wlk = walker_tuple parent = h5_file[f"iterations/iter_{it:08d}"]["seg_index"]["parent_id"][wlk] return it-1, parent ...
nilq/baby-python
python
import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin class Passthrough(BaseEstimator, TransformerMixin): """ Class for passing through features that require no preprocessing. https://stackoverflow.com/questions/54592115/appending-the-columntransformer-result-to-the-original-data-wi...
nilq/baby-python
python
from bs4 import BeautifulSoup as soup html = """ <html> <body> <ul> <li><a href="http://www.naver.com">NAVER</a></li> <li><a href="http://www.daum.net">DAUM</a></li> </ul> </body> </html> """ content = soup(html, "html.parser") links = content.find_all("a") for a in l...
nilq/baby-python
python
# -------------------------------------------------------------------------------------------- # 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
from .base import AttackMetric from ...tags import * from ...text_process.tokenizer import Tokenizer class JaccardWord(AttackMetric): NAME = "Jaccard Word Similarity" def __init__(self, tokenizer : Tokenizer): """ Args: tokenizer: A tokenizer that will be used in this metric. ...
nilq/baby-python
python
from flask import Flask, render_template, request app = Flask(__name__) @app.route("/") def main(): return render_template("main_better.html") # getting basic user data @app.route('/ask/', methods=['POST', 'GET']) def ask(): if request.method == 'GET': return render_template('ask.html') else: ...
nilq/baby-python
python
from keras.layers import Layer from keras_contrib.layers.normalization.instancenormalization import InputSpec import numpy as np import matplotlib.image as mpimg from progress.bar import Bar import datetime import time import json import csv import os import keras.backend as K import tensorflow as tf from skimage.tra...
nilq/baby-python
python
import time from umqtt.simple import MQTTClient def sub_cb(topic, msg): print((topic, msg)) c = MQTTClient("uqmtt_client", "localhost") c.connect() c.subscribe(b"foo_topic") c.publish(b"foo_topic", b"hello") while 1: c.wait_msg() c.disconnect()
nilq/baby-python
python
import math import os import pickle import sys import gym import numpy as np import quaternion import torch from torch.nn import functional as F from torchvision import transforms import skimage.morphology from PIL import Image import matplotlib if matplotlib.get_backend() == "agg": print("matplot backend is {}"....
nilq/baby-python
python
from django.apps import AppConfig class StandardizingApiConfig(AppConfig): name = 'standardizing_api'
nilq/baby-python
python
# Generated by Django 3.2.9 on 2021-11-28 04:44 from django.db import migrations, models import tinymce.models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Place', fields=[ ('id...
nilq/baby-python
python
import torch import torch.nn as nn from graphgallery.nn.layers.pytorch import GCNConv, Sequential, activations, InnerProductDecoder class GAE(nn.Module): def __init__(self, in_features, *, out_features=16, hids=[32], acts=['relu'...
nilq/baby-python
python
""" TODAS AS QUESTÕES SENDO COMPUTADAS BEM COMO AS SUAS ALTERNATIVAS E A SUA DEVIDA RESPOSTA CORRETA. DICIONÁRIO EM PYTHON. """ questionsX = { 'Pergunta 1': { 'pergunta': 'Qual é o século que ocorreu o período chamado iluminismo, o século das luzes?', 'alternativas': {'a': 'XIX -> Século 19', 'b': ...
nilq/baby-python
python
# flag = 'r2con{Sit down next to my friendLight matchStay}' var_60h = 0xDEADBEEFDEADBEEFCAFE1337CAFE13370102030405060708090A.to_bytes(26, 'big') var_40h = 0xDEADBEEFCAFE13371337CAFE133713370102030405060708090A.to_bytes(26, 'little') First_arr = [ 0x97, 0xCD, 0xD2, 0xD6, 0xC0, 0xC7, 0xCD, 0x84, 0xEC, 0x91, 0xAD, 0x62, ...
nilq/baby-python
python
import tensorflow as tf from absl import flags, app from libs.inference import YoloInf from libs.evals.coco import GetCocoEval FLAGS = flags.FLAGS flags.DEFINE_string('ckpt', default=None, help='Checkpoint file path') flags.DEFINE_string('img_prefix', default=None, help='Image directory path to evaluate', short_name=...
nilq/baby-python
python
import torch import torch.nn as nn import numpy as np import sys sys.path.append('..') from networks import HSwish, HSigmoid, Swish, Sigmoid def compute_memory(module, inp, out): if isinstance(module, (nn.ReLU, nn.ReLU6, nn.ELU, nn.LeakyReLU)): return compute_ReLU_memory(module, inp, out) elif isinstance(module, n...
nilq/baby-python
python
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ This scripts is used to generate graphs from smiles for the D-GIN publication. """ # ===========================...
nilq/baby-python
python
import math import itertools import numpy as np import pandas as pd import plotly.express as px import plotly.graph_objects as go import scipy.stats as ss import scikit_posthocs as sp from dash_table.Format import Format, Scheme from Bio import Phylo from ete3 import Tree from plotly.subplots import make_subplots # -...
nilq/baby-python
python
import logging import os import subprocess from datetime import datetime, timezone, timedelta from pathlib import Path import django_rq import novaclient import vm_manager from vm_manager.constants import INSTANCE_DELETION_RETRY_WAIT_TIME, \ INSTANCE_DELETION_RETRY_COUNT, \ INSTANCE_CHECK_SHUTOFF_RETRY_WAIT_T...
nilq/baby-python
python
""" Unit tests for FeatureNormalizer """ import nose.tools import sys import numpy sys.path.append('..') from dcase_framework.features import FeatureNormalizer, FeatureContainer, FeatureExtractor import os def test_accumulate_finalize(): FeatureExtractor(store=True, overwrite=True).extract( audio_file=os...
nilq/baby-python
python
"""A package for computing Pfaffians""" import cmath import math import numpy as np import scipy.linalg as la import scipy.sparse as sp def householder_real(x): """(v, tau, alpha) = householder_real(x) Compute a Householder transformation such that (1-tau v v^T) x = alpha e_1 where x and v a real v...
nilq/baby-python
python
# -*- coding: utf-8 -*- from django.core.urlresolvers import reverse from django.template import loader from django.utils.safestring import mark_safe as _S from django.utils.six.moves.urllib.parse import urlparse from django.contrib.contenttypes.models import ContentType from django.contrib.auth import get_permission_c...
nilq/baby-python
python
""" Evaluate the true Fourier coefficients of a given function x(1-x), generate the domain based on that and define the model Q:\Lambda \to D """ import sympy from inversefuns.utilities import get_coef, coef_domain, fourier_exp_vec import numpy as np param_len = 5 t=np.array((0.1,0.2,0.4,0.5,0.7)) period0 = 1.0 def t...
nilq/baby-python
python
"""Base Class for a Solver. This class contains the different methods that can be used to solve an environment/problem. There are methods for mini-batch training, control, etc... The idea is that this class will contain all the methods that the different algorithms would need. Then we can simply call this class in the ...
nilq/baby-python
python
import re mystring='My ip address is 10.10.10.20 and by subnet mask is 255.255.255.255' if (re.search("ip address",mystring)): ipaddregex=re.search("ip address is \d+.\d+.\d+.\d+",mystring) ipaddregex=ipaddregex.group(0) ipaddress=ipaddregex.replace("ip address is ","") print ("IP address is :",ipaddre...
nilq/baby-python
python
import sys import PyFBA.metabolism class Reaction: """ A reaction is the central concept of metabolism and is the conversion of substrates to products. The reaction describes what we know. At a bare minimum we need a a name for the reaction. The name can either be the reaction id (e.g. modelSEED or ...
nilq/baby-python
python
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import paddle from mmdet.models.utils import interpolate_as def test_interpolate_as(): source = paddle.rand((1, 5, 4, 4)) target = paddle.rand((1, 1, 16, 16)) # Test 4D source and target result = interpolate_as(source, target) as...
nilq/baby-python
python
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython """ class Punto: """Representación de un punto en coordenadas polares. :param x: coordenada x del punto. :x type: int :param y: coordenada y del punto. :y type: int """ def __init__(self, x: int = 0, y: int = 0) -> None: ...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pdb import set_trace import re def check_entitys(text): ptrn = r"(&{1})([\w-]+)([;]{0,1})" lst = [] for m in re.finditer(ptrn, text): s = m.group() g2 = m.groups()[2] t = 0 if g2 == ';' else 1 lst.append({'s': s, 't': t}) ...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2017-07-30 15:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('courses', '0011_auto_20170718_2027'), ] operations = [ migrations.AlterField...
nilq/baby-python
python
import json, pdb, os, numpy as np, cv2, threading, math, io import torch from torch.autograd import Variable def open_image(fn): """ Opens an image using OpenCV given the file path. Arguments: fn: the file path of the image Returns: The image in RGB format as numpy array of floats normal...
nilq/baby-python
python
# -*- python -*- # This software was produced by NIST, an agency of the U.S. government, # and by statute is not subject to copyright in the United States. # Recipients of this software assume all responsibilities associated # with its operation, modification and maintenance. However, to # facilitate maintenance we a...
nilq/baby-python
python
from queue import PriorityQueue as PQueue N = int(input()) C = int(input()) V = int(input()) S = list(map(lambda x: int(x)-1, input().split())) T = list(map(lambda x: int(x)-1, input().split())) Y = list(map(int, input().split())) M = list(map(int, input().split())) E = [[] for _ in range(N)] for f, t, cost, time in zi...
nilq/baby-python
python
import datetime from django.conf import settings from django.db import models BLOOD_GROUP_STATUSES = ( ('U', 'Urgente'), ('S', 'Stabile'), ('Z', 'Emergenza'), ('E', 'Eccedenza'), ('F', 'Fragile'), ) class BloodGroup(models.Model): groupid = models.CharField(max_length=3, unique=True) # AB+...
nilq/baby-python
python
from rest_framework import serializers from rest_framework_recursive.fields import RecursiveField from backend.blog.models import BlogCategory, Tag, Post class BlogCategorySerializer(serializers.ModelSerializer): """Сериализация модели категорий""" children = serializers.ListField(source='get_children', read...
nilq/baby-python
python
#!/usr/bin/env python # encoding: utf-8 # dit gedeelte zorgt ervoor dat stdout, stderr = subprocess.Popen werkt. import subprocess # tussen word = "" kun je de tekst typen die de koe moet uitspreken. # cowsay staat voor een koe, maar als je een ander karakter wilt zul je de code moeten aanpassen. # van 'cowsay', naar...
nilq/baby-python
python
"""Functions for generating interactive visualizations of 3D models of trees.""" import os import numpy as np import pandas as pd import geopandas as gpd import seaborn as sns import ipyvolume as ipv from ipywidgets import FloatSlider, VBox, HBox, Accordion, Text, Layout from forest3d.geometry import make_tr...
nilq/baby-python
python
from js9 import j def init_actions_(service, args): dependencies = { 'list_disks': ['init'], 'get_consumption': ['install'] } return dependencies def init(job): service = job.service if 'g8client' not in service.producers: raise j.exceptions.AYSNotFound("No producer g8cli...
nilq/baby-python
python
import math n = input() r = list(map(int,n)) lastNum = r[-1] l = r[:-1] newArray = list(map(int,l)) #print(newArray) print(lastNum) print(newArray)
nilq/baby-python
python
from __future__ import absolute_import import logging import time from django.contrib.auth.models import User from django.http import HttpResponse, StreamingHttpResponse from django.shortcuts import get_object_or_404, render, render_to_response import elasticapm class MyException(Exception): pass class Ignor...
nilq/baby-python
python
"""empty message Revision ID: 878f67285c72 Revises: 122dd6a5c035 Create Date: 2019-05-29 12:57:36.544059 """ # revision identifiers, used by Alembic. revision = '878f67285c72' down_revision = '122dd6a5c035' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ...
nilq/baby-python
python
import numpy as np import trimesh from pdb import set_trace as bp def write_off(file_path, verts, faces=None): """Export point cloud into .off file. Positional arguments: file_path: output path verts: Nx3 array (float) Kwargs: faces: Mx3 array (int) """ off = open(file_path, 'w') ...
nilq/baby-python
python
from PyQt5 import QtWidgets, QtCore, QtGui import os #from gui.export_widget import Ui_Form from editable_list_widget import list_widget from gui import build from wizard.vars import defaults from wizard.tools import log from wizard.prefs.main import prefs import options_widget import dialog_comment from wizard.tools....
nilq/baby-python
python
""" PYTHON NUMBER SEQUENCE """ __author__ = 'Sol Amour - amoursol@gmail.com' __twitter__ = '@solamour' __version__ = '1.0.0' # SYNTAX: [ value * step for value in range( amount ) ] # Step = This is the value we will multiply our range by # Amount = How many total values we want # NOTES: # All parameters ...
nilq/baby-python
python
# based on https://github.com/pypa/sampleproject # MIT License # Always prefer setuptools over distutils from setuptools import setup, find_namespace_packages from os import path from io import open here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, ...
nilq/baby-python
python