index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
986,000
36d39e067f8b1015207ff912ffa26bcd05fe5c93
__author__ = 'kako' from django import forms from ..common.forms import OwnedEntitiesForm, OwnedEntityForm from .models import Location class LocationSearchForm(OwnedEntitiesForm): """ Search form for location list. """ name__icontains = forms.CharField(min_length=4, max_length=32, required=False, l...
986,001
dfb4893363bfd18e0a9fc528d790b84a72592961
a = input('First number:') b = input('Second number:') try: answer = int(a) / int(b) except ZeroDivisionError: print("You can't devide by 0") else: print(answer)
986,002
cc97679ebce5dafd3f5d241f1b4cb1b34344da82
""" How to send Attach Request by RNC to SGSN. """ def run(msg, ctxts): #1. fetch context #2. update context #3. set message parameter msg.setdefault('layer1', {'protocol': 'SCCP', 'message': 'Connection Request', 'parameters': {}})...
986,003
6480e4784595bcd98c899ceea01f357c9367293c
import pandas as pd import numpy as np #To DO # Columns with uniform distribution ?? # Interaction effects ??? # Balance click classes def data_input(path, complete=False, nrows=10000): """ Function to read a datafile. Arguments: path, complete, nrows path: Filepath to the data complete: Read the ...
986,004
4e757fa90d8af33e65d1990b90f6b355ffd4e477
import random #from random import randrange # Set up counter player_wins = 0 computer_wins = 0 winning_score = 2 # for time in range(3): while player_wins < winning_score and computer_wins < winning_score: print(f"Player score: {player_wins} Computer score: {computer_wins}") print(f"") print("...rock...") print("...
986,005
fb5ab25e87300645ee0fffbf46ce003b2129251d
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np # In[2]: df_final = pd.read_csv('textos_videos.csv') # In[3]: import nltk from nltk.corpus import stopwords stopwords = set(stopwords.words('english')) nltk.download('wordnet') nltk.download('stopwords') from nltk.tokenize ...
986,006
d09a0b9faa55c07d6f2de2edc355b8680881603b
''' Created on 07-Jun-2018 @author: pritika sambyal ''' class Alpha: def pprint(self): print('Print from Alpha') class Beta: def pprint(self): print('Print from beta') class Charlie(Beta,Alpha): def pprint(self): Alpha.pprint(self) #way to print pprint of specific class ...
986,007
e2a740b0acbc66d25f167df36e266d15eba95fda
#!/bin/python import sys n = int(raw_input().strip()) c = map(int,raw_input().strip().split(' ')) i = 0 a = 0 while i<n-1: if (i+2)>=n: a += 1 break elif c[i+2]==1: i += 1 a += 1 elif c[i+2]!=1: i += 2 a += 1 print a
986,008
0b68b20901864f5046c1d99c7d7a752f8a268aa3
# coding: UTF-8 import math import random import numpy as np from scipy import stats def midiNoteToHz(midiNote): # ref:https://drumimicopy.com/audio-frequency/ return 440 * 2**( (midiNote - 69)/12 ) if midiNote > -1 else midiNote def a16beatToSec( bpm): return 60/bpm/4 def toBytes(wave): return (wave...
986,009
116e430f26c7e0ad64c118f97a3361428b15ca65
t = [0.460858906320354, -1.84046012825185, -1.02533106640510, 2.59692421208403, -1.34897127280327, 2.68541539468966, -0.418996215615209, -0.746488172616949, -5.30610555107729, -0.398473934941990, -1.01198684950968, -1.53547279000320, -0.332241023752871, -0.911421770357180, -2.22433406454404, 0.235614717268163...
986,010
00fec62d3ee703ef7a42ff0fdda241a7a730530e
from django.urls import path from .views import create_post, view_post, edit_post, delete_post app_name = 'post' urlpatterns = [ path('create', create_post, name='create'), path('<uuid:pk>', view_post, name='view_post'), path('<uuid:pk>/edit', edit_post, name='edit_post'), path('<uuid:pk>/delete', dele...
986,011
962c3726db0dea9f08fe532a1420748a084a3823
def bi_sort(tree) : index = len(tree)-1 while (tree[index] < tree[index//2]) : tree[index], tree[index//2] = tree[index//2], tree[index] index = index // 2 T = int(input()) # 여러개의 테스트 케이스가 주어지므로, 각각을 처리합니다. for test_case in range(1, T + 1): # ////////////////////////////////////////////////...
986,012
f07896e393847aa5c755a7c5b5153840105be6e4
recl1 =int(input('enter first rectangle length:')) recw1 =int(input('enter first rectangle width:')) recw2 =int(input('enter second rectangle length:')) recl2 =int(input('enter second rectangle width:')) u1 = input('input your units:') r1 = recl1 * recw1 r2 = recl2 * recw2 if r1 > r2: print('rectangle one is large...
986,013
05827b6c5663215311385a86859ddd4a6a0a3faf
raise NotImplementedError("Not implemented you big dodo bird!")
986,014
87c0b367b73829a0192357744d1d3cc251dd3e5e
import logging from flask import Blueprint class NLPBlueprint(Blueprint): def __init__(self, name, import_name, init_func=None, url_prefix=None): self.init_func = init_func self.logger = logging.getLogger(__name__) super().__init__(name, import_name, url_prefix=url_prefix) def registe...
986,015
0f045bf17bcd6416c3c2e639b9e6b2a1d7aef6a5
import token_generator as token import ast import config import urllib.request def api_symptom_result(symptoms_ids, gender, year_of_birth): authKey = token.tokenGen() api_results_dict = {} get_symptoms_result = config.priaid_health_url + "/diagnosis?symptoms=[" + symptoms_ids + "]&gender=" + gender + "&ye...
986,016
252b9a0f12fb28f583aaf3257678494f5fd6e0b8
#-*- coding: utf-8 -*- # @Time : 2018/9/28 16:16 # @Author : Z # @Email : S # @File : 4.0dict.py #定义 d1={"apple":1,"banana":2} print d1 #zip函数 d2=dict(zip(["apple","banana"],[1,2])) print d2 #dict函数 d3=dict(apple=1,banana=2) print d3 #字典的删除 # del d2 # print d2 #NameError: name 'd2' is not defined #字典的清空 d2.cle...
986,017
9355fba9b1a5b50c548d4ee032bfb3f2195e2057
# Copyright 2015–2020 Kullo GmbH # # This source code is licensed under the 3-clause BSD license. See LICENSE.txt # in the root directory of this source tree for details. from WebConfig.settings.base import * DEBUG = True SECRET_KEY = 'cnz1i$692*1$6lz(ik+*vc%yb+47dstfr_^lckd-8(+fm&)1_s' EMAIL_BACKEND = 'django.core....
986,018
63ec2bfa51b83aee9f782b8dbe4ec8176cc633ef
# If you want MPE to log MPI calls, you have to add the two lines # below at the very beginning of your main bootstrap script. import mpi4py.rc mpi4py.rc.profile('MPE', logfile='cpilog') # Import the MPI extension module from mpi4py import MPI if 0: # <- use '1' to disable logging of MPI calls MPI.Pcontrol(0) # I...
986,019
5cefc1917c814b5496d98d9a7cbdc063b41f5b96
import socket c1=socket.socket() c1.connect(('localhost',9999)) print(c1.recv(1024).decode()) chat= input("enter your message : ") c1.send(bytes(chat,'utf-8')) #print("message send")
986,020
6a370578eaf176520231a707d6cc6da8599166b7
class Stack: def __init__(self): self.array = [] def push(self, num): self.array.append(num) def pop(self): if self.empty() is False: return self.array.pop() else: return -1 def size(self): return len(self.array) def empty(self): ...
986,021
ce0102e2e8b54b35d287eb45a48fe93c24e4551c
# This file was *autogenerated* from the file count_lattice.sage from sage.all_cmdline import * # import sage library _sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_0 = Integer(0) import math import numpy as np import scipy import scipy.optimize #import matplotlib.pyplot as plt import csv def ...
986,022
97a26f7848d194325363da63fba99a8ca4114f0d
import sys import numpy as np import random def main(): # Comprobacion de errores if len(sys.argv) < 5: print("Es necesario ejecutar el programa con los siguientes parametros:") print(" - python3 Crear_alfabeto num_copias num_errores fich_entrada fich_salida") return # Almacenam...
986,023
dcfd413e1b1863ffeb0fd179a1586fbbc37cf222
from rest_framework import serializers from .models import * class ClusterAvailabilityLevelSerializer(serializers.ModelSerializer): id = serializers.ReadOnlyField() class Meta: model = ClusterAvailabilityLevel fields = '__all__' class ClusterCpuOversubscriptionSerializer(serializers.ModelS...
986,024
e52f23b3710f37d06a8f844f1cc89861a828330c
#!/usr/bin/env python from __future__ import print_function import rospy from hal_protocol import HALProtocol, HALProtocolError #from hal.hw.m4atxhw import M4AtxHw, M4AtxHwError #from hal.hw.kinectauxhw import KinectAuxHw, KinectAuxHwError class PCHardwareAbstractionLayerError(HALProtocolError): pass class PCH...
986,025
2427e130897dceccaa62fed6ea0ac27c39561ac4
import csv from sklearn.externals import joblib import re import itertools as iters import numpy as np import pandas as pd def test(matrix): with open(matrix, "r") as file: train_fdata = [line.strip() for line in file if '>' != line[0]] SAA = ('ACDEFGHIKLMNPQRSTVWY') DIPEPTIDE = [] for dip...
986,026
51bc9d27855a97fca445e6acbef23ff2f80e664e
#This imports the python3 print function if this code is being run in python2 from __future__ import print_function import sys sys.path.append(sys.argv[0].replace("CreateDendogram.py","")) from ETFio import LoadETFCatalogue from createPlotArrays import createPlotArrays from ReadConfig import plotOptions from plotDend...
986,027
dabbca90e41aa4eb8d14b95ca519397902a484fc
from __future__ import absolute_import, division, print_function import libtbx.load_env from six.moves import range from six.moves import zip if (libtbx.env.has_module("ccp4io")): from iotbx import mtz else: mtz = None from iotbx.option_parser import option_parser from cctbx import sgtbx from cctbx import uctbx fro...
986,028
2dd4abe97a3102038001e17ab1965f5d30e6aa61
#!/Users/amansour/.brew/Cellar/python/3.7.4/bin/python3.7 import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import metrics def display_plot(data, x, y, cost_history, theta0_history, theta1_history): # Configurate the plot fig, axs = plt.subplots(2, 2, figsize=(8,8)) # Say,...
986,029
69b54afc5ae3cd3a8b4374470189d0b9aa0f9dd6
# External modules import numpy as np # Local modules from .. import geo_utils from .baseConstraint import GeometricConstraint class GearPostConstraint(GeometricConstraint): """ This class is used to represet a single volume constraint. The parameter list is explained in the addVolumeConstaint() of t...
986,030
27f5ae9f403104800b20185a378421cb22a91265
from django.shortcuts import render, redirect from django.contrib.auth.models import User from django.contrib.auth import login, logout, authenticate from django.contrib.auth.forms import UserCreationForm # Create your views here. def home(request): if request.POST.get('login'): username = request.POST['us...
986,031
d9619ab8fc76089a68ed83345549f387d2800c2a
# -*- coding: utf-8 -*- # mors alfabesi çözümü """ mors= { 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', ...
986,032
5f34c5c9975ff30bf382455f800b64c35067ea9a
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: slow = head fast = head finder = head while(True): if fast is None or...
986,033
36f0e1654b904ff60d290588997361d27ed96be1
def main(): # Setup stuff first_name = "Anna" last_name = "Jones" age = 34 msg = 'Hi {0}, your full name is {0} {1} and you are {2} years old'.format(first_name, last_name, age) print(msg) # We can also algin text msg = '{:>10}'.format(first_name,) print(msg) # And we can pad ...
986,034
a836f1b68cd25d844966a13807f4814bce488630
# aardvark (c) 2016 phreaklets # Inspired by: # - http://askldjd.com/2014/01/15/a-reasonably-fast-python-ip-sniffer/ # - http://www.binarytides.com/python-packet-sniffer-code-linux/ import getopt import datetime import time import sys import requests import simplejson from netaddr import IPAddress import logging impor...
986,035
330dc2af339364c0be3d2080054ba3629ddfc916
import keyword s="valid" print("Yes") if keyword.iskeyword(s) else print("No") #print ("Yes") if s.iskeyword() else print("No") s="gderre" #print ("Yes") if s.iskeyword() else print("No") #assert(isidentifier('foo'))
986,036
2501d4a2b47a39efb11e7ff9506eda0cdb8a10b1
#!/usr/bin/env python # -*- coding: utf-8 -*- import random while True: s = int(random.randint(1, 3)) if s == 1: ind = "石头" elif s == 2: ind = "剪刀" elif s == 3: ind = "布" m = input("请输入石头,剪刀,布, 输入end结束:") blist = ["石头", "剪刀", "布"] if m == "end": print("结束游戏...
986,037
a719e7528b1f59c7f6c2a507c21ab76d7075d8fb
import sys filename=sys.argv[1] infile=open(filename,"r") outfile=open("google.out","w") dict={'a':'y','b':'h','c':'e',' ':' ','\n':'\n','d':'s','e':'o','f':'c','g':'v','h':'x','i':'d','j':'u','k':'i','l':'g','m':'l','n':'b','o':'k','p':'r','q':'z','r':'t','s':'n','t':'w','u':'j','v':'p','w':'f','x':'m','y':'a','z':'q'...
986,038
75d79c6a4eb324a17862fe5bd216a9ab07a7d0d4
import os.path def get_urls(filename): if not os.path.isfile(filename): return None try: with open(filename, 'r') as file: urls = file.readlines() except: print("exception occurred in getURLs().") return None return [url.strip() for url in urls]
986,039
9abe945aa23c69cdbfbc07d211319429bcc1cca8
import pygame import random import sys import time WIDTH = 800 HEIGHT = 800 COLORS = { "white": pygame.Color("white"), "red": pygame.Color("red"), "green": pygame.Color("green"), "blue": pygame.Color("blue"), "black": pygame.Color("black"), "yellow": pygame.Color("yellow") } screen = pygame.d...
986,040
9ad353484bc754276253233100ae7e6f19cd95d1
from random import randint print(""" ************************************************************ * - Magic number Rules - * * A random number is taken between 1 and 10 and you've 4 * * try to take the right number * * ...
986,041
81b0ab075af00d71c568edfb3a708a0d0cea2bc6
"""Python3 implementation of CRAM. To use macros one must put the code in an own file and create a second file (the launcher) which activates MacroPy and then imports the file where the macros are used. E. g. if you have a file target.py which contains your code, create a file run.py: #!/usr/bin/env python import ma...
986,042
39117c8097fd3885818922910141164887a75b4e
# Generated by Django 2.0.1 on 2018-09-09 12:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('scores', '0024_auto_20180909_1939'), ] operations = [ migrations.RemoveField( model_name='total', name...
986,043
0ea51c92884de9539c81f778774502f8cbf6ff08
from . import dedicated, pooled __all__ = ["dedicated", "pooled"]
986,044
1ad958ad7b494f71bce773c2641d7bf714ae9055
import os, sys import urllib, json import requests import boto3 import crypto_client credentials = crypto_client.get_credentials("".join([os.environ["AUTO_ID_API_ENDPOINT"], "/Stage/verify"]), "".join(["secretsmanager,",os.environ["AUTO_ID_SECRET_NAME"]])) parts = credentials.split(',') sts_client = boto3.client('sts...
986,045
3efae291a45b67671f7a8c55cee9f86c008fe602
"""Utilities module. """ from importlib.machinery import SourceFileLoader def import_from_file(module_name: str, filepath: str): """Imports a module from file. Args: module_name (str): Assigned to the module's __name__ parameter (does not influence how the module is named outside of this ...
986,046
329a5e42fe6cacf09bd393c03d70843a1ab7a6a0
class Solution: def findKthPositive(self, arr: List[int], k: int) -> int: present = [False]*4000 answer = -1 for i in range(0, len(arr)): present[arr[i]] = True curr = 1 for i in range(1, len(present)): if present[i] == False and curr == k: ...
986,047
9217175f93e85ccac03414988ccb260ec083703e
#!/usr/bin/env python import rospy from std_msgs.msg import Float32 rospy.init_node('publish_radius', anonymous = True) pub1 = rospy.Publisher('radius', Float32, queue_size = 10) rate = rospy.Rate(10) r = 1 while not rospy.is_shutdown(): rospy.loginfo(r) pub1.publish(r) rate.sleep()
986,048
5cbdb308dfd9817a7b0e1f0eef213b1b8e7dc70c
from chainercv.extensions.evaluator.detection_coco_evaluator import DetectionCOCOEvaluator # NOQA from chainercv.extensions.evaluator.detection_voc_evaluator import DetectionVOCEvaluator # NOQA from chainercv.extensions.evaluator.instance_segmentation_coco_evaluator import InstanceSegmentationCOCOEvaluator # NOQA fr...
986,049
4d7ad85ea16884c36daa8cc769b9e9d52dd7ac65
import pandas as pd def sample_first_name(first_name_file, num_samples): """Load the file and get a distribution of first names. @param first_name_f is the location of the first names. """ df = pd.read_csv(first_name_file, header=None) df.columns = ["name", "gender", "count"] df = df[(df["cou...
986,050
3631520ba9932a4f1add4cf48b87851625c10012
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © Her Majesty the Queen in Right of Canada, as represented # by the Minister of Statistics Canada, 2019. # # Distributed under terms of the license. import pyarrow as pa import pyfwfr as pf import unittest import warnings from pyfwfr.tests.c...
986,051
b92aba1ec5497e21475b7be96d599ce9784cd9c1
def bomberMan(n, grid): configAtOneSecond = [list(word) for word in grid] configAtEvenSeconds = [list('O' * len(grid[0])) for word in grid] configAtThreeSeconds = GetConfigAtThreeSeconds(grid) if(n % 4 == 1): return ConvertListOfListToListOfString(configAtOneSecond) if(n % 2 == 0): r...
986,052
c98c97df0bd90c649a2ad4ece7d047442f1badcf
from pickle import load import sys with open(sys.argv[1], "rb") as file: predictions = load(file) truth, predicted = predictions for p in predicted: print(p)
986,053
f2a604a01cb967f9678f0b8d237d858a82a25af6
#!/usr/bin/python import autosklearn.classification import sklearn.model_selection import sklearn.datasets import sklearn.metrics X, y = sklearn.datasets.load_digits(return_X_y=True) X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, random_state=1) automl = autosklearn.classification.Au...
986,054
810fe90b121d08857f26bd174e8788a3145bb523
from flask import Flask, request, Response, jsonify import json import os import fnmatch import tempfile import shutil import zipfile from error import InvalidUsage from shape_importer.shp2pgsql import shape2pgsql from shape_importer.tab2pgsql import shape2pgsql as ogr2ogr from db_utils.postgis import geojson_from_ta...
986,055
5150e3cd9ba4d45619e3f2ad2acef2705ee157c9
# Copyright 2023 Matrix.org Foundation C.I.C. # # 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 agree...
986,056
5e6980367e89e4e41595148ad714994da70aaf1b
import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) GPIO.setup((20, 21), GPIO.OUT) try: while True: GPIO.output(20, GPIO.HIGH) sleep(5.0) GPIO.output(20, GPIO.LOW) sleep(5.0) GPIO.output(21, GPIO.HIGH) sleep(5.0) GPIO.output(21, GPIO.LOW) ...
986,057
ade5ac502cec6c68140792f309ab101c998f6f7c
from django.apps import AppConfig class ExperimentsConfig(AppConfig): name = 'experiments' verbose_name = "Experiments" def ready(self): from experiments.signals import ( # noqa new_experiment, experiment_pre_deleted, experiment_post_deleted, new_e...
986,058
4e0a879982fa967632ee34645bfdafffb54df5ce
from django.db import models class Piece(models.Model): class Meta: managed = True piece_id = models.AutoField(primary_key=True) piece_name = models.CharField(max_length=100) def __str__(self): return self.piece_name
986,059
1030a8afc593b3c5a4c0fd2cb514b9b050d7864e
def notas(*n, sit=False): """ -> Função para analisar notas e situação de aluno. :param n: uma ou mais notas (aceita mais de uma) :params sit: valor opcional, indicando se mostra ou não situação Aprovado, Reprovado ou Recuperação :return: retorna um dicionario com o total, a maior, a menor, a media ...
986,060
aa843db942dd4c2f9c26c676cdaa93c9820b08b0
"""A web application for tracking projects, students, and student grades.""" from flask import Flask, request, render_template import hackbright app = Flask(__name__) @app.route("/") def display_home(): return render_template("home.html") @app.route("/student-search") def get_student_form(): """Show for...
986,061
8fa6eec37a6d5f081f192ac63f59e0f20e98273b
#!/usr/bin/python from gstate import GState from ball import Ball from paddle import Paddle import random as r from graphics import * import time disc_div = 12 Ne = 128 #72 gamma = .72#0.373 (2/0.3)^gamma = 0.1 alpha_fac = float(771) #434 #Let Navg = game_ct*(2/0.3)*10/2/(12*12*12*2*3+1) #Ne = Navg/4 (explore 1/3 of ...
986,062
4ae5d1b3fa7f7ee613003ab3b942b3682e68b489
''' 自除数 是指可以被它包含的每一位数除尽的数。 例如,128 是一个自除数,因为 128 % 1 == 0,128 % 2 == 0,128 % 8 == 0。 还有,自除数不允许包含 0 。 给定上边界和下边界数字,输出一个列表,列表的元素是边界(含边界)内所有的自除数。 示例 1: 输入: 上边界left = 1, 下边界right = 22 输出: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22] 注意: 每个输入参数的边界满足 1 <= left <= right <= 10000。 来源:力扣(LeetCode) 链接:https://leetcode-cn.co...
986,063
bfba533b7f64767beb5ba81c1c958e1ed669c923
#!/usr/bin/env python # -*- coding: utf-8 -*- #---------------------------------------------------------------------- # Name: wx.tools.wxget # Purpose: wx Based alternative to wget # # Author: Steve Barnes # # Created: 06-Aug-2017 # Copyright: (c) 2017-2018 by Steve Barnes # Licence: wxWindows...
986,064
107ef05f775e7b69c64e56f80e3a23ac9402276d
# Generated by Django 2.0.3 on 2019-09-24 07:59 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Logo', fields=[ ('id', models.AutoField(aut...
986,065
782e99246cf15a42b21b8d1d430578f84d8ca6ab
import requests import pandas as pd BASE_URL = 'https://query2.finance.yahoo.com' def _make_request(url, response_field, **kwargs): params = { 'lang': kwargs.get('lang', 'en-US'), 'region': kwargs.get('region', 'US'), 'corsDomain': kwargs.get('corsDomain', 'finance.yahoo.com') } ...
986,066
4d10f3dfa122fd8a1b77a53c86aa91b8f3fb97a5
# Generated by Django 3.1.3 on 2021-01-06 11:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('audio', '0024_telugulevels'), ] operations = [ migrations.AlterField( model_name='telugulevels', name='name', ...
986,067
a2b24635acfdbcaef8ea8cbd91f2c51c4a2298b0
t=int(input()) for i in range(t): yoar=list(map(int,input().split())) x1=yoar[0] x2=yoar[1] x3=yoar[2] v1=yoar[3] v2=yoar[4] t1=(x3-x1)/v1 t2=(x2-x3)/v2 if (t1<t2): print("Chef") elif (t2<t1): print("Kefa") else: print("Draw")
986,068
842a9e6edbe03bc3414c7b6ba18f1b1b52ace0bd
""" 该模块做测试使用,可以删除 """ from flask import Blueprint, request, session from flaskapp.create_flask import app from mysql.create_db import db from models.person import Person blue_print_name = "/test" user_blueprint = Blueprint(blue_print_name, __name__) @user_blueprint.route('/create/') def create(): db.create_all...
986,069
650a108824f7eb1c4b8ef2e711b6291f51fc5fe4
import gpt_2_simple as gpt2 checkpoint_dir = './data/checkpoint' sess = gpt2.start_tf_sess() gpt2.load_gpt2(sess, checkpoint_dir=checkpoint_dir) single_text = gpt2.generate(sess, return_as_list=True, checkpoint_dir=checkpoint_dir)[0] print('-----BEGIN GENERATED TEXT-----') print(single_text) print('-----END GENERATED...
986,070
1db02e04526229fff82957ec515445888a8fb5d6
#!/usr/bin/env python3 import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt from PIL import Image import io import numpy as np import getpass import tkinter import socket import sys CODIGO_YES = bytearray([30]) CODIGO_NO = bytearray([31]) CODIGO_LOGOUT = bytearray([32]) CODIGO_ACK = bytearray([33...
986,071
973ccc81540e7697d6877d340d1bd7aedb68dbd4
from PIL import Image import glob r_left_border = 255 r_right_border = 255 g_left_border = 255 g_right_border = 255 b_left_border = 255 b_right_border = 255 r_fill = 255 g_fill = 255 b_fill = 255 def restore_images(directory_path): types = (".jpg", ".jpeg") for type in types: for filename in glob.gl...
986,072
45f192ba89aeb8705a0ca78789fbb1017e6fda52
from django.urls import path from . import views urlpatterns = [ path('home/', views.index, name="index"), path('home/', views.homeview, name="homeview"), path(r'produkt/<int:id>/', views.produkt, name='produkt'), path(r'dyqan/<int:id>/', views.dyqan, name='dyqan'), path(r'dyqan/<int:id>/inventar/'...
986,073
3c348856243702b6cf8328228bb01953f9b33153
#!/usr/bin/env python import os import re import here import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web import redis.client from tornado.options import define, options from tornado_utils.routes import route import handlers import settings define("debug", default=False, help="ru...
986,074
053fb34edc42a69458256bf839e767499cd7cf4f
import numpy as np import tensorflow as tf class MlpPolicy: def __init__(self, obs_dim, act_dim, hid1_mult, policy_logvar, obs_ph): self.obs_dim = obs_dim self.act_dim = act_dim self.hid1_mult = hid1_mult self.policy_logvar = policy_logvar self.obs_ph = obs_ph def buil...
986,075
789642ef8f29079a4f0e234193d75ee25732c7e4
import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.linear_model import LogisticRegression import seaborn as sns le = LabelEncoder() df = pd.read_csv('telecom_churn.csv') df.dropna(inplace = True) df['gender'] = le.fit_transform(df['gender']) df['SeniorCitiz...
986,076
6712a109b4fd996cd5d2d4088732109b21d2eae9
__author__ = 'sergejyurskyj' D = {'a': 1, 'b': 2, 'c': 3} print(D) Ks = D.keys() # Sorting a view object doesn't work! # Ks.sort() # AttributeError: 'dict_keys' object has no attribute 'sort' print('#' * 52 + ' Force it to be a list and then sort') Ks = list(Ks...
986,077
69d789b7daf3aed9bbde4783427ad0792bcb870f
import csv def cargar_datosCSV(ruta): with open(ruta) as cont: archivocsv = csv.reader(cont) encabezado = next(archivocsv) print("******------DATOS EN CSV-------*****") print(encabezado) print() for registro in archivocsv: print(registro) print("La clase de la es...
986,078
8719c87d728f4932067c299df2a9185dff81b609
# -*- coding: utf-8 -*- """ Django rest_framework ViewSet filters. """ from uuid import UUID from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db.models import Q from django.http import Http404 fro...
986,079
b0fe188b2a22fc804b5e21982d7302a8c9d29c0e
TOKEN = "" # Telegram Bot Token
986,080
4d2ddcc0d91322e41567f25d7cbe5235a229299b
metadata = """ summary @ X.Org initialisation program homepage @ http://xorg.freedesktop.org/ license @ custom src_url @ http://xorg.freedesktop.org/archive/individual/app/xinit-$version.tar.bz2 arch @ ~x86_64 """ depends = """ runtime @ x11-libs/libX11 x11-apps/xauth """ def prepare(): patch("06_move_serverauthf...
986,081
32c306368c09eb0105c7ca750e8e879a1aadb1eb
# coding=UTF-8 from AES import AES import numpy as np key = 0x3220db6534d687f844c41b6de5a4c737 aes = AES(key, 1, 0) inp_row = np.array([172,47,117,192,67,251,195,103,9,211,21,242,36,87,70,216]) cipher_text, trace = aes.encrypt(inp_row) assert ([173,205,44,52,32,86,75,184,193,231,36,82,28,6,44,234] == cipher_text).all...
986,082
ce629ed32e2b925bf3f6a99fea22a684bf3152e2
def canFinish(numCourses, prerequisites): """ :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool """ graph = [[] for _ in range(numCourses)] visited = [0] * numCourses for course, pre in prerequisites: graph[course].append(pre) def dfs(i): if vi...
986,083
f81917d172a0b222e1625607333f34fdcc3cced0
from datetime import date hoje = date.today().year maior = 0 menor = 0 for c in range(0,7): n = int(input('Digite a data de Nacimento: ')) idade = hoje - n if idade >= 18: maior += 1 else: menor += 1 print(f'{maior} são Maiores de IDADE') print(f'{menor} são Menores de IDADE')
986,084
46bdf02509d3e53edc1e48593d9e775dfb2adda1
import os import numpy as np import pandas as pd import cv2 import panZoom DATAHOME = '/home/ctorney/data/tz-2017/' CODEHOME = '/home/ctorney/workspace/wildGradient/' inputname = CODEHOME + '/irMovieList.csv' #dfMovies = pd.read_csv(inputname,index_col=0) # initialize the list of points for the rectangle bbox, #...
986,085
68f5fac3d032b0c54385057952aa3be7d4f4dac6
# Cody Hancock | Student ID: #001087330 class Package: def __init__(self,pkgID, pkgAddress, pkgCity, pkgState, pkgZip, pkgTime, pkgValue, pkgNote): self.pkgID = pkgID self.pkgAddress = pkgAddress self.pkgCity = pkgCity self.pkgState = pkgState self.pkgZip = pkgZip se...
986,086
03a0bc619da080e137df3870bc346dd6e062f6f4
''' Perform basic database operations (CRUD) ''' def insert(connection, table : str): with connection.cursor() as cursor: sql = 'INSERT INTO {} (text) VALUES (%s)'.format(table) cursor.execute(sql, ('test')) connection.commit() def update(connection, table : str, record : int): with connec...
986,087
f0cc78b282101ea3701e47a7c64b197c54dee153
""" Form Validation Module """ # local Django from app.modules.validation.extensions import * from app.modules.validation.validator import Validator from app.modules.validation.sanitizer import Sanitizer from app.exceptions.sanitization_rule_not_found import Sanitization_Rule_Not_Found from app.exceptions.validation_r...
986,088
20055f6c21daa6a4e073f6bbbb166d976362715a
#ReverseLookup\ def reverseLookup(data, value): keys = [] for key in data: if data[key] == value: keys.append(key) return keys def main(): antonyms = {"sad" : "happy", "sad" : "cheerful", "left" : "right", "stop" : "go", "sweet" : "sour"} print("The antonym for 'left' is: ", reve...
986,089
6d6bf59888b28e765212aa53f4e1587b518d35a6
from django.db import models # Create your models here. class TodoItem(models.Model): content = models.CharField(max_length=1024) created_time = models.DateTimeField(auto_now_add=True) finished_time = models.DateTimeField(auto_now=True) finished = models.BooleanField() def __unicode__(self): ...
986,090
68ebaf50f15af44e2b78aebd2902201c140d688a
import pytest from api_test_utils.api_test_session_config import APITestSessionConfig from api_test_utils import poll_until, PollTimeoutError from api_test_utils.api_session_client import APISessionClient @pytest.fixture def api_test_config() -> APITestSessionConfig: yield APITestSessionConfig(base_uri="https:...
986,091
22ffbf4d38a8cc81e19b3535ccec8f6e8b570a4f
from django.contrib.auth import get_user_model from django.db import models from creator.ingest_runs.common.model import IngestProcess from creator.files.models import Version DELIMITER = "-" NAME_PREFIX = "INGEST_RUN" INGEST_QUEUE_NAME = "ingest" User = get_user_model() class IngestRun(IngestProcess): """ ...
986,092
bc39c2c13968dbaba59680ab20d270b32327b42f
import webapp2 from numpy import * from math import * from google.appengine.ext import db from models import * from classification import * class Test(webapp2.RequestHandler): """ Script to test classification algorithm """ def get(self): self.response.headers['Content-Type'] = 'text/plain' ...
986,093
b4ef03c2d9a50ae6acc4de18036533f4ba3f9eea
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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 applicab...
986,094
d77e3e7687cce527f6b63672f27de0df55e03c64
from django.db import models from django.contrib.auth.models import User class Medico(models.Model): ESPECIALIDADES = ( ('Cardiologista', 'Cardiologista'), ('Clínico Geral', 'Clínico Geral'), ('Dermatologista', 'Dermatologista'), ('Ortopedista', 'Ortopedista'), ) user = mod...
986,095
428991ebcfe5288e9e62b2371a899331075dd133
class Peca(): def __init__(self,x,y): self.x = x self.y = y self.w = 100 self.h = 100 self.dx = 0
986,096
43ea1ed104990b0980e98af462b6999bc0facd1d
# pylint: disable=C0103 # pylint: disable=C0111 # pylint: disable=C0301 import argparse import json import sys import os import threading import logging import time import curses import ConfigParser from shutil import rmtree from shutil import move from getpass import getpass from time import sleep from pprint import ...
986,097
984a31ef042251aee044a9ac8e696e9bfd527629
# maze using Q-learning algorithm. import numpy as np from maze_recursive_division import generateMaze def init(t_nrow, t_ncol, t_nAction=4): r""" | DOWN Right LEFT UP --------|---------------------------------------- (0, 0) | (0, 1) | (., .) | """ nState ...
986,098
2c9512e8261e201d8d201e4d0d1cbbdf63ecdeb0
def isValid(s): # Write your code here freq_dict, is_valid = {}, False # Calculate frequencies of characters for char in s: if char not in freq_dict: freq_dict[char] = 1 elif char in freq_dict: freq_dict[char] += 1 # Determine if string is valid ...
986,099
3fc0e0bb9fb3d98d87b77d05b00016c5baa00cae
from django.contrib import admin from models import Tipo_grupo_especialidad, Grupo_especialidad, Especialidad from models import Doctor, Doctor_horario, Paciente from models import Cita # from models import Tipo_grupo, Tipo, Doctor, Paciente class DoctorAdmin(admin.ModelAdmin): list_display = ('nombres', 'apellid...