index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
7,400 | 90fc6590dab51141124ca73082b8d937008ae782 | """Файл, который запускается при python qtester
""" |
7,401 | f024b0736f5fcdebede8d5b0985cf9d7170db8fc | api_key = "your_key"
|
7,402 | 810e9e4b18ff8cb388f9e16607b8ab3389a9831d | def add_route_distance(routes, cities, source):
c = source.split()
citykey = c[0] + ':' + c[2]
cities.add(c[0])
routes[citykey] = c[4]
def get_route_distance(routes, source, dest):
if (source+":"+dest in routes):
return routes[source+":"+dest]
else:
return routes[dest+":"+sourc... |
7,403 | 34acb6da1dc9403a311ce3bca0a828a77b7b36da | """Some random mathematical helper functions.
"""
from __future__ import division, print_function
import math
# STATISTICS
def mean(L):
"""Calculate mean of given List"""
return sum(L) / len(L)
def variance(L, is_sample=0):
"""calculate variance (or sample variance) of given List"""
m = mean(L)
return sum((x... |
7,404 | b111d799b9e71cf36253c37f83dc0cdc8887a32e | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Agile Business Group sagl (<http://www.agilebg.com>)
# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
#
# This program is free software: you can redistribute it and/or modi... |
7,405 | 83ebebbb6191295adcb58b003bf1c3bcc6fb189f | from selenium import webdriver
import time
def test_check_error_page_1():
try:
link = "http://suninjuly.github.io/registration1.html"
browser = webdriver.Chrome()
browser.get(link)
# Проверяем Fisrt name*
field_text = browser.find_element_by_xpath(
'//body/div/f... |
7,406 | c1bcce809aa073ecd6e64dfa65ead9bd48aee3ff | from ui.pages import BasePage
from ui.locators.login_page_locators import LoginPageLocators
class LoginPage(BasePage, LoginPageLocators):
def __init__(self, driver=None):
super(LoginPage, self).__init__(driver=driver)
self.identifier = self.IDENTIFIER
def login(self, email=None, password=Non... |
7,407 | a62dd287f9fc6f79ef95a3de83f52c794efe00a7 |
import math
import turtle
wn = turtle.Screen()
wn.bgcolor('lightblue')
PI=3.14
R_outer=50
R_inner=200
fred = turtle.Turtle()
fred.speed(99999)
def cycloid(r, k, nos_cycle, direction):
n=36
angle=2*PI/n
x=1
y=0
for i in range(nos_cycle*n):
beta = i * angle
x = r*(beta-math.sin(beta))
... |
7,408 | 34a7fd66a9e2eae25994336f22a76c24c11a6e1b |
from django.urls import path
from admin_panel import views
urlpatterns = [
path('admin_panel/', views.AdminPanel.as_view(), name='admin_panel'),
path('admin_panel/connection/', views.Connection.as_view(), name='connect_group-teacher'),
path('admin_panel/connection/<str:choiced_departament>', views.Conne... |
7,409 | c420fb855fbf5691798eadca476b6eccec4aee57 | points_dict = {
'+': 5,
'-': 4,
'*': 3,
'/': 2,
'(': -1,
}
op_list = ['+','-','*','/']
def fitness(x1,op,x2):
#Mengembalikan point dari penyambungan expresi dengan operasi dan bilangan berikutnya
try:
hasil = eval(f"{x1} {op} {x2}")
diff = points_dict[op] - abs(24-hasil)
... |
7,410 | ea4e4c8067d9e910b8d4c6a1c4c01f1ef70d7341 | /home/pushkar/anaconda3/lib/python3.6/_bootlocale.py |
7,411 | 9dfb3f58127b30467651ac4209277cd947643c65 | from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.contrib import messages
# Create your views here.
from User.models import User, check_if_auth_user
from .models import Chat
# def recv_chat(request, id = None):
# check = check_if_auth_user(request)
# if... |
7,412 | db9068e54607e9df48328435ef07f15b4c25a6db | # %matplotlib inline
import tensorflow as tf
#import tensorflow.keras as K
import numpy as np
import math
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
# from keras import backend as K
from keras.models import Sequential, load_model
# from K.models import Sequential, load_model
from keras.... |
7,413 | e839eba2514c29a8cfec462f8d5f56d1d5712c34 | #!/usr/bin/env python
import argparse
import http.server
import os
class SimpleHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def log_message(*args, **kwargs): pass
parser = argparse.ArgumentParser()
parser.add_argument('port', action='store',
# default=8000, type=int,
... |
7,414 | 48270f70a9d69d15f808f22ec2d11d337b2c4845 | def densenet(D,DT,F,model):
import scipy.io as sio
import time
import os
import math
import numpy as np
import matplotlib.pyplot as plt
Dataset = D
if DT == 'org':
data_type = 'original'
else:
data_type = 'augmented'
fs = model.fs
fm1 = model.fm1
batch_size = model.ba... |
7,415 | 28bf11cb4205dd186b84cc7b7c8b9009f35fe408 | # This simulation obtains dose on a cylindical disk phantom at various
# distances from a 14MeV photon source. Dose in millisieverts is found
# and compared to the yearly limit
# The model is built to have a human tissue and human height and volume which
# is typically referred to as a phantom.
# source details based... |
7,416 | f6bfb055e1c1750702580fc9c9295b8528218910 | # 给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。
#
# DEMO:
# 输入: 3
# 输出:
# [
# [ 1, 2, 3 ],
# [ 8, 9, 4 ],
# [ 7, 6, 5 ]
# ]
class Solution:
def generateMatrix(self, n):
"""
与 54 思路类似,注意边界...
:type n: int
:rtype: List[List[int]]
"""
array = [[0 for _ in ran... |
7,417 | f6d4208afee7aacd96ea5ae6c9e38d2876466703 | import os
def mini100(videopath, minipath,mod='train'):
with open(videopath, 'r') as video_f:
all_videos = video_f.readlines()
#if mod=='train':
# count = [400 for _ in range(0,100)]
#else:
# count = [25 for _ in range(0,100)]
count = [0 for _ in range(0,100)]
... |
7,418 | 8aa35bcaa4e564306125b37c70a8a92f26da736d |
import pickle
from absl import flags
from absl import app
from absl import logging
import time
import numpy as np
FLAGS = flags.FLAGS
flags.DEFINE_string('sent2vec_dir', '2020-04-10/sent2vec/', 'out path')
flags.DEFINE_integer('num_chunks', 36, 'how many files')
flags.DEFINE_string('out_dir', '2020-04-10/', 'out pat... |
7,419 | bf8a524e54aa866c8293a93b2321335f2c7b0850 | from .checklist_mixin import ChecklistMixin
from .citation_mixin import CitationMixin
from .license_mixin import LicenseMixin
from .registry_mixin import RegistryMixin
from .repository_mixin import RepositoryMixin
__all__ = [
"RepositoryMixin",
"LicenseMixin",
"RegistryMixin",
"CitationMixin",
"Ch... |
7,420 | 297a17ca5aaafb368a1e4cba35e387c67e9f793f | """
Created on Fri Aug 4 19:19:31 2017
@author: aw1042
"""
import requests
import threading
import sys
import re
import xml.etree.ElementTree as ET
import smtplib
from credentials import *
argsObj = {}
for arg1, arg2 in zip(sys.argv[:-1], sys.argv[1:]):
if arg1[0] == '-':
argsObj[arg1] = arg2
posts = ... |
7,421 | 4af53bf9cbe136dec7dcc609e28cdd013911c385 | # Copyright (c) 2008 Johns Hopkins University.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose, without fee, and without written
# agreement is hereby granted, provided that the above copyright
# notice, the (updated) modification history ... |
7,422 | 76d2c3f74e8fae160396b4015ccec478dba97b87 | # -*- coding: utf-8 -*-
"""
Created on Tue Mai 15 11:34:22 2018
@author: Diogo Leite
"""
from SQL_obj_new.Dataset_config_dataset_new_sql import _DS_config_DS_SQL
class Dataset_conf_ds(object):
"""
This class treat the datasets configuration connection tables object has it exists in DATASET_CONF_DS table data... |
7,423 | 7a0e7ede263727ef303ba23dff1949c3a7031360 | #!/usr/bin/python
import argparse
import os
import pipes
import sys
import rospy
import std_msgs.msg
import actionlib
import time
import datetime
from geometry_msgs.msg import Pose, Point, Quaternion
from actionlib import *
from location_provider.srv import GetLocationList
from std_srvs.srv import Trigger
try:
i... |
7,424 | c7d51f6448400af5630bdc0c29493320af88288e | import pytesseract
from PIL import Image
import tensorflow as tf
from keras.models import load_model
from tensorflow import Graph
import os
import json
import cv2
import numpy as np
global class_graph
def classify(img, c_model):
#global class_graph
""" classifies images in a given folder using the 'model... |
7,425 | 310e6e693cdce6ff71d06eac86214a21bef236d4 | """Produce a multi-panel figure of each output lead time in a forecast
"""
import matplotlib.pyplot as plt
import iris.plot as iplt
from irise import convert
from irise.plot.util import add_map
from myscripts import plotdir
from myscripts.models.um import case_studies
columns = 3
def main(forecast, name, levels, *a... |
7,426 | 50be2cbdaec6ed76e5d9367c6a83222f9153db82 | '''
Please Note:
Note: It is intended for some problems to be ambiguous. You should gather all requirements up front before implementing one.
Please think of all the corner cases and clarifications yourself.
Validate if a given string is numeric.
Examples:
1."0" => true
2." 0.1 " => true
3."abc" => false
4."1 a" =>... |
7,427 | 7b6e73744d711188ab1a622c309b8ee55f3eb471 | # Python : Correct way to strip <p> and </p> from string?
s = s.replace('<p>', '').replace('</p>', '')
|
7,428 | eec2b818ea9d50161bad60e8bf83dcb7ce9bf9fa | from plone import api
from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxL... |
7,429 | 90b9dcd2dfc28446d1979d58ed49a12a85ce5b98 | # Generated by Django 3.1.7 on 2021-03-24 14:51
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Products_Table',
fields=[
('product_id', mo... |
7,430 | 71662ff8c68559bf08e1da7f1a1504bfe842c950 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-04 13:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0007_alter_validators_add_error_... |
7,431 | acf3d188bd6c99774ddf538dcc83f99ad56c7057 | from mpi4py import MPI
from random import random
comm = MPI.COMM_WORLD
mydata = comm.rank
data = comm.gather(mydata)
if comm.rank == 0:
print("Data = ", data)
|
7,432 | 2019a2a5588e57164ff4226ef3bcbbc506f2b315 | """
==============================
Visualize Cylinder with Wrench
==============================
We apply a constant body-fixed wrench to a cylinder and integrate
acceleration to twist and exponential coordinates of transformation
to finally compute the new pose of the cylinder.
"""
import numpy as np
from pytransform... |
7,433 | 9a982e0ab7fff882767a98ed01f5ed68bd710888 | import turtle
def draw_square():
conrad = turtle.Turtle()
conrad.shape("turtle")
conrad.color("red")
conrad.speed(3)
i = 0
while(i < 4):
conrad.forward(200)
conrad.right(90)
i += 1
def draw_circle():
niki = turtle.Turtle()
niki.circle(50)
def draw_triangle():
tri = turtle.Turtle()
tri.shape("t... |
7,434 | 7c06bd52c924d3e401f50625109c5b8b489df157 | def tort(n, a, b):
return min(n*a, b)
def main():
n, a, b = map(int, input().split())
print(tort(n, a, b))
if __name__ == '__main__':
main()
|
7,435 | 0f3ecd0a7189f57fdbda2360f6e39bd6101e2fdb | from LinkedList import LinkedList
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
h1 = l1
... |
7,436 | 2b579c3def4c2d02d365f019518e8e0b25664460 | import pandas as pd
import matplotlib.pyplot as plt
from netCDF4 import Dataset
from cftime import num2date
import os
import numpy as np
from datetime import datetime, timedelta, date
def plot_temperatures_by_country(values, country, start, end):
"""
Returns a plot for temperature values for a coun... |
7,437 | ee0ed255b6851696dc57c01100cd67f5f959cf01 | from typing import List
import pandas as pd
import numpy as np
import pickle
from catboost import CatBoostRegressor
from sklearn.preprocessing import MinMaxScaler
def calculate_probable_age(usersEducationFeatures):
prob_age = {}
grads_count = {}
age_diff1 = 17 # age difference for school
... |
7,438 | ee49ce63951721458cb98b370285d04231bb2c20 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import numpy.random as nr
import math
import os
from datetime import datetime
from sklearn.linear_model import LinearRegression, SGDRegressor
import sys
import time
import imp
from sklearn.ensemble import ExtraTreesRegressor
fr... |
7,439 | adff75857a1de24267e771c599e4d89486a6ad32 | # Generated by Django 2.0.5 on 2018-07-12 11:08
import assessment.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assessment', '0006_auto_20180712_1428'),
]
operations = [
migrations.AlterModelManagers(
name='season',... |
7,440 | 8e34b5e15c5b6107d6841e7b567abf967c631f1b | # coding=utf-8
from __future__ import print_function
import os
import sys
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
basedir = os.getcwd()
os.chdir(os.path.dirname(os.path.abspath(__file__)))
sys.path.append('trainer')
sys.path.append('downloader')
from gen.gen_captcha import gen_dataset, load_templates, candidates
fr... |
7,441 | 4d2cb3e0bdd331a1de7f07eb0109f02c9cf832a8 | import logging
import os
import time
import urllib
from collections import namedtuple
from statistics import mean
from urllib.request import urlopen
import bs4
import regex as re
from tika import parser
from scipy.stats import ks_2samp
import config
from TFU.trueformathtml import TrueFormatUpmarkerHTML
from TFU.truefo... |
7,442 | a5b7f565a1797e5f326bcf26ff7c8ad2469dca70 | #!/usr/bin/env python
import argparse
import pymssql
import json
#get the lcmMediaId from DB.
def getMediaId(contentProviderMediaName):
#test db
conn = pymssql.connect(host='CHELLSSSQL23.karmalab.net', user='TravCatalog', password='travel', database='LodgingCatalogMaster_Phoenix')
#prod db
#conn = pyms... |
7,443 | d517c1e2eb4d37a2584f1603c704efce6834df92 | # Author: Charse
# py 列表的使用
import copy
name = ["111", "222", "333", "444", "555"]
# 从列表中取得元素
print(name[0], name[2]) # 111 333
print(name[1:3]) # 切片 ['222', '333']
print(name[:3]) # ['111', '222', '333'] 与下标从0开始是一样的
print(name[0:3]) # ['111', '222', '333']
print(name[-2:]) # ['444', '555'] 与name
# 往列表中添加... |
7,444 | 88e1eb4cbfe346c663cca23836c23346e18a8488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from twython import Twython
import random
tweetStr = "None"
#twitter consumer and access information goes here
api = Twython(apiKey,apiSecret,accessToken,accessTokenSecret)
timeline = api.get_user_timeline()
lastEntry = timeline[0]
sid = str(lastEntry['id']... |
7,445 | dd936839d71b97b3a21115498092d8984de0e3f1 | questions = ('Какой язык мы учим?', 'Какой тип данных имеет целая переменная?', 'Какой тип данных имеет вещественная переменная?', 'Какой тип данных имеет логическая переменная?', 'Какой тип данных имеет символьная переменная?')
answers = ('Python', 'Integer', 'Float', 'Bool', 'String')
i = 0
count_answers = 0
while i ... |
7,446 | 7b459cf321f351e1485a9aef0ca23067f411e430 | """Wrapper over the command line migrate tool to better work with
config files."""
import subprocess
import sys
from alembic.migration import MigrationContext
from ..lib.alembic import bootstrap_db
from ..lib.sqla import create_engine
from ..models import DBSession as db
def main():
if len(sys.argv) < 3:
... |
7,447 | 56b4262e88793be366d8ffe0fe4427fdb2a99bd7 | from app import create_app, db
import unittest
import json
class Test(unittest.TestCase):
def setUp(self):
"""Before each test, set up a blank database"""
self.app = create_app("configmodule.TestingConfig")
self.app.testing = True
self.client = self.app.test_client()
with... |
7,448 | ae5ec7919b9de4fbf578547c31837add32826f60 |
class Graph:
def __init__(self, num_vertices):
self.adj_list = {}
for i in range(num_vertices):
self.adj_list[i] = []
def add_vertice(self, source):
self.adj_list[source] = []
def add_edge(self, source, dest):
self.adj_list[source].append(dest)
def print_... |
7,449 | 885fd32c9520dfdc2becd6b1a3d0c0f5f5397112 | from setuptools import setup, find_packages
setup(
name="champ",
version="0.0.1",
description='Channel modeling in Python',
url='https://github.com/sgherbst/champ',
author='Steven Herbst',
author_email='sherbst@stanford.edu',
packages=['champ'],
include_package_data=True,
zip_safe=F... |
7,450 | 7c4709eaa5123b44e6355c6a60932f286e3b1cf5 | #!/usr/bin/env python
#-*- coding:utf8 -*-
# Power by null 2018-09-19 18:41:17
from codebase.mod.mod_test import test_f
|
7,451 | e38149f0d421a43f6aa34a977eee89fe29021b85 | #!/usr/bin/python
# This IDAPython code can be used to de-obfuscate strings generated by
# CryptoWall version 3, as well as any other malware samples that make use of
# this technique.
'''
Example disassembly:
.text:00403EC8 mov ecx, 'V'
.text:00403ECD mov [ebp+var_1C], cx
... |
7,452 | 1c1cd0eeea4dbf446aa4582f42ef1f3b5a4e8875 | # Generated by Django 3.2.2 on 2021-05-11 09:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('meeting', '0004_auto_20210511_0947'),
]
operations = [
migrations.AlterField(
model_name='event',
name='end',
... |
7,453 | 862c5794a4da794678de419f053ae15b11bca6e7 | class GameOfLife:
@staticmethod
def simulate(board):
for row in range(len(board)):
for col in range(len(board[0])):
ones = GameOfLife.countOnes(board, row, col)
if board[row][col] and (ones == 2 or ones == 3):
board[row][col] |= 2
... |
7,454 | 445ae195edfe9fe9ee58c6c5a14ec787719d698c |
def get_ecgs_by_query(json_data, query):
ecgs_ids = []
for case_id in json_data.keys():
print(case_id)
if query.is_query_ok(json_data[case_id]):
ecgs_ids.append(case_id)
return ecgs_ids
def save_new_dataset_by_ids(old_json, ecg_ids_to_save, name_new_dataset):
"""
Saves... |
7,455 | 9540319cf192add1fb24375a35d70ea8e3031a72 | __author__ = 'aniket'
import freenect
import cv2
import numpy as np
kernel = nfrp.ones((5,5),np.uint8)
freenect.C
def grayscale():
maske = np.zeros((480,640,3))
a = freenect.sync_get_depth(format=freenect.DEPTH_MM)[0]
mask = a == 0
a[mask] = 8000
mask1 = a > 1000
b = freenect.sync_get_video()... |
7,456 | afd184962e8e69843ca518e140d5fdde3d7c9ed2 | from django.views.generic import TemplateView, FormView, CreateView, ListView
from .models import Order
from .form import OrderForm
class OrdersListView(ListView):
template_name = 'orders/index.html'
queryset = Order.objects.all()
context_object_name = 'order_list'
class OrderCreateView(CreateView):
... |
7,457 | 605d8144d18207314981872ec57cec6cb2510601 | # def qs(li):
# n = len(li)
# if n <= 1:
# return li
# pivot = li[n - 1]
# left = []
# right = []
# for i in li[:n - 1]:
# if i <= pivot:
# left.append(i)
# else:
# right.append(i)
# left = qs(left)
# right = qs(right)
# return left + [... |
7,458 | 3222dd7c2d19d86f2e085cb489ab4a48307ba132 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test1.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(... |
7,459 | 45b46a08d8b304ac12baf34e0916b249b560418f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask, request, jsonify
from app import Node
from dbm2 import filemanager
fm = filemanager()
node = Node(fm)
app = Flask(__name__)
@app.route("/transactions/isfull",methods=['GET'])
def isFull():
return jsonify(node.isFull()), 200
@app.route("/tra... |
7,460 | 2e9d71b8055e1bab107cedae69ca3bc4219e7d38 | import joblib
import os
import shutil
import re
from scipy import stats
from functools import partial
import pandas as pd
from multiprocessing import Process, Pool
from nilearn import masking, image
import nibabel as nib
import numpy as np
from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import matplotlib... |
7,461 | de7515cb71c8e30018b14baf8846648d0c76a592 | #!/usr/bin/env python
# Sanjaya Gajurel, Computational Scientist, Case Western Reserve University, April 2015
import vtk
# ------------------------------------------------------------------------------
# Script Entry Point
# ------------------------------------------------------------------------------
if __name__ ==... |
7,462 | cab45a823e319bd504b3db68cf70bff315f44fc6 | import random
import numpy as np
class Board:
def __init__(self, nrows, ncols, random_seed=42):
self.nrows = nrows
self.ncols = ncols
self.random = random.Random()
self.random.seed(random_seed)
self.board = np.zeros((nrows, ncols))
self.score = 0
self.__add_new_numbers()
# Initialize with 1/8 of the ... |
7,463 | b38c9357030b2eac8298743cfb4d6c4d58c99ed4 | import redis
r = redis.StrictRedis()
r.set("counter", 40)
print(r.get("counter"))
print(r.incr("counter"))
print(r.incr("counter"))
print(r.get("counter"))
|
7,464 | abe53120a485f608431142c6b9452666fcd72dbf | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 5 17:05:12 2018
@author: Shane
"""
import math
import scipy.integrate as integrate
import random
import numpy as np
import sympy as sym
'''
Question 1
plug and play into formula for VC generalization
'''
print('Question 1')
error = 0.05
for N in [400000,420000,4400... |
7,465 | 8f9d823785d42d02a0a3d901d66b46a5cd59cdd7 | import json
import glob
import sys
searchAreaName = sys.argv[1]
# searchAreaName = "slovenia_177sqkm_shards/20161220-162010-c9e0/slovenia_177sqkm_predicted/predict_slovenia_177sqkm_shard"
print('./{0}_??.txt'.format(searchAreaName))
all_predicts = glob.glob('./{0}_??.txt'.format(searchAreaName))
def getBboxes(bboxes):... |
7,466 | e899b093152ee0923f1e5ad3b5719bbf9eb4339c | from .login import LoginTask
from .tag_search import TagSearchTask
from .timeline import TimelineTask
from .get_follower import GetFollowerTask
from .followback import FollowBackTask
from .unfollow import UnFollowTask
|
7,467 | 64d955d568a6bfec50aad36c9c4f1e36998e4d74 | import csv
import boto3
import pytz
import time
from datetime import datetime, timedelta
# current_time = int(datetime.now())
from boto3.dynamodb.conditions import Key, Attr
def lambda_handler(event, context):
current_date = datetime.now(pytz.timezone('US/Central'))
yesterday_date = current_date - timedleta(... |
7,468 | 18eed41cbc419ecbb215f77235be99f15f86ea9a | '''
Author: Allen Chen
This is an example of entry point to CORE. Pay close attention to the import syntax - they're relative to this repo.
Don't try to run this by doing 'python3 main.py' under this directory. Try to add your Target in Makefile under the root dir,
and call './run YOUR_TARGET_NAME' from root.
'''
fr... |
7,469 | 109ca06685eece74034f77a98b1d7172a17aca21 | import random
import re
from datetime import datetime, timedelta
from threading import Lock
from telegram.ext import run_async
from src.models.user import UserDB
from src.models.user_stat import UserStat
from src.utils.cache import cache, USER_CACHE_EXPIRE
from src.utils.logger_helpers import get_logger
logger = get... |
7,470 | b74c759b51fb6591477757e2ff54b545f225991c | import json
from examtool.api.database import get_exam, get_roster
from examtool.api.extract_questions import extract_questions
from examtool.api.scramble import scramble
from google.cloud import firestore
import warnings
warnings.filterwarnings("ignore", "Your application has authenticated using end user credentials"... |
7,471 | a12f9435eb4b090bc73be14ad64fdf43c5caa4d2 | from netsec_2017.Lab_3.packets import RequestItem, RequestMoney, RequestToBuy, FinishTransaction, SendItem, SendMoney
from netsec_2017.Lab_3.PLS.client import PLSClient, PLSStackingTransport
from netsec_2017.Lab_3.peepTCP import PeepClientTransport, PEEPClient
import asyncio
import playground
import random, logging
fro... |
7,472 | e59bd92a94399d4a81687fc5e52e9ae04b9de768 | from django.db import models
from colorfield.fields import ColorField
from api import settings
from os.path import splitext
from datetime import datetime, timedelta
from PIL import Image
def saveTaskPhoto(instance,filename):
taskId = instance.id
name,ext = splitext(filename)
return f'tasks/task_{taskId}{e... |
7,473 | 24b6d33849f034b9f61ffd4aaff90a0f428085fe | from pybot import usb4butia
u4b = usb4butia.USB4Butia()
while True:
bot = u4b.getButton(6)
print bot
|
7,474 | 2d0d73c0ea20d6736c10d5201abcfa9d561ef216 | import random
import matplotlib.pyplot as plt
import numpy as np
def dado(n):
i = 1
dos =0
tres =0
cuatro =0
cinco=0
seis =0
siete=0
ocho=0
nueve=0
diez=0
once=0
doce=0
cont = [0,0,0,0,0,0,0,0,0,0,0]
while i <= n:
r1 = random.randint(1,6)... |
7,475 | 7639b80c9e6e1b2e1e55a47a862c433b64168cf6 | # 代码3-14 pandas累积统计特征函数、移动窗口统计函数示例
import pandas as pd
D = pd.Series(range(0, 20)) # 构造Series,内容为0~19共20个整数
print(D.cumsum()) # 给出前n项和
print(D.rolling(2).sum()) # 依次对相邻两项求和
|
7,476 | a3239bbe4f85c9f0e1bc845245f024c3feb64923 | # Generated by Django 3.2.3 on 2021-06-01 07:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('info', '0002_auto_20210531_1958'),
]
operations = [
migrations.AddField(
model_name='well',
name='well_status',
... |
7,477 | 8ad47bf292e0046550cc0ef6f6bb75cf179ebd4b | def group(arr):
low, mid, high = 0, 0, len(arr)-1
while mid <= high:
print(arr)
if arr[mid] == 'R' :
arr[low], arr[mid] = arr[mid], arr[low]
low += 1
mid += 1
elif arr[mid] == 'G':
mid += 1
else:
arr[high], ar... |
7,478 | 82556291c456b9e43e4e589ea4a77d320430344b | data_dir = "../data"
output_dir = './'
valid_id = dict()
for category in ("beauty", "fashion", "mobile"):
with open("%s/%s_data_info_val_competition.csv" % (data_dir, category), "r") as infile:
next(infile)
for line in infile:
curr_id = line.strip().split(',')[0]
valid_id[cu... |
7,479 | 96ea9b2b4d892ac88f7fac9594a6d2ad5d69a7c7 | # -*- coding: utf-8 -*-
import os
import logging
import subprocess
import json
import sys
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ROOT_PATH)
from src.datafactory.common import json_util
from src.datafactory.config import constant
class SegmentProcess... |
7,480 | 8a9feae4ce209def2c98b7bed993f9b5c019a533 | from tkinter import *
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import random
import numpy as np
import timeit
def main():
root = tk.Tk()
# root.geometry('800x500')
root.resizable(width=False, height=False)
root.title('Tugas Algoritma')
canva... |
7,481 | 3031f695d57492cf3b29694fecd0a41c469a3e00 | botName = "firstBot"
username = "mrthemafia"
password = "oblivion"
client_id = "Y3LQwponbEp07w"
client_secret = "R4oyCEj6hSTJWHfWMwb-DGUOBm8"
|
7,482 | abfff0901e5f825a473119c93f53cba206609428 | # -*- coding: utf-8 -*-
import io
import urllib.request
from pymarc import MARCReader
class Item:
"""
Represents an item from our
Library catalogue (https://www-lib.soton.ac.uk)
Usage:
#>>> import findbooks
#>>> item = findbooks.Item('12345678')
#>>> item.getMarcFields()
... |
7,483 | 5e2fcc6379a8ecee0378d26108e4deab9d17dba6 | # 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 applicable law or agreed to ... |
7,484 | b9fe758d5fe12b5a15097c0e5a33cb2d57edfdd2 | from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
from .models import Group,SQLlist
from .forms import GroupForm
from .oraConnect import *
from .utils import IfNoneThenNull
########################### Группы ############################
def group_list(request):
grou... |
7,485 | 3eb40dfe68573b93c544a2279ac5c8728ae9601f | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from tests import unittest
from kepler.descriptors import *
class DescriptorsTestCase(unittest.TestCase):
def testEnumDefaultsToNoopMapper(self):
class Record(object):
cat = Enum(name='cat', enums=['Lucy Cat', 'Hot Pocket'])
... |
7,486 | 1b43125c2ebffd0a268a4a0ffdbbf407de7b0374 | ''' Compress images '''
from PIL import Image
def resizeImage(image_file):
try:
# get the image's width and height in pixels
img = Image.open(image_file)
width, height = img.size
# get the largest dimension
max_dim = max(img.size)
if max_dim > 1000:
# resize the image using the largest side as dime... |
7,487 | fdf76ff20260c25d95a9bf751fa78156071a7825 | class Helper:
def __init__(self):
self.commands = ["help",
"lottery",
"poll",
"polling",
"prophecy",
"roll",
"team",
"ub"]
... |
7,488 | 5ad8db85f4f705173cf5d0649af6039ebe1544b2 | text=open('mytext.txt','w')
x=text.write("I like coding\nit is a new part\nof my life!!!")
text=open('mytext.txt')
read=text.readlines()
i=0
counter=0
total=0
print("number of lines :"+str(len(read)))
while i<=len(read)-1:
counter=counter+read[i].count('\n') + read[i].count(' ')
total+=len(read[i])-read[i].cou... |
7,489 | 973a58013160cbc71ca46f570bde61eaff87f6a7 | from Adafruit_LSM9DS0 import Adafruit_LSM9DS0
import math
imu = Adafruit_LSM9DS0()
pi = 3.14159265358979323846 # Written here to increase performance/ speed
r2d = 57.2957795 # 1 radian in degrees
loop = 0.05 #
tuning = 0.98 # Constant for tuning Complimentary filter
# Converting accelerometer readings to degrees
ax ... |
7,490 | 7ae328bcfdec2d17fceb5d707f13cf495fde4469 | import os
import re
import time
import numpy as np
import pandas as pd
from sklearn.cluster import AgglomerativeClustering
import math
import edlib
from progress.bar import IncrementalBar as Bar
from multiprocessing import Pool
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--pools",
... |
7,491 | 763d448bc447b88d5f2de777a475a1dd50906527 | class Solution:
def jump(self, nums: List[int]) -> int:
l = len(nums)
jump = 0
curEnd = 0
curFarthest = 0
for i in range(l-1):
curFarthest= max(curFarthest,i+nums[i])
if i==curEnd:
jump+=1
curEnd = curFarthest
re... |
7,492 | 24b1afb18e1cfdc8d5a62f5ee0147b2d73bc10d8 | #
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
7,493 | abbefb1e426408b32fa9e125c78b572de22dbb8c | import unittest
from unittest.mock import patch
from fsqlfly.db_helper import *
from fsqlfly.tests.base_test import FSQLFlyTestCase
class MyTestCase(FSQLFlyTestCase):
def test_positive_delete(self):
namespace = Namespace(name='iii')
self.session.add(namespace)
self.session.commit()
... |
7,494 | ab0c3cf3e43f34874dd94629b746ca1237c3349a | import time
import numpy as np
import matplotlib.pyplot as plt #tutorial: http://pybonacci.org/2012/05/19/manual-de-introduccion-a-matplotlib-pyplot-ii-creando-y-manejando-ventanas-y-configurando-la-sesion/
import threading
from random import shuffle
T = 1
eps = 0.000000001
agilityMin = 1/T
'''------------GOVERMENT'... |
7,495 | f3b697e20f60e51d80d655ddf4809aa9afdfcd69 | # -*- coding: utf-8 -*-
"""
Editor de Spyder
Este es un archivo temporal.
"""
def largo (l, n):
i=0
cuenta=1
valor1=0
valor2=0
while cuenta < n+1 or cuenta==n+1:
a=l[i]
b=l[i+1]
if a==b:
cuenta+= 1
valor1=a
i+=1
cuenta=1
while cuenta ... |
7,496 | 1066f86d3a35e892ca2a7054dfc89fe79f1d32c8 | from django.db import models
from helpers.models import BaseAbstractModel
from Auth.models import Profile
# from Jobs.models import UserJob
from django.db.models.signals import post_save
from django.dispatch import receiver
# Create your models here.
class Notification(BaseAbstractModel):
title = models.CharField(m... |
7,497 | 18dc01f3e1672407800e53d80a85ffc8d5b86c17 | #
# Copyright (C) 2020 RFI
#
# Author: James Parkhurst
#
# This code is distributed under the GPLv3 license, a copy of
# which is included in the root directory of this package.
#
import logging
import numpy
from maptools.util import read, write
# Get the logger
logger = logging.getLogger(__name__)
def array_rebin(... |
7,498 | 9184779731d6102498934d77b6d3c0283fc594d9 | from pwn import *
hostname = "pwnable.kr"
portnum = 2222
username = "input2"
passwd = "guest"
def main():
args = ["./input"]
print("./input", end="")
for x in range(99):
print(" AA", end="")
args.append("AA")
print(args)
'''
s = ssh(host=hostname,
port=portnum,
... |
7,499 | 1ce7b292f89fdf3f978c75d4cdf65b6991f71d6f | # Generated by Django 2.2.1 on 2019-05-05 18:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='divida',
name='id_cliente',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.