index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
993,700
6f61398f1b2985d69b92d175ccde8d3ef42df926
class Node: def __init__(self, val=None): self.val = val self.prev = None self.next = None self.freq = 1 class DLL: def __init__(self): self.head = Node() self.tail = Node() self.head.next = self.tail self.tail.prev = self.head self.size ...
993,701
faa74b0ae538ec87c4053785a3f64738ca4766ea
__author__ = "Safal Khanal" __copyright__ = "Copyright 2021" __credits__ = ["Safal Khanal"] __license__ = "GPL" __version__ = "1.0.0" __maintainer__ = "Safal Khanal" __email__ = "skhanal@respiro.com.au" __status__ = "In Development" import os import smtplib import sys import subprocess import tkinter as tk from email....
993,702
cab5f6a1adb47ac07fe22df43872e5be66ca3ebb
""" Generated by leslie in shanghai, @leadrive. Version 2.0 name: main.py time: 2019年3月20日10:18:32 kep o mvi """ from packages.for_file.modi_init_mcan_port import Modi_Init_Macan_Port from packages.for_file.modi_Com_cbk_Adap import Modi_Com_Cbk_Adap from packages.for_file.modi_PduR_PBcfg import Modi_PduR_PBc...
993,703
255c407d1872e7906a0be1281e70f3ec8e97969c
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 12 17:53:08 2017 @author: cbilgili """ # To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs def...
993,704
bc7d46854265c1ff86bf9cc1e951118c5fd7c50f
from commands.base_command import BaseCommand import utils class End(BaseCommand): def __init__(self): description = "Moves everyone from attacking and defending to lobby" params = None super().__init__(description, params) async def handle(self, params, message, client): awai...
993,705
d08fcfe5aab257d07870d021de0c4c70829ae9be
from __future__ import absolute_import from collections import defaultdict import json import requests import os from django.contrib.auth.decorators import login_required from django.contrib.auth.models import Group, User from django.contrib.sites.models import Site from django.core.exceptions import ValidationError f...
993,706
8424f45487a60966851de466d9282a2056be8e24
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
993,707
2eef94a7041c9c32e54ec48913ba2dae131f14ce
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. #...
993,708
f2d390799ca8527a6ff6f4e32e37db36f6e530ed
from kombu import Exchange, Queue task_exchange = Exchange('tasks', type='direct') print("task_exchange: ", task_exchange) task_queues = [Queue('hipri', task_exchange, routing_key='hipri'), Queue('midpri', task_exchange, routing_key='midpri'), Queue('lopri', task_exchange, routing_key='lo...
993,709
2b5b691244afb2572641a4bd705a4a719823ce73
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
993,710
5457e494dd50b9173eb2ef7cc6f593ef5ea7ab0e
from ply.lex import lex class QLSLexer: def __init__(self): self.__errors = [] self.__lexer = None @property def lexer(self): return self.__lexer @property def errors(self): return self.__errors def build(self): self.__lexer = lex(mod...
993,711
638657c6b24bb39c1d434b1f22d9fbe288a6f84c
#coding=utf-8 """ Simple iOS tests, showing accessing elements and getting/setting text from them. """ import unittest import os from random import randint from appium import webdriver from appium.webdriver.common.touch_action import TouchAction from time import sleep class testLogin(unittest.TestCase): ...
993,712
ee13f4348f1a88eaf6a97bfda53bade5ffeba5b8
from coapthon.client.helperclient import HelperClient from coapthon import defines from scale_client.networks.util import DEFAULT_COAP_PORT, msg_fits_one_coap_packet import logging log = logging.getLogger(__name__) class CoapClient(HelperClient): """ This helper class performs CoAP requests in a simplified ...
993,713
d282dabffe40c75395e08298d6930f7beb17a62d
""" Training module using TF Boosted Trees Classifier to predict if Customer will make specific transaction in the future or not! """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import pandas as pd import argpa...
993,714
56f7087b1f9c7eadd4eda5b06d4cac7800d44685
""" tests.py Unit tests for toggl-cli. Usage: python tests.py [CLASSNAME[.METHODNAME]] NB: These tests add and modify entries in your toggl account. All of the entries have the prefix given below, and they should all be removed after the tests are complete. """ PREFIX = "unittest_" import datetime import unittest i...
993,715
98a9c8deb9dc5e929055ecf9ecacfbde96cce1b5
from rest_framework import serializers from django.contrib.auth.models import User class RegisterSerializer(serializers.ModelSerializer): #serializer for register model class Meta: model= User fields = ('id', 'username', 'email', 'password') extra_kwargs = {'password': {'write_only':True}}...
993,716
15df1f144c3146cf63c792c2f107c700128b315b
#coding=utf-8 from b2.stop2 import StopWords __ALL__ = [ "get_url_site"] _url_protocls = StopWords(words = ["http://" , "https://"] ) def get_url_site(url): """得到链接站点 , 主要是第一个/切分 params url 链接 return value 提取站点失败后,返回None,否则返回站点字符串 re...
993,717
d5f72ea9644fd225062b999506ddeb158ca16ffd
#!/usr/bin/python2.7 #from OpenSSL import SSL #context = SSL.Context(SSL.SSLv23_METHOD) #context.use_privatekey_file('server.key') #context.use_certificate_file('server.crt') from app import app #app.run(debug = True,ssl_context = context) app.run(debug = True)
993,718
bc0325b21b418e5f4bd16cc531d9c0683600117f
a=int(input("Introduce el lado a: ")) b=int(input("Introduce el lado b: ")) c=int(input("Introduce el lado c: ")) if a!=b and a!=c and b!=c: print("Es escaleno") else: print("No es escaleno")
993,719
a76b17d7e48a3b997eba01b485e7ce3e91613dbc
# This is a demo of the main bci system. It will run the task defined here # using the parameters file passed to it. def main(): import bci_main from bcipy.helpers.load import load_json_parameters from bcipy.tasks.task_registry import TaskType from bcipy.helpers.parameters import DEFAULT_PARAMETERS_P...
993,720
916851a71d0aa43de5ea3229a1b1a2198944d451
from django.db import models PROJECT_IMAGES_PATH = 'media' class Project(models.Model): project_name = models.TextField(null=False,blank=False) class Technology(models.Model): technology_name = models.TextField(null=False,blank=False) # class ProjectImages(models.Model): # c...
993,721
20ce1f1be3e0d8fb16b279ba47a6957d08e286fb
import numpy as np import matplotlib.pyplot as plt; plt.ion() import netgraph # Construct sparse, directed, weighted graph # with positive and negative edges: total_nodes = 20 weights = np.random.randn(total_nodes, total_nodes) connection_probability = 0.2 is_connected = np.random.rand(total_nodes, total_nodes) <= con...
993,722
3fbcd3d12586a4d642d6f5f1b3be010e0cf820c6
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: RpcHeader.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as ...
993,723
b6f71b4e021f7448bf85c4a93fc040eb1a2a7c04
from random import randint, choice class CanAdd: """Mixin to allow addition""" def addition(self, difficulty=0): """ Creates an addition question. returns an array → [question, answer] """ num1 = 0 num2 = 0 if difficulty == 0: num1 = randint(0, 20) num2 = randint(0, 20) ...
993,724
189d7a99a004a23227af1de4d078f16694d471f0
from django.db import models from django.core.validators import MaxValueValidator, MinValueValidator class ActionList(models.Model): action = models.CharField(max_length=255, unique=True) quality = models.FloatField( validators=[MinValueValidator(0), MaxValueValidator(100)], default=0, ...
993,725
2dd3ebf033277062b231ff8f6e9c93552721d5d6
from pyplasm import * import numpy """ roundCoordinates is a function that given a list of vertices, round the coordinates of every vertex, if the vertex has a coordinate smaller than 0.001 it will be rounded to 0, alternatively it will be rounded to the first decimal. @param vertsList: a list containing vertices """ ...
993,726
d38ccfb435e4d107ae98df03aa91a31cc37b40e6
c = [ 1, 2, 4, 6, 10 ] output = 0 for index in Range(len(c)): output:output + c[index] + =([index] print(output)
993,727
bc13721de28a04732246ccce14f5769f56ea7d77
import requests def test_valid_api_token(): response = requests.get("http://localhost/wp-json/anxapi/v1/up/?access_token=test_access_token") assert response.status_code == 200 assert response.text == "OK" def test_invalid_api_token(): response = requests.get("http://localhost/wp-json/anxapi/v1/up/?ac...
993,728
17c538ba27ab35c465575099b0553c1dc311efb6
def A(a): if a == 0: return 1 else: return a * A(a-1) a = 8 print(A(a))
993,729
4a2243d4a97e35af3093fc8ae4d2705abc0666cf
import numpy as np from models.LogisticRegression import LogisticRegression from utils import optimizer, Accuracy np.random.seed(10) Dataset = np.loadtxt('data/logistic_check_data.txt') x_data, y_data = Dataset[:, :-1], Dataset[:, -1] _epoch = 100 _batch_size = 5 _lr = 0.01 _optim = 'SGD' #=========...
993,730
776f431c87b1354aa2ef3bdf3c00c09687bf97f0
import datetime import time rec_time_limit = input("What duration of each record do you want?") rec_time_limit = int(rec_time_limit) if rec_time_limit is None: rec_time_limit = 5 # seconds class Timer(rec_time_limit): def to_set_start_time(self): start_time = int( time.time() ) return srart_tim...
993,731
da8628ea6d9f1c17cb16057c89f4e7d02a13a583
from myapp.models import Credentials from django.forms import ModelForm from django import forms class RegForm(ModelForm): class Meta: model=Credentials fields=['passw','usern'] class login_form(forms.Form): #your_name = forms.CharField(label='Your name', max_length=100) user_name = forms.CharField(max_length...
993,732
0bbd006c5cf221f1182b25b224503c6ad9ae62a7
# =================== # pigen.py # =================== # ==================================================== # Calculating Pi using Liebniz Formula and Generator # ==================================================== # An infinite series can be useful even if you will never end up generating an infinite number of v...
993,733
df7fbeca3d397f239602a490fc51b23bad67dd6a
import websockets import json from typing import Any, Callable, Coroutine, List from src.models import Item class Response: """ A response to a query to send back to the server. """ def __init__(self, found: bool, items: List[Item]): self.found = found self.items = items def ser...
993,734
badcd1ba758fbc2a8a598e6ccfc6aa665b51f9e7
n,k=map(int,input().split()) a=list(map(int,input().split())) suf=[0]*(n+1) for i in range(n-1,-1,-1): suf[i]=suf[i+1]+a[i] ans=suf[0] aft=[0] aft.extend(sorted(suf[1:])) for i in range(n-1,n-k+1,-1): ans-=aft[i] print(ans)
993,735
f7744ca9002900320893ad7d0a92284d02c17e4a
#!/usr/bin/python import RPi.GPIO as GPIO import pygame import time import random from threading import Thread, Lock from serial import Serial GPIO.setmode(GPIO.BCM) class Bug: channels = 0 def __init__(self, pinNumber, soundFile, duration): self.duration = duration self.pin = pinNumber sel...
993,736
87f110b6c1e4a7e9b6e822c3d64dfa684820c0d9
from RPi import GPIO import time #left e1 = 27#digital m1 = 18#digital ena = 13#pwm #right e2 = 6#digital m2 = 12#digital enb = 19#pwm #GPIO.setwarnings(False) GPIO.setmode (GPIO.BCM) GPIO.setup(e1,GPIO.OUT) GPIO.setup(e2,GPIO.OUT) GPIO.setup(m1,GPIO.OUT) GPIO.setup(m2,GPIO.OUT) GPIO.setup(ena,GPIO.OUT) GPIO.setup...
993,737
bd8467cb8cc28bca621a704642498d3502061eab
# 위상정렬 Topology Sort from collections import deque def topology_sort(): # 처음 시작시, 진입차수가 0인 노드를 큐에 삽입 for i in range(1, v+1): if indegree[i] == 0: q.append(i) while q: now = q.popleft() result.append(now) # now가 진입하는 노드의 진입차수 감소 for i in graph[now]: ...
993,738
c1670ad9f70bdeec21a86e3646c8c8bb1c8734b2
from flask import render_template, url_for, flash, redirect, request, Blueprint, abort, jsonify from flask_login import login_user, current_user, logout_user, login_required from codearena import db, bcrypt from codearena.models import User, Team from codearena.teams.forms import NewTeamForm, EditTeamForm, SearchTeamFo...
993,739
6a6b8bef5340e419590d50cddc54f562ed498254
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import pandas as pd import copy # klasa definiująca cechy pojedynczego automatu (agenta) class Agent: def __init__(self, color, ingroup_coop, outgroup_coop): self.color = color self.inner = ingroup_coop ...
993,740
6d1f3940a128dbf29070817f5e29f564381ac0a8
import datetime # sunday startDate = datetime.date(1901, 1, 6) endDate = datetime.date(2000, 12, 31) currentDate = startDate numSundays = 0 while currentDate <= endDate: if currentDate.day == 1: numSundays += 1 currentDate += datetime.timedelta(7) print numSundays
993,741
71046c4caec51a4994c9ccbf987535b0039fefdb
import datetime as dt from pytz import timezone from learning_record.settings import TIME_ZONE from django.db import models class Item(models.Model): """ learning item """ id = models.AutoField(primary_key=True) name = models.CharField(max_length=50, verbose_name='Name') description = models.CharField...
993,742
27a2af43f3c815b5815aa785f74b90f84d816b7b
""" Prepare is a script to remove the generated files, run wikifier, and finally zip the package. """ from __future__ import absolute_import #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module. import __init__ fr...
993,743
57c800a786aadae38daa44505aa0b7fcca37f2e3
from django.shortcuts import render from rest_framework.generics import ( ListAPIView, RetrieveAPIView, UpdateAPIView, CreateAPIView, DestroyAPIView) from .models import Post # Create your views here. from .serializer import PostSerializer class PostListAPIView(ListAPIView): queryset = Post.objects....
993,744
400ec7b13da5b35fc87f330e09ded735b1a2353d
import socket import os def cls():#clears the console os.system('cls' if os.name=='nt' else 'clear') bytesToSend= str.encode("Hello UDP Server") bufferSize = 1024 ACK_MESSAGE='THIS IS SERIAL2TCP/UDP SERVER' def getServerIP(): """Sends a message to every IP on the local network and if the respond is the AC...
993,745
b7ba9a0410a46a0e4a02752e01da773e34103a93
def distinctPowers(start,end): results = [] for a in range(start,end+1): for b in range(start,end+1): n = pow(a,b) if n not in results: results.append(n) results.sort() return results print len(distinctPowers(2,100))
993,746
11cfc1f10ab998b06f700a15ec55f205db78b8a4
class PassWord(): def __init__(self, driver): self.driver = driver driver.password_textbox_xpath = "//input[@name='password']" driver.password_login_next_btn_xpath = "//span/span[text()='Next']" def enter_password(self, password): self.driver.find_element_by_xpath(self.driver.pa...
993,747
ebfd1fc04cbeed868abce1e57048d644c26d4da0
import torch import torch.nn as nn import torchvision.models as models import torchvision.transforms as transforms from torch.nn.functional import softmax def get_resnet18(num_classes): new_layers = nn.Sequential( nn.Linear(1000, 256), nn.Linear(256, 128), nn.Linear(128, num_classes) ...
993,748
c27e4d77008dd2c2e0dd154f2ca72d2526a54eda
# Create an area plot showing the minimum and maximum precipitation observed in each month. # import pyvista import numpy as np x = np.arange(12) p_min = [11, 0, 16, 2, 23, 18, 25, 17, 9, 12, 14, 21] p_max = [87, 64, 92, 73, 91, 94, 107, 101, 84, 88, 95, 103] chart = pyvista.Chart2D() _ = chart.area(x, p_min, p_max) ch...
993,749
a6d2707d433cd37fd7bfb167481ccde2ffff954a
#!/bin/env python3 # -*- coding: utf-8 -*- # KEEP THAT! ^^^^^ from textwrap import wrap from pushing_outshoot_unfold import Term import calendar as cal term = Term() def progress(percentage): start = "Quarantine: " end = f" {str(round(percentage)).rjust(2)}% completed" percentage = percentage / 100 progress_wid...
993,750
dff16826e737839d7774008a7a7a28eef75359ef
words = [] def create_words(lev, s): global words VOWELS = ['A', 'E', 'I', 'O', 'U'] words.append(s) for i in range(0, 5): if lev < 5: create_words(lev+1, s + VOWELS[i]) def solution(word): global words words = [] answer = 0 create_words(0, '') for idx, i in enumerate(words): if word == i: answer =...
993,751
b1057a938e989117d615b5fc6165c97edc5a6641
import json import concurrent.futures import os import sys def create_schema(file_name): file_name_and_ext = os.path.basename(file_name) basename = os.path.splitext(file_name_and_ext)[0] strings = ['nvarchar', 'char', 'nchar', 'varchar', ...
993,752
4a6360bdba5c89152ce5ad0c7e7b9f2c1aea2fd5
from django.db import models # Create your models here. class Question(models.Model): title = models.CharField(max_length=255, default="", blank = True)
993,753
647bd30703cec023ed48de4d6bc2ea6f8fa5ea87
import requests import time import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') import numpy as np times = [] url = "http://127.0.0.1:5000/" N = 1000 for i in range(N): # Calculando o tempo de resposta da API em segundos response = requests.post(url, timeout=1000) elapsed...
993,754
b33791a81836ba957e386662c6822d5ee4b9cf09
import Telstra_Messaging from Telstra_Messaging.rest import ApiException import requests from flask_restful import Resource, Api from flask import Flask, request, send_from_directory, render_template, send_file def generate_text(number, message): # create an instance of the API class api_instance = Telstra_Mes...
993,755
1360a02703e48c7cee0c53073e3dd650f78c742c
#!/usr/bin/python """ Purpose: Boolean Operations """ # True, False choice = True print 'choice = ', choice true = 'Udhay Prakash' choice = true print 'choice = ', choice choice = False print 'choice = ', choice print "True = ", True print "True * 30 = ", True * 30 # True has a value of one print "False = ", ...
993,756
0311088cc07c2c6982c475c9289d91b1b2deb2d6
#!/usr/bin/python # -*- coding: utf-8 -*- from Entity import * from methods.WebParseHelper import * from sqlalchemy import Column, String, Integer, create_engine from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy.ext.declarative import declarative_base class EntityMapper(object): """docstring fo...
993,757
6c436da2f46d1316c011f35f3eff08a6a4a37237
import rocks.commands class Plugin(rocks.commands.Plugin): def provides(self): return 'ssl' #[sorting to] run after 'ManagedFork' plugin def requires(self): return ['ManagedFork','Pbs','SGE','Condor'] def run(self, argv): # 1. Get the hostname and the config file to store host, addOutput, c...
993,758
d5801beb1da97521ca00607495ded5656a12727f
coureses_set = ("Math", "Physics", 1) print("Math" in coureses_set)
993,759
a0b6a5a8543ed4c4126f782e239670ffc6276ad3
strs = list(input()) nums = list(map(int, strs)) op_patterns = [] ops = ['+', '-'] for op1 in ops: for op2 in ops: for op3 in ops: op_patterns.append((op1, op2, op3)) for pat in op_patterns: express = '{}{}{}{}{}{}{}'.format(nums[0], pat[0], nums[1], pat[1], nums[2], pat[2], nums[3]) ...
993,760
82da2a2aae2525958805d2ce4bae04c4273c9750
from Chef_understand_inheritance import Chef class ChineseChef(Chef): def make_fried_rice(self): print("The chef is able to make the fried rice") # you can override any method of the parent class if you want different output, i.e Override them
993,761
eff5025690bdf9996c3035da45b5a4acb85e4c2c
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=C0301 # pylint: disable=C0111 """ Created on Tue Oct 6 00:15:14 2015 Updated and improved by x86dev Dec 2017. @author: Leo; Eduardo; x86dev """ import getopt import json import logging import os import signal import sys import time import urllib.parse f...
993,762
3200d2b201ef1178d497ce192a3de245f66018d9
import pandas as pd import numpy as np import os #ランダムなtrainデータを生成 #入力:1クラスのデータ数data_num def random_select(df, out_npy_name, data_num, class_num): random_data = [] for class_i in range(class_num): df_class_i = df[df.label == int(class_i)] img_list = df_class_i.sample(n=data_num).img.values ...
993,763
2e7f916bb251f82ffa762d4c13fb2fa46d47f779
../3.0.0/_downloads/custom_scale.py
993,764
301207e5a6a2ad9e684f204e4175b5f978130a57
# coding = utf-8 import os os.environ["CUDA_VISIBLE_DEVICES"] = "3" import tensorflow as tf #from prepare_data import get_data from database.readdb import get_data from lstm import build_rnn def train(reload=False): file_name = "save_model" save_dir = "peotry_bigdb" model_save_path = os.path.join(os.getcw...
993,765
42282440e912f6862a481ef3912316e5e99b25ce
# coding: utf-8 import os.path import ConfigParser import logging from utils import UnifiTLV from utils import mac_string_2_array, ip_string_2_array,getuptime,get_ipv4addr,get_macaddr,_byteify from pfsense_utils import pfsense_const, get_temp from struct import pack, unpack import socket import binascii import time im...
993,766
7393d9c31d04d9543f43556687b25be936185a5b
#!/usr/bin/python3 -u # -*- coding: utf-8 -*- from basepath import basepath from conf import opts import calendarlist import calendars import login import logs import untis def args(): from oauth2client import tools import argparse tools.argparser.add_argument( 'untis_id_from', help = 'Untis ID to change fro...
993,767
b383a151f78bed2ad22a959f2ddb37e820c75d59
#!/usr/bin/env python # coding: utf-8 # # Table of Contents # <p><div class="lev1 toc-item"><a href="#But-de-ce-notebook" data-toc-modified-id="But-de-ce-notebook-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>But de ce notebook</a></div><div class="lev1 toc-item"><a href="#Règles-du-Jap-Jap" data-toc-modified-id=...
993,768
4049482575730ad4bfa473e2e7ac4363ec5cfa75
from django.shortcuts import render from .models import compania from django.shortcuts import render, get_object_or_404 from django.views import generic # Create your views here. def compania_list(request): Compania = compania.objects.all() return render(request, 'inventario/compania_list.html', {'Compania' : ...
993,769
52d2642631ddf4090e6cc333333c36928c19c25f
#coding:utf-8 import requests import re import urllib from urllib.request import urlopen import chardet table1=[] table2=[] table3=[] table4=[] table5=[] table6=[] url='http://u9service.ufida.com.cn/servicehome/kmindex.aspx' for i in range(110): paramsload = {'ver': '0', 'mmdul': '0','mdul': '0','qnum': '','q...
993,770
b24f56069a2949fb1fe307769d9ff1820c19741c
# podajemy 2 liczby program ma dokonać jakiejś operacji matemeycznej (+ - dziel mnoż) # podjamey tez operację w ,wyniku zlej operacji wyrzyca blad def pobranie_danych(): liczba1 = float(input("Podaj liczbe A")) liczba2 = float(input("Podaj liczbe B")) operacja = input("Podaj jaką operację chcesz wykonać: ...
993,771
5f1823ba297d3bfb7cb2d8b116bbac8a356adef3
# SJTU EE208 import os import re import string import sys # import urllib.error # import urllib.parse # import urllib.request import requests from urllib.parse import urljoin import time from bs4 import BeautifulSoup def valid_filename(s): valid_chars = '-_.() %s%s' % (string.ascii_letters, string.digits) ...
993,772
9cf4de5807cd3c5639242719b54bcb8e7cc2add4
import uiautomator2 devices = uiautomator2.connect("D3H7N17B11010237") devices.app_start("guoyuan.szkingdom.android.phone", "kds.szkingdom.modemain.android.phone.UserMainActivity") # devices.xpath( # '//*[@resource-id="guoyuan.szkingdom.android.phone:id/main_page_bottomBar_view"]/android.widget.LinearLayout[5]')...
993,773
3bfb46884c5d9d3a176ba41ab75d523d674270d6
# Generated by Django 3.2.2 on 2021-05-29 10:22 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('account', '0026_reclamation'), ('operation', '0008_auto_20210529_1119'), ] operations = [ migration...
993,774
5d1851336f359588396c416efde7348a37e5c93b
from collections import deque import heapq as hq class MazeRunner(object): ''' A base class for the maze runners, with no search algorithm implemented. ''' def __init__(self): self.reset() def __len__(self): return len(self.path) def reset(self): ''' Resets the node...
993,775
d25692817a84c8370de6e32a6e7532ae97dcd82a
import math test = ['G', 'B', 'R', 'R', 'B', 'R', 'G'] order = { 'R': 1, 'G': 2, 'B': 3 } def batteries_included_sort(input_list): l = input_list[:] return sorted(l, key=lambda x: order[x]) def bubble_sort(input_list): l = input_list[:] for i in range(len(l)): f...
993,776
44182e651aeed5bdc9c1099671299140ff08d099
#!/usr/bin/env python TEST="""3 1 4 2 1 7 7 2 5 1""" raw_input = iter(TEST.splitlines()).next def solve(C,W): gh = C/W miss = 1 if C%W == 0: miss = 0 rem = W-1 return (gh+miss+rem) T = int(raw_input()) for case in range(1,T+1): R,C,W = map(int, raw_input().strip().split()) a...
993,777
501860942c6c0c5b291873ae18ddb379680efef5
import logging import numpy as np import json import requests from pprint import pprint from influxdb import InfluxDBClient, DataFrameClient from influxdb.exceptions import InfluxDBClientError, InfluxDBServerError import influxdb from datadog import statsd from cleanflux.utils.influx.date_manipulation import pd_times...
993,778
0f2e13a9de8bb601be5f62098f5e71d10267cfe4
class Node: def __init__(self, val: int, left: 'Node' = None, right: 'Node' = None): self.val = val self.left = left self.right = right def greater(root: Node, val: int) -> bool: ok = None while root: if root.val > val: ok = root.val root = root.lef...
993,779
f9a193064884c015c05d8628830a2e5d17191d2b
__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x07\x00\x42\x0d\x0d\x0a\x03\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\x35\x0c\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x50\x8c\x64\x26\x42\xd6\x...
993,780
df853a59e8af10adb40586ff572d68162a477e06
#!/usr/bin/env python """ List all repos with specified webhook payload URL. """ import click from openedx_webhooks.lib.github.utils import get_repos_with_webhook, repo_name click.disable_unicode_literals_warning = True @click.command() @click.argument('payload-url') @click.option( '--exclude-inactive', is...
993,781
9153c51f06cd371c76248956cffa594bb5069528
#!/usr/bin/python3 """ an matrix dividing function: matrix_divided(): >>> matrix_divided(m, 1) m """ def matrix_divided(matrix, div): """ Returns a divided matrix """ if not matrix: raise TypeError('matrix must be a matrix \ (list of lists) of integers/floats') k = len(matrix[0]) if ty...
993,782
8c64f32b827a0d0af0b22842f435cc9ee05b976a
#!/usr/bin/env python3 """Define measure_runtime""" import asyncio import time wait_n = __import__('1-concurrent_coroutines').wait_n def measure_time(n: int, max_delay: int) -> float: """return the total_time / n """ t0 = time.time() asyncio.run(wait_n(n, max_delay)) t1 = time.time() total_time...
993,783
819929bc191398a28b9d1c4ee93af3f3d00f9b47
# standar libs import cv2 import numpy as np import serial import time from copy import deepcopy # Roborregos libs import sys sys.path.insert(0, '../lib/') import Larc_vision_2017 as rb # CODE mainFrame = [] clearedMainFrame = [] cap = cv2.VideoCapture(0) # let camara calibrate light for i in range(10): c...
993,784
c91ed778783da515960a86b2a9b5dcf375cf26a3
from enum import Enum from .exceptions import SynsetError class Synset(object): class Pos(Enum): NOUN = 0 VERB = 1 ADVERB = 2 ADJECTIVE = 3 def __str__(self): dic_pos2chr = {'NOUN': 'n', 'VERB': 'v', 'ADVERB': 'r', 'ADJECTIVE': 'a'} return dic_pos2...
993,785
daf73300884086608a41f52a3e05ec4620b7d6b8
from . import views from django.urls import path, include from src.views import Tambah_Posisi, Simpan_posisi, Editposisi urlpatterns = [ path ('', views.pekerja_list, name='pekerja_list'), path ('pekerja_form/', views.pekerja_form, name='pekerja_form'), path ('<int:id>/', views.pekerja_form, name='pekerja_...
993,786
7e757c2a5ada706dc528e8ca5a8b0443b35ccfe4
#!/usr/bin/env python # -*- coding: utf-8 -*- #---- # Базовые параметры классов. Используются при генерации персонажей. dict_class_abilityes = { # Наибольшие параметры -- первые: 'Bard':['charisma','dexterity','constitution'], 'Barbarian':['strength','constitution','dexterity','charisma'], ...
993,787
2b1d7a7f8b634f56528e2bbadc99b0a6770c83c0
print("======= Keliling dan Luas Jajar Genjang =======") print("\n1. Keliling Jajar Genjang\n2. Luas Jajar Genjang") menu = int(input("\nInputkan Nomor Menu = ")) if(menu == 1): a = int(input("\nInputkan sisi pertama = ")) b = int(input("Inputkan sisi kedua = ")) keliling = 2 * (a + b) ...
993,788
3faea38989c89a7c1c7925abe6f0cfdc76a00ded
from profiler.models import SimpleType, DetailedType def run(*args): print 'Received args=', args if len(args) != 1 or not args[0] or args[0] == '': raise Exception('[ERROR] Output file must be passed as param. Only this param should be used.') output_csv = '' for stype in SimpleType.objects.extra(order_by =...
993,789
5b1759c254a3fdc7e024d06414272d0cf0962196
from vt_manager.communication.sfa.rspecs.elements.element import Element class HardwareType(Element): fields = [ 'name' ]
993,790
bfefb6ace50e01c20a35cd564815620f05a41f20
import sys class OnPath: """ Test utility to put a pytest path on the Python search path. """ def __init__(self, path): self.path = str(path) def __enter__(self): sys.path.insert(0, self.path) def __exit__(self, exc_type, exc_val, exc_tb): sys.path.remove(self.path)
993,791
24f49c907f0625e94e47b68b586fa9519e439769
from django.core.exceptions import ObjectDoesNotExist from django.core.management.base import BaseCommand, CommandError from django.conf import settings from ui.models import Location from pysnmp.entity.rfc3413.oneliner import cmdgen class Command(BaseCommand): help = '''Capture network status of all the hosts ...
993,792
71f62c026381a82010cd14d7fc73c6795216bcec
import cx_Freeze executables = [ # name of your game script cx_Freeze.Executable("FACE_EYES_SMILE_DETECTION.py") ] cx_Freeze.setup( name = "Face, Eyes & Smile Detection", version='0.1', options= {"build_exe": {"packages":["numpy", 'cv2'], ...
993,793
a0a5aac603db932cab9d1461c31dcd6bc3e95e76
from Xlib import display import time from matplotlib import pyplot as plt import numpy as np from pynput import keyboard import threading, time from datetime import datetime import csv import math def on_press(key): global pressed_key # if pressed_key == 0: # try: # print('alphanumeric key {0} pres...
993,794
4488a8f4d5ae8ed42eb2f5c0511017248c43f5a8
import torch #vector t2 = torch.tensor([1.,2,3,4]) print(t2) #matrix t3 = torch.tensor([[5., 6], [7, 8], [9, 10]]) print(t3) #3d array t4 = torch.tensor([ [[11, 12, 13], [13, 14, 15]], [[15, 16, 17], [17, 18, 19.]]]) print(t4) print(t2.shape, t3.shape, t4.shape) # tensor operations and gradien...
993,795
0a6a448dca3d53de8710e6f2a341795881a40df7
def main(): # Create a dict and populate using a for loop. # my_dict={} # for i in range(1, 101): # dictionary[i]=i**3 """ Dictionary comprehensions { key:value for value in iterable if condition } { [part 1] [part 2] [part 3] } p...
993,796
a1a05c629660ed1956d986cddc99869e2da59fa8
alphabet = "абвгде" letters_list = list(alphabet) # список из строки letters_tuple = tuple(alphabet) # кортеж из строки print("letters_list = ", letters_list) print("letters_tuple = ", letters_tuple) print(str(letters_list)) # а так не работает print('/'.join(letters_list)) my_dict = dict((('key1', 'value1'), ('ke...
993,797
ff89af627c981e755e361ee0996eaf01ec69af9b
class PrirodaOptimizer(): def __init__(self, relative=False, basis='L1', memory=200, tmp_dir='/tmp', tmp_ram=0): # L1 аналог CCPVZ self.relative = relative # аргументы для настройки расчета: базис (релятив и нерелятивисткие) self.basis = basis self.memory = memory self.tmp_dir...
993,798
a5dde2903700b2781e9b419a397132c47880e96d
import cv2 import numpy as np from goprocam import GoProCamera from goprocam import constants cascPath="/usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cascPath) gpCam = GoProCamera.GoPro() #gpCam.gpControlSet(constants.Stream.BIT_RATE, constants.Stream.Bit...
993,799
f6a26746a0be9f2c4248cadc2fbfcb7cdd006551
import autolamella.acquire import autolamella.add_samples import autolamella.align import autolamella.autoscript import autolamella.conversions import autolamella.data import autolamella.display import autolamella.fiducial import autolamella.interactive import autolamella.milling import autolamella.user_input import au...