index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
994,300 | 80be46c0370a5a428411e40e7134eadef638f781 | import cv2 as cv
img = cv.imread("Ronaldo-1.jpg",1)
cv.imshow("Image",img)
#Create a new img
cv.imwrite("New_cr7.jpg", img )
cv.waitKey(0) |
994,301 | d16f0baa99ce9ba51d36b82098f3348e29118200 | x = int(input("Enter a number : "))
if x > 0 :
print("+1")
elif x < 0 :
print("-1")
|
994,302 | b14e8fffe40f065448acc8ec244eee001d017aea | from django.contrib import admin
from models import ImagePool
admin.site.register(ImagePool)
|
994,303 | 0e4101fe62e12774e70ca6a21e7a5e7cd5ecab01 | from .base import *
DEBUG = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'USER': 'root',
'PASSWORD': os.environ.get('mysqlPassword'),
'HOST': '127.0.0.1',
'PORT': '3306',
'NAME': "hellofamily_db",
'TEST': {
'NAME': 'test... |
994,304 | 4229b5a77f09a9d51bb0cb59d4f3b685cd4f282b |
#calss header
class _MICROPHONE():
def __init__(self,):
self.name = "MICROPHONE"
self.definitions = [u'a piece of equipment that you speak into to make your voice louder, or to record your voice or other sounds: ']
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.spe... |
994,305 | 011b2d26341d3cef824331a7716125ccb6bfc904 | # -*- coding: utf-8 -*-
""" Unit test for pyKwalify - Rule """
# python std lib
import unittest
# 3rd party imports
import pytest
# pyKwalify imports
import pykwalify
from pykwalify.errors import RuleError, SchemaConflict
from pykwalify.rule import Rule
from pykwalify.compat import unicode
class TestRule(unittest... |
994,306 | b7a3c5ae7828c88f98b603d366552dd418866934 | """ views init """
from flask import Blueprint
from models.user import User
from models.city import City
from models.state import State
from models.review import Review
app_views = Blueprint('app_views', __name__, url_prefix='/api/v1')
"""Wildcard import views"""
from api.v1.views.index import *
from api.v1.views.us... |
994,307 | 8c844468ed2bcb14ca9d175073bcdc999b146550 | # b=0
# c=0
# while b<=9:
# b+=1
# c+=int(input())
# print(c)
# res = 0
# for i in range(10):
# res += int(input())
# print(res)
# a_list = []
# for num in range(10):
# list_num = int(input("Enter a number:"))
# a_list.append(list_num)
# print(sum(a_list))
# =========================... |
994,308 | 8b3374a5bb1e564384049c517df1b84ae302d221 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 12 14:44:08 2016
@author: Jonater
"""
import math
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
import sklearn.preprocessing as preprocessing
from sklearn.datasets import make_classifi... |
994,309 | 802e0f9c7d3b66f770bc331734a3ed45fe7c3fcc | import sys
import getopt
import os
import tushare as ts
from datetime import datetime, timedelta
def get_dates(start, end):
datefmt = '%Y-%m-%d'
if end:
startdate = datetime.strptime(start, datefmt)
enddate = datetime.strptime(end, datefmt)
date = []
while enddate - startdate ... |
994,310 | bca5c0e15344c7f70a688aa0121fdc69d32fcfb6 | import json
from time import time
import aiohttp_jinja2
from aiohttp_session import get_session
from aiohttp import web
from auth.services import check_user_auth
from auth.models import Token
def redirect(request, router_name):
url = request.app.router[router_name].url()
raise web.HTTPFound(url)
def set_ses... |
994,311 | 637151bcb128adb9431106dc95a54ea290d87897 | class Solution:
def uniquePaths(self, m: int, n: int) -> int:
if m == n == 0: return 0
# DP 算法,记忆表初始化
table = [[None for _ in range(n)] for _ in range(m)]
# 赋初值
for i in range(n):
table[-1][i] = 1
for i in range(m):
table[i][-1] = 1
... |
994,312 | ee7de9520745d4619a249fcad126b3262b6c6064 | # Generated by Django 2.1 on 2019-09-12 22:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apps', '0006_auto_20190912_1703'),
]
operations = [
migrations.AlterField(
model_name='profesional',
name='Foto',
... |
994,313 | 847151e5af6e982577155e2af6c140942f4938ae | __author__ = 'spersinger'
from .generator import Generator
from .verifier import Verifier
def generate(secret = None, message="", iv=None, now=None):
"""Public: generates a fernet token
Returns the fernet token as a string.
:param secret
:param message
:param options
"""
return Generator(s... |
994,314 | dd3338b6f1a1e2a66bbe719a3510a1e787e69482 | import ssa
import numpy as np
import matplotlib.pyplot as plt
def run():
reactants = np.array([[1, 1, 0, 0], [0, 0, 1, 0], [0, 0, 1, 0]])
products = np.array([[0, 0, 1, 0], [1, 1, 0, 0], [0, 1, 0, 1]])
volume = 1e-15
x0 = np.array([5e-7, 2e-7, 0, 0])
x0 = ssa.util.molar_concentration_to_molecule... |
994,315 | feb04c23e7dcfd6a6e0db8896782401672bba551 | # Generated by Django 3.2.6 on 2021-08-30 14:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ap', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='question',
old_name='text',
new_name=... |
994,316 | 3911c42dfabb00a8f7a6c70157b9357051bb7cda | #!/usr/bin/env python3
import sys
S = input().strip()
cnt = 0
for s in S[0::3]:
if s != 'S':
cnt += 1
for s in S[1::3]:
if s != 'O':
cnt += 1
for s in S[2::3]:
if s != 'S':
cnt += 1
print(cnt)
|
994,317 | 7f9504e874c9f65e7d1981dab80f43455d9bde01 | import maya.cmds as m
from peel_solve import locator
def load():
p = r'E:/git/amazon/peelsolve/build_2020/peelsolve2020/Debug/peelsolve2020d.mll'
m.loadPlugin(p)
def unload():
m.unloadPlugin("peelsolve2020d.mll");
def simple():
m.file(f=True, new=True)
m1 = m.spaceLocator(name="m1")[0]
m2 =... |
994,318 | 3ebf870d7467d779e37ef20acccd145b3547add8 | class Solution:
def getDistances(self, arr: List[int]) -> List[int]:
prefix = [0] * len(arr)
suffix = [0] * len(arr)
numToIndices = collections.defaultdict(list)
for i, a in enumerate(arr):
numToIndices[a].append(i)
for indices in numToIndices.values():
for i in range(1, len(indices)... |
994,319 | fdfb2ad3406966db586f8c493d4e7cca0dcd837e | # Immobile constructions in a level- walls, doors, windows etc.
# can take damage and be destroyed or rebuilt. Goes on top of floors, networks, and terrain.
# Goes under entities but can be impassible.
from src.world.tiles import Tile
class Structure:
def __init__(self, name, impassible=False, opaque=False, tile... |
994,320 | 938e0165a6e0a5affa1e29606a5cd23f9c77d2cf | import datetime
import os.path
import warnings
from collections import OrderedDict
import time
import copy
import requests
import gevent
from matrx.actions.object_actions import *
from matrx.logger.logger import GridWorldLogger
from matrx.objects.env_object import EnvObject
from matrx.objects.simple_objects import A... |
994,321 | 5e6e74536f04699001d4bd47ac0f1ed9c29e56f8 | from threading import Timer,Thread,Event
import numpy as np
from intersec_okr import *
import threading
import time
import socket
import json
class Tracker:
def __init__(self, nodes):
self.trace_max = 50
self.complx = []
self.comply = []
self.nodes = nodes
self.rootX=[0, 1200, 2700, 5000, 1000... |
994,322 | a2284972feda969222088d75b98e959154d8294e | from mainapp.views import Comment
from rest_framework import generics
from mainapp.serializers import CommentSerializer
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_MET... |
994,323 | 0d0a3d1bc9ad4fcc3e2d6d626697b3c7e65fc469 | nums = []
isInput = True
while isInput == True:
x = input("请录入一个整数(输入STOP结束):")
if x != "STOP":
nums.append(int(x))
else:
isInput = False
target = int(input("请录入目标整数:"))
isFind = False
n = len(nums)
for i in range(n):
for j in range(i+1, n):
if nums[i] + nums[j] == target:
... |
994,324 | dc1cd79949ff13d1faa22795fe41de2c3a8493e4 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-03-07 17:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('website', '0002_auto_20170307_2321'),
]
operations = [
migrations.AlterModelOptions(
... |
994,325 | b88465f8f9316f77ee60680122f6e068680b77af | from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here.
class ContinentsView(TemplateView):
template_name = 'continents/continents.html'
def get_context_data(self, *args,**kwargs):
america = {
'name': 'america',
'translation':... |
994,326 | deb43590037743439cc149d8d5202580fb39a51d | class Solution:
def minDistance(self, word1: str, word2: str) -> int:
m, n = len(word1), len(word2)
if m == 0 or n == 0: return (m+n)
dp = [[0]*(n+1) for _ in range(m+1)]
for i in range(1,m+1):
dp[i][0] = i
for j in range(1,n+1):
dp[0][j] = j
f... |
994,327 | f45ac92cb78ae535bcf055759029eb4f0f54d65f | import re
import responses
from django.test import TestCase
from django.forms.models import model_to_dict
from rest_framework.test import APIClient
from requests.compat import urljoin
from api import models
from api import scrapper
from api.test_files import week
from api.test_files import detail
class FilmViewTes... |
994,328 | 67394c7c445030f753de808bc88e907cc407c6ea | import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.webelement import WebElement
class ChatElement(WebElement):
def __init__(self, chat: WebElement):
"""A WebE... |
994,329 | c3b074052c1c9e78d5007bcece81eb21a9fd39ac | import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from monitoring_plot_auc import (plot_cost, plot_auc, plot_l2)
DEF_COLORS = ["blue", "green", "red", "black"]
def plot_fprs(df, iters):
plt.figure(figsize=(3, 2))
n_min = min(df.shape[0], len(iters))
for i, col in enumerate... |
994,330 | cf9ca4823c8bbab3b9958d12767adf3cd3b287d3 | from django.contrib import admin
from reversion.admin import VersionAdmin
from base.admin import json_enabled_form
from reportforms.models import (
ReportForm,
ReportFormVersion,
ReportFormInstance,
FormInstanceRequest
)
@admin.register(ReportForm)
class ReportFormAdmin(VersionAdmin):
list_displa... |
994,331 | 19d9eba720eba452ec4cc33e9dd0e75c2f3244ab | #import modules
import os
import csv
#define csv file outputs as list
date, revenue = ([] for i in range(2))
# input and output files
input_file = "budget_data.csv"
output_file = "financial_analysis.txt"
# input and output paths
csvpath = os.path.join('..', 'PyBank', 'budget_data.csv')
txtpath = os.path.join('..', ... |
994,332 | 8058be39e9fa9b310abe9c89a630aff04580a8cc | # 1-51 jieba原有的停用詞檔
# 52-61 機器學習
# 62-67 深度學習
# 68-88 機器人
# 89-94 演算法
# 暫時
|
994,333 | 5ce43febe0ba780861dd2da38c2c58a9c6501edb | from django.urls import path
from . import views
from django.views.generic.base import TemplateView
urlpatterns = {
path('add_annotation', views.add_annotation),
path('getChatGroupPapers', views.getChatGroupPapers),
path('getChatGroupMembers', views.getChatGroupMembers),
path('createChatGroup', views.c... |
994,334 | da3d4d728320ffce809ac569222bd64b3f994524 | def rfactor(h,rmask):
"""
function r = rfactor(h,rmask)
This function computes the bathymetry slope from a SCRUM NetCDF file.
On Input:
h bathymetry at RHO-points.
rmask Land/Sea masking at RHO-points.
On Output:
r R-factor.
"""
Lp, Mp = h... |
994,335 | 640806d69f7b51ac71f18a14b53ae97fff7643c3 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
dummy = ListNode(-1)
slow,fast = dummy,head
dummy.next = head
while fast is n... |
994,336 | dd7fcfc40d53c21e8910dc773aa4792f00360b03 | # -*- coding: utf-8 -*-
"""
用CNN处理脑影像数据
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df_x_tumour=pd.read_csv('tumour_3.csv',header=None)
#删除值全为零的行
df_x_tumour_1=df_x_tumour #借用一个中间变量
for i in range(0,df_x_tumour.iloc[:,0].size):
list_row=list(set(list(df_x_tumour.iloc[i])))#每一行不重复的数... |
994,337 | 6f665051feda967f363aa15617e0e0e56d51abb5 | import commands
import os
import time
import pickle
import json
from Constants import Constants
from Task import Task
from File import File, EventsFile
import Utils
class CondorTask(Task):
def __init__(self, **kwargs):
"""
This is a many-to-one workflow.
In the end, input-output mapping m... |
994,338 | 451c863ae00bd0733744b12ea5516d268327c6cf | #Flashcard creator
import tkinter as tk
import tkinter.messagebox
import tkinter.filedialog
def newFlash(event):
import newFlash
newFlash.newFlashCards()
def editFlash(event):
tkinter.messagebox.showinfo("Edit Flashcards", "Edit Flashcards")
"""
import editFlash
editFlash.(functio... |
994,339 | 99f9f9a0a9507e430776967c03366b34ecdb278b | from flask import Flask , render_template ,request
import pandas as pd
import pickle
import numpy as np
app = Flask(__name__)
bikes = pd.read_csv("E:/project_bike/Cleaned_data.csv")
model = pickle.load(open('E:/project_bike/LinearRegressionModel.pkl', 'rb'))
@app.route('/')
def index():
brands = sorted(bikes['br... |
994,340 | 4e55873c9c02666daceef0dc944da34e2edaef14 | # Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя:
# имя, фамилия, год рождения, город проживания, email, телефон.
# Функция должна принимать параметры как именованные аргументы.
# Реализовать вывод данных о пользователе одной строкой.
def user_data_print(name, surname, birth_yea... |
994,341 | fe1cae6c9581b20ee27a6a0dfbe59c133e1cf7fe | from flask import Flask, render_template, request, redirect, session
app = Flask(__name__)
app.secret_key = 'X8zad82VwK782GPc'
app.count = 0
def set_session():
session['count'] = 0
@app.route('/')
def index():
session['count'] += 1
return render_template('index.html', count = session['count'])
@app.rou... |
994,342 | d3749f04437307cae57a812e13ab415561404008 | import yaml
import os
from pprint import pprint
## define custom tag handler
def join(loader, node):
seq = loader.construct_sequence(node)
return ''.join([str(i) for i in seq])
def ujoin(loader, node):
seq = loader.construct_sequence(node)
return '_'.join([str(i) for i in seq])
def join_path(d, root)... |
994,343 | 093c55951e9e4091983952f6431d6ddd3d587886 | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
PRODUCT_CHOICES=(
('TV','tv'),
('IPAD','ipad'),
('PLAYSTATION','playstation'),
)
class Sale(models.Model):
product=models.CharField(max_length=20,choices=PRODUCT_CHOICES)
seleman=models.ForeignKey(User,on_delete=mo... |
994,344 | 0d35d9bc4e56beaa523464e98114c8ff2c93ed95 | def get_most_freq_indices(list_of_indices,index_map_dict):
new_indices = []
for index in list_of_indices:
try:
new_indices.append(index_map_dict[index])
except KeyError:
print("This shouldn't have happened. An index was not found in the index map. Currently changed to unk... |
994,345 | cebbd209f94584953d6a21eb6b9c4491194cc23f | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-13 16:30
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('regions', '0005_omit_city'),
]
operations = [
... |
994,346 | aef5cfa20ea5b6c2829198be7da4201439a9060e | # Generated by Django 2.0.6 on 2018-06-28 23:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('registration', '0014_auto_20180628_2314'),
]
operations = [
migrations.AlterField(
model_name='... |
994,347 | 7152ce21f0ab1b401289fc2ab302abee3d9f123f | def heap(arr, n, i):
largest = i
l = 2 * i + 1
r = 2 * i + 2
if l < n and arr[i] < arr[l]:
largest = l t exists and is
# greater than root
if r < n and arr[largest] < arr[r]:
largest = r
if largest != i:
arr[i],arr[largest] = arr[largest],arr[i]
heap(ar... |
994,348 | a65840ee0030d72f49f4ab1cc661354e7b9f3e95 | # Create a class to hold a city location. Call the class "City". It should have
# fields for name, lat and lon (representing latitude and longitude).
class City(object):
def __init__(self, name, lat, lon):
self.name = name
self.lat = lat
self. lon = lon
# We have a collection of US cities... |
994,349 | f8ae73dcf7b1f960c6e49590d809e2e8a8fde41f | import unittest
"""
Tests for different Repository's.
"""
# TODO: To implement
class AccountRepositoryTest(unittest.TestCase):
pass
class UserRepositoryTest(unittest.TestCase):
pass
|
994,350 | 81380aa29b5dfaa6f7e9c52621254f84ab2adbc3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the python-chess-ai.
# Copyright (C) 2018 Lars Dittert <lars.dittert@de.ibm.com> and Pascal Schroeder <pascal.schroeder@de.ibm.com>
#
# Implementation of player interface for API given input
#
from player.interface import PlayerInterface
class Pl... |
994,351 | 10e415c55d57f9b94287cd8f91a0c7ea07f7e80f | # For all questions, use the following class definitions
class MaxHeap(object):
# Constructor
def __init__(self):
self.tree = []
# --------------------------------------------------------------------------------------------------------------
# Problem 19
# ----------------------------------... |
994,352 | 7797599dffccd56d268e258632e0b3eb53f965c2 | class Person:
def __init__(self, name, age, married):
# Public members
self.name = name
self.age = age
# Private member
self.__married = married
# Mutator
def birthday(self):
self.age += 1
# Accessor
def getName(self):
return self.name
... |
994,353 | 3ab8c57842612dd8f8dc52d866683a6e56ef46bd | from turtle import Turtle
import random
# The food class inherits from the turtle, it can call all of its attributes
class Food(Turtle):
def __init__(self):
super().__init__()
self.shape("circle")
self.penup()
self.shapesize(stretch_len=0.5, stretch_wid=0.5)
self.color("y... |
994,354 | 8cab1c1f8c5e6299a550af4474dfca10d5f47546 |
import copy
import json
import logging
from . import utils
# -------------------------------------------------------------------------------------------------
def _update_config_by_args(config, args, prefix=""):
for k, v in config.items():
arg_name = prefix + k.replace("-", "_")
if isinstance(v,... |
994,355 | e7c4c7c2af8c8c9918b1a8385de15350962e8b9d | import get_report
import get_token
import requests
import json
def main():
get_report.print_the_header()
url = 'http://api.wunderground.com/api/{token}/{features}/{settings}/q/{query}.{format}'
code = input('What zipcode do you want the weather for (21234)? ')
payload = {'token': get_token.get_toke... |
994,356 | 6741bce14bd6b833cc84cb60d37bd63a4494284b | from typing import Any, Dict, Optional
import cloudpickle as pickle
from cloudpathlib import AnyPath
class Artifact:
MAGIC_KEY = "__yamlett_artifact__"
def __init__(self, path: AnyPath, key: str, value: Optional[Any] = None):
self.path = path
self.key = key
self.value = value
@s... |
994,357 | e45580f3aae8815255fb583a01395479122643d7 | def make_read(secs):
h = int(secs)/3600
m = int(secs)/60
s = int(secs) % 69
r = secs % 1
out = []
if h > 0: out.append(str(h))
if m > 0: out.append(str(m))
if s > 0: out.append(str(s))
out = [':'.join(out)] |
994,358 | 9ff4e2cdf0bcfa856a15587ba93a1072b86731df | '''This is the main program file for the auto grader program.
Auto_grader takes as input:
--directory (-d) [REQUIRED]: the directory containing all the student directories
where their assignment submissions are located in the appriopriate assignment
sub-directory.
--assignment (-a) [REQUIRED]: the assignment nu... |
994,359 | f63648b079029268ca745ea5c7b914ec84333d6c | import os
import re
from lxml import html, etree
from logger import *
def get_scraper(url):
if url:
if url.find('amazon.com') >= 0:
return AmazonScraper(url)
elif url.find('newegg.com') >= 0:
return NeweggScraper(url)
elif url.find('buy.com') >= 0:
... |
994,360 | 05712f51b21adacdd0151eb144f081435aae3257 | """
Analyser module
"""
import threading
import Queue
import time
import cv2
import numpy as np
import numpy.matlib
import DetectChars
import DetectPlates
import RemoteMain as GLOBAL
SCALAR_BLACK = (0.0, 0.0, 0.0)
SCALAR_WHITE = (255.0, 255.0, 255.0)
SCALAR_YELLOW = (0.0, 255.0, 255.0)
SCALAR_GREEN = (0.0, 255.0, 0.0... |
994,361 | cd7e1d0a3c275cc7520c81c92f7b5a21a53dc4c5 | #! /usr/bin/python
import sys
import re
def sum_line(numbers):
r = 0
for n in numbers:
r = r + int(n)
return r
def parse_line(line):
return re.findall('[+-]?\d+', line)
def parse_input():
data = []
for line in sys.stdin:
data.append(line.split("\n")[0])
return ... |
994,362 | c3ab702262a70c1cef031bcf29813e6c8e7be82f | import os
MyOS = os.uname()
print(MyOS)
|
994,363 | 76213e1c731aaee24d58fb2d7d6b12d81f6108b1 | #!/usr/bin/env python
import socket
import struct
import sys
import os
import time
import binascii
import math
from random import randint
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseWithCovarianceStamped
import tf
#PC_IP = "192.168.0.145" #127.0.0.1"
PC_IP = "192.168.0.102" ... |
994,364 | 94ef38d957acdd0975eac84d069750e3ff1771e0 | a = int("1c0111001f010100061a024b53535009181c",16)
b = int("686974207468652062756c6c277320657965",16)
print(hex(a^b)) |
994,365 | e26efea8cc37636b575322bfbd3e3e2c4ddf1d0a | import os
import random
import pytz as pytz
from auth_operations import r
from datetime import datetime, timedelta
from pymongo import MongoClient
# MONGO_CONNECTION = 'mongodb://localhost:27017/'
MONGO_CONNECTION = "mongodb+srv://{}:{}@cluster0.yx4fl.azure.mongodb.net/DigestAppDB?retryWrites=true&w=majority".format(... |
994,366 | 093d12e933059359cc33de950bad62a46ccee1cd | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i... |
994,367 | 769a5f3905449336a70252b5726db630099dc928 | /home/ayushjain1144/miniconda3/lib/python3.6/operator.py |
994,368 | 8671da76c2508493c1f23294029300916db1d85f | from random import choice
from Core import Statistics
from Lib.IPv4 import IPAddress
is_ipv4 = IPAddress.is_ipv4
class PcapAddressOperations():
def __init__(self, statistics: Statistics, uncertain_ip_mult: int=3):
"""
Initializes a pcap information extractor that uses the provided statistics for... |
994,369 | 110f1f19af116269a258207a91bb9db1a324447b | import sys
import time
sys.stdin = open("최소이동거리.txt")
# 단방향임에 주의할것!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
str_time = time.time()
T = int(input())
def dijkstra(v):
ga[v] = 0
while not visited[V]:
tem = 99999999
u = 0
for i in range(V+1):
if visited[i]==0 and ga[i] < tem:
... |
994,370 | ab0e47e19e4ca0b66fa4a5fd803a016866f8217b | import unittest, match_word_non_word
class TestMatchWordNonWord(unittest.TestCase):
def test_match_word_non_word(self):
self.assertEqual(
match_word_non_word.match_word_non_word('www.hackerrank.com'), 'true')
if __name__ == '__main__':
unittest.main()
|
994,371 | e1d86f299d5d685124956c9f5bdb1e0268d649df | #!/usr/bin/env python3
"""
--- Day 13: Shuttle Search ---
https://adventofcode.com/2020/day/13
Part 1: Find the coset -d + k * ZZ with the smallest nonnegative element
for a fixed integer d and a list of candidates for k.
Part 2: Solving multiple congruence relations (Chinese remainder theorem)
Solutio... |
994,372 | 778d27e8aa034053fb0b1f5cdaa62df8736fc843 | from invoke import task
@task
def genpsw(content, certificate_file, file_save=True):
pass
|
994,373 | 851005660c424815a9297e6e17db5b32afe23454 | #! /usr/bin/env python
#coding:utf-8
class Me(object):
def test(self):
print "Hello"
def new_test():
print "New Hello"
me = Me()
print hasattr(me. "test") # 检查 me 对象是否有 test 属性
print getattr(me, "test") # 返回 test 属性
print setattr(me, "test", new_test) # 将 test 属性设置为 new_test
print delattr(me, "test") #... |
994,374 | ae851b0947639558638690e35073f786092fe741 | Marketing 311
Tony
10 questions about marketing
1. Agree
2. Agree
3. Not sure
4. Not sure
5. Disagree
6. Agree
7. Disagree
8. Agree
9. Not sure
10. Disagree
point: most people have distorted percentions on what marketing is
Notes:
drink link
create extension on patron model for drinklink ambasidors
maybe an... |
994,375 | d6ed14adc2fe03a11562c4e95d4598c6612043b7 | #!/usr/bin/env python
print("importing libraries")
import kalibr_common as kc
import cv2
import csv
import os
import sys
import argparse
import sm
try:
import cv
png_flag = cv.CV_IMWRITE_PNG_COMPRESSION
except ImportError:
png_flag = cv2.IMWRITE_PNG_COMPRESSION
#setup the argument list
parser = a... |
994,376 | fed4e88bc1cb18da20b57d591fe5c1871052e8a0 | # A Python Example
from random import shuffle, randint
class Card(object):
def __init__(self, suit, value):
self.suit = suit
self.value = value
class Deck(object):
def __init__(self):
deckList = []
for i in range(4): # traverse all suits
for j in range(13): # traverse all values
deckList.append(Car... |
994,377 | 75aef422358dffd847da08e996f6866c58e86aad | # Odd/Even
def odd_even():
for count in range(1, 2001):
oddoreven = "";
if count % 2 == 0:
oddoreven = "even"
else:
oddoreven = "odd"
print "Number is %s. This is an %s number." % (count, oddoreven)
odd_even()
# Multiply
def multiply(list, multiplier):
... |
994,378 | 0b4d93ce123506efd51ae3591262e0f8d55ed93d | import utils
from django.utils import simplejson
import model
class Main(utils.Handler):
def get(self):
self.render('templates/home.html',
params=self.params,
data=simplejson.dumps(self.get_ministry_avg()))
def get_ministry_avg(self):
#results = self.mo... |
994,379 | 6d4ba0c6c5eb5a7d42c3c6d443eb1c099d152c56 | from django.shortcuts import render
# Create your views here.
from django.conf import settings
from django.http import HttpResponse
import time as tm
from TwitterSearch import *
import datetime
import json
from pymongo import MongoClient
from textblob import TextBlob
from textblob import Word
search_time = ""
track =... |
994,380 | bc1782d1c91f0d2ee62e2442149e1a4d0a09009c | import json
filePath = "C://W//Python//Notes/json_1.txt"
f=open(filePath, "r")
s = f.read()
f.close()
print(s) |
994,381 | 45438d874e79458f28a202e3bed26a5eaebe8277 | def Search(array, value):
"""
Binary search using while loop
Question 1
:param array: Sorted array to search
:param value: Values we are searching
:return: Returning the boolean value
"""
left = 0
right = len(array) - 1
while left <= right:
mid = left + (right - left) // ... |
994,382 | 022d424ca83b61e0d10d947958c2f4ac1e06e17d | # Generated by Django 2.0.4 on 2018-10-29 23:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('salads', '0003_auto_20181029_2136'),
]
operations = [
migrations.AlterField(
model_name='salad'... |
994,383 | 79a7e2e7644268e6a5e9a0721f6fdc5953780dd5 | class Utils():
#Constructeur
def __init__(self):
#Déclaration du tableau des clients actifs
self.clients = []
|
994,384 | b70b991cada65fd44e370fd36820814cdd6cd1e2 | '''
Logic for server.
'''
from datetime import datetime
from sqlalchemy import and_
from db import get_data_of_model, create_session
from models import Subdivision, Storage, Act, ActTable, MainThing, \
Storekeeper, DATABASES
from serializer import dumps, loads
from synch_db import update_subdivisions_data, up... |
994,385 | 6906916bc8edf9053aef84a576a7935ff1168a2e | import torch
import math
from model import depthnet, losses, data
# hyperparameter
batch_size = 32
learning_rate = 0.001
total_epoch = 4
report_rate = 20
# Device configuration
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
#Datasets and loader
dataset = data.DepthDataset("/dl/data/nyu-dept... |
994,386 | d48ed7ad952fc1155eb75d3fd0ca2e7a5e6fadf8 | import os
from xml.dom import minidom
import json
from pdf2image import convert_from_path
from tqdm import tqdm
if __name__ == '__main__':
json_dir = r'D:\Company\Projects\ICDAR_2013_table_evaluate\prediction_results\icdar2013_table_epoch100'
pdf_dir = r'D:\Company\Projects\ICDAR_2013_table_evaluate\icdar2013... |
994,387 | 4b0380a46a84d814dc6f7398036d2ba9f036a2ec | from fedot.api.api_utils.composer import ApiComposerHelper
from ..api.test_main_api import get_dataset
from fedot.core.repository.tasks import Task, TaskTypesEnum
from fedot.core.log import default_log
from testfixtures import LogCapture
composer_helper = ApiComposerHelper()
def test_compose_fedot_model_with_tuning... |
994,388 | 7d3b7905926ad29f7c19f98231f2abd523f7121a | # -*- encoding: utf-8 -*-
"""
Modulo que controla las operaciones sobre los B{User Stories} de los clientes.
@author: Samuel Ruiz,Melissa Bogado,Rafael Ricardo
"""
from IS2_R09.apps.Notificaciones.views import notificar_asignacion_us,\
notificar_eli_proyecto, notificar_eli_us
from django.http.response im... |
994,389 | d2c3c3ecd6c974cea8f2a8fea888cdbd258a601d | import readOpenFoam as rof
class Mesh(object):
def __init__(self, directory):
self.directory = directory
# Properties
self.nNodes = None
self.nodes = None
self.nFaces = None
self.nIFaces = None
self.faces = None
self.nCells = None
self.cells = None
# Initializing functions
... |
994,390 | 9f360ce9f74f05829f309406440b17948a9076c7 | import sys
import time
import threading
import pygame
import pygame.camera
import RPi.GPIO as GPIO
from pyimagesearch.facedetector import FaceDetector
from pyimagesearch import imutils
from picamera.array import PiRGBArray
from picamera import PiCamera
import argparse
import cv2
import numpy
# Define some colors
B... |
994,391 | 69ba2bb79d4a01154bcd00d63ca909a358d379f5 | s = str(input())
n = len(s)
ans1 = 0
ans2 = 0
for i in range(n):
if i%2 == 0 and s[i] == '0':
ans1 +=1
elif i%2 == 1 and s[i] == '1':
ans1 += 1
for i in range(n):
if i%2 == 0 and s[i] == '1':
ans2 +=1
elif i%2 == 1 and s[i] == '0':
ans2 += 1
print(min(ans1, an... |
994,392 | 7daf55c57ae604eb8e78e1d62cf6c0ce1c3a7d36 | #!/usr/bin/env python3
# Program use Luhn algorithm to check for credit card number and return boolean.
# https://github.com/sagarapatel/Python-Number-Projects/blob/master/credit_card_check.py
# IDE PyCharm
# Python 3.8 compatible
import sys
# Check credit card number Luhn algorithm
def luhn(n):
try:
r =... |
994,393 | a40685634cb05a860e351742b1d75d4697e4095b | #!/usr/bin/python3
import argparse
import javalang
def parse_args():
parser = argparse.ArgumentParser(description='Parse Layout Files')
parser.add_argument('-d','--debug', type=str, help='Turn on debug mode.')
parser.add_argument('-l','--line', type=str, help='line to parse.')
return parser.parse_args(... |
994,394 | d44751d7d71c73bb9edaa8a3056c5f780c2e9bd3 | from collections import defaultdict
def solve1(n_players=479, last_marble_worth=7103500):
current = Node(0)
current.right = current
current.left = current
scores = defaultdict(int)
current_player = 1
for m in range(1, last_marble_worth + 1):
if m % 23 != 0:
first = current... |
994,395 | 3cb553f2dbbd40aa4f87c471bd4cc6ff842ba8be | from enum import Enum, auto
class WorldType(Enum):
FOOD = auto()
REPRO = auto()
SURVIVAL = auto()
|
994,396 | 95af97cd7ca93a20a79f0e45aeae069c41c395a3 | # ---------------------------------------------------------------- #
# Median of Three
# Add short description
# (List)
# ---------------------------------------------------------------- #
# ---------------------------------------------------------------- #
# --------------------------------------------------... |
994,397 | 2df9f491e3ae042b77d1900bbb7e47a085ce875c | import json
import os
import sys
import dcoscli
import docopt
import pkg_resources
from dcos import (cmds, cosmospackage, emitting, http, options, package,
subcommand, util)
from dcos.errors import DCOSException
from dcoscli import tables
from dcoscli.subcommand import default_command_info, default_d... |
994,398 | d37fcbf07a7c9daf4dd21b4c8024a6bf7f45825d |
import arabic_reshaper
from bidi.algorithm import get_display
from reportlab.platypus import *
from reportlab.platypus.flowables import Image
from reportlab.lib.utils import ImageReader
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.styles import ParagraphStyle
from reportlab.rl_config import... |
994,399 | 6990cb753f9cbe02f2323f380ad6f07e8d381c46 | from django.contrib import admin
from .models import Attendee, Event
# Register your models here.
admin.site.register(Attendee)
admin.site.register(Event)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.