seq_id stringlengths 4 11 | text stringlengths 113 2.92M | repo_name stringlengths 4 125 ⌀ | sub_path stringlengths 3 214 | file_name stringlengths 3 160 | file_ext stringclasses 18
values | file_size_in_byte int64 113 2.92M | program_lang stringclasses 1
value | lang stringclasses 93
values | doc_type stringclasses 1
value | stars int64 0 179k ⌀ | dataset stringclasses 3
values | pt stringclasses 78
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
34870614930 | from datetime import (
date,
datetime,
)
import numpy as np
import pytest
from pandas.core.dtypes.common import (
is_float_dtype,
is_integer_dtype,
)
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DatetimeInde... | pandas-dev/pandas | pandas/tests/arrays/categorical/test_constructors.py | test_constructors.py | py | 30,508 | python | en | code | 40,398 | github-code | 90 |
19405683955 | x = input('Insira um valor inteiro:')
tamanho = len(x)
verifica = False
i = 0
while i < tamanho - 1:
if x[i] == x[i + 1]:
verifica = True
i += 1
if verifica:
print("sim")
else:
print("não")
| marcelomiky/python_code | Coursera/CICCP1/digitos_adjacentes.py | digitos_adjacentes.py | py | 222 | python | pt | code | 4 | github-code | 90 |
38296757641 | import constant
from utils.shortcuts import render
from django.conf import settings
from django.contrib.auth import login as auth_login
from django.contrib.auth import logout as auth_logout
from django.contrib.auth import authenticate as auth_authenticate
from django.http import HttpResponse, HttpResponseRedirect
fro... | TylerLu/EDUGraphAPI-Python | account/views.py | views.py | py | 6,540 | python | en | code | 1 | github-code | 90 |
18430863009 | from collections import Counter
n = int(input())
S = input()
counts = Counter(S)
mod = int(1e9) + 7
ans = 1
for count in counts.values():
ans *= (count + 1)
ans %= mod
ans -= 1
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p03095/s295363983.py | s295363983.py | py | 197 | python | en | code | 0 | github-code | 90 |
18320460029 | import sys
input=sys.stdin.readline
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()
"""========main code==============="""
t=ii... | Aasthaengg/IBMdataset | Python_codes/p02861/s474482352.py | s474482352.py | py | 578 | python | en | code | 0 | github-code | 90 |
19586728954 | #!/usr/bin/env python3
import time
import pickle2reducer
import multiprocessing as mp
ROBOT_CMD_PORT=6000
ROBOT_SECRET_KEY=b"Friggin Lazer!"
ctx = mp.get_context()
ctx.reducer = pickle2reducer.Pickle2Reducer()
from multiprocessing.connection import Client
run=1
address = ('localhost', ROBOT_CMD_PORT)
while run:
... | rhazzed/potatoCHIP | archive/sender.py | sender.py | py | 723 | python | en | code | 0 | github-code | 90 |
42586161703 |
import requests
from utils.datetime_tools import DATE_TIME_FORMAT
from utils.gibber import logger
class eastmoneyFutureScrapper:
def __init__(self):
self.base_url = "https://np-futurelist.eastmoney.com/comm/future/fastNews"
self.headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel... | ettzzz/news_scrapper | scrapper/eastmoney_future.py | eastmoney_future.py | py | 2,383 | python | en | code | 0 | github-code | 90 |
69795114857 | import datetime
import os
import uuid
#파일이 업로드 될 때 파일을 올린 날짜별로 폴더로 나누어 구성
def file_upload_path(instance, filename):
ext = filename.split('.')[-1]
d = datetime.datetiem.now()
filepath = d.strftime("%Y/%m/%d")
suffix = d.strftime("%Y%m%d%H%M%S")
filename = "%s_%s.%s" % (uuid.uuid4().hex, suffix, ext)
... | kkMina/2020_project | django_project/myapp/common.py | common.py | py | 412 | python | ko | code | 0 | github-code | 90 |
38958024276 | ''' Basic Reader and Writer tests.
'''
import c3d
import importlib
import io
import unittest
import numpy as np
from test.base import Base
from test.zipload import Zipload
climate_spec = importlib.util.find_spec("climate")
if climate_spec:
import climate
# If climate exist
if climate_spec:
logging = climate.ge... | EmbodiedCognition/py-c3d | test/test_c3d.py | test_c3d.py | py | 4,350 | python | en | code | 94 | github-code | 90 |
35968872063 | import os
# os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# # from keras.backend.tensorflow_backend import set_session
#
# os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import argparse
import scipy.io as sio
# import matlab.engine
import torch
from utils import *
from data_preprocessing.CRBP.getSequence import *
from data_prepr... | cc646201081/CircSSNN | data_preprocessing/CRBP/getDataView.py | getDataView.py | py | 1,794 | python | en | code | 0 | github-code | 90 |
17930966859 | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
numbers=[2,1]
number = int(input())
for i in range(2,number+1):
numbers.append(numbers[i-1]+numbers[i-2])
print(numbers[-1])
if __name__=="__main__":
main() | Aasthaengg/IBMdataset | Python_codes/p03544/s997978728.py | s997978728.py | py | 259 | python | en | code | 0 | github-code | 90 |
27034997476 | def sum_neg(lst):
if len(lst) == 0:
return []
index = 0
output = []
s = 0
b = 0
while index < len(lst):
if lst[index] > 0:
s += 1
elif lst[index] <0:
b += lst[index]
index += 1
output.append(s)
output.append(b)
return output
p... | adiseal/edabit-practices | Positive Count Negative Sum.py | Positive Count Negative Sum.py | py | 388 | python | en | code | 0 | github-code | 90 |
26696304801 | # reader.py
# 20161221 by Yong Wang
import numpy as np
inputDir = "Input/"
caseDir = "theta-0/"
# Read CFD Pressure Data (x[m], y[m], z[m], pres[Pa])
cfdPresFile = inputDir + caseDir + "cfd_pressure.csv"
cfdPresM = np.genfromtxt(cfdPresFile, delimiter=',', skip_header=17)
cfdPresM[:,3] = 1.0*cfdPresM[:,3] # into t... | windstriver/tornado-thesis | towerStatic-Para/LoadTransfer/reader.py | reader.py | py | 1,315 | python | en | code | 1 | github-code | 90 |
70760089578 | from io import open
import pathlib
import shutil
# Abrir archivo
route = str(pathlib.Path().absolute())+"/ficheros_texto.txt"
archive = open(route, "+a")
#print(f"Ruta absoluta: {route}")
#Escribir dentro de un archivo
#archive.write("##### Texto ingresado desde Python #####\n")
#Cerrar archivo
archive.close()
rout... | AlexSR2590/master_python | 14-sistema_archivos/ficheros.py | ficheros.py | py | 1,501 | python | es | code | 0 | github-code | 90 |
37513063800 | """ Constants Module
----------------
Defines constants used in the method.
"""
K = 5 # size of user and review latent vectors
EM_ITER = [10]
BURN_IN = [0]
SAMPLES = [20]
NR_ITER = 50
NR_TOL = 1e-4
NR_STEP = 0.1 # In paper: 1
ETA = 0
| lucianamaroun/review_recommendation | algo/cap/const.py | const.py | py | 253 | python | en | code | 5 | github-code | 90 |
5381105338 | __author__ = 'Jakub Wojtanek, Kwojtanek@gmail.com'
import urlparse
import string
from django.shortcuts import render_to_response
from zorya.models import StellarObject
from zorya.appviews.mapviews import mapapistatic
from zorya.appviews.similarviews import SimilarViewStatic
#crawlers list
BotsUserAgents = [
'Mozill... | Kwojtanek/stargazer | zorya/middleware/crawlermiddleware.py | crawlermiddleware.py | py | 2,676 | python | en | code | 1 | github-code | 90 |
16305354052 | from django.shortcuts import render,redirect
from driver.database import mongo_test
from django.http import HttpResponseRedirect
# Create your views here.
def dashboard(request):
if mongo_test():
if request.COOKIES.get('SessionAuth'):
return render(request,'dashboard.html')
else:
... | salehsedghpour/monit_mine_panel | dashboard/views.py | views.py | py | 403 | python | en | code | 0 | github-code | 90 |
44360816727 | from base_analyzer import BaseAnalyzer
from models.protoss_csv import ProtossCSV
class ProtossAnalyzer(BaseAnalyzer):
def __init__(self):
self.csv = ProtossCSV()
self.race = "protoss"
self.csv_filename = f'{self.race}_all_replays.csv'
def getBuildOrderRow(self, filename, playerName, bu... | ProgrammerMatt/bw-analyzer | machinelearning/analyzers/protoss_analyzer.py | protoss_analyzer.py | py | 747 | python | en | code | 0 | github-code | 90 |
39129519849 | import pandas as pd
import numpy as np
import string
import pickle
import math
def transform_sentences(sentences):
sentences = [s.translate(str.maketrans('', '', string.punctuation)) for s in sentences]
sentences = [s.strip() for s in sentences]
sentences = [s.lower() for s in sentences]
sentences = ... | YeonwooSung/ai_book | Experiments/CV/ocr_with_bert/src/modules/typo_detection/dataset_ready.py | dataset_ready.py | py | 3,035 | python | en | code | 17 | github-code | 90 |
18583980499 | s = input().split()
n = int(s[0])
a = int(s[1])
b = int(s[2])
sums = []
for i in range(1, n + 1):
x = i
check = 0
while (x > 0):
y = x % 10
x = int(x / 10)
check += y
if a <= check <= b:
sums.append(i)
answer = 0
for i in range(len(sums)):
answer += sums[i]
print(... | Aasthaengg/IBMdataset | Python_codes/p03478/s055437504.py | s055437504.py | py | 327 | python | en | code | 0 | github-code | 90 |
16503039535 | import tensorflow as tf
import os
import cv2
import numpy as np
import random
from tqdm import tqdm
import io
import logging
from xml.dom import minidom
import tensorflow.gfile as tf_reader
from tensorflow.python.keras.preprocessing.image import img_to_array
def _bytes_feature(value):
return tf.train.Feature(bytes_... | aakashbajaj/retina-oct | preprocess/tfr_utils.py | tfr_utils.py | py | 3,907 | python | en | code | 0 | github-code | 90 |
18455705159 | import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
from itertools import accumulate
N, K = map(int, input().split())
sushi = defaultdict(list)
for i in range(N):
t, d = map(int, input().split())
sushi[t].append(d)
first = []
second = []
for key in sushi:
sushi[k... | Aasthaengg/IBMdataset | Python_codes/p03148/s119147294.py | s119147294.py | py | 710 | python | en | code | 0 | github-code | 90 |
40342096449 | import socket
import threading
import struct
import time
def encode_servers_dict():
encoded_dict = ""
for i in SERVERS_ADDRESSES:
encoded_dict += str(i) + ':' + SERVERS_ADDRESSES[i] + '\0'
return encoded_dict[:-1].encode()
def decode_servers_dict(encoded_dict):
msg = ""
for char in encod... | RaphaelBenoliel/CCNetworks | task_4/Server.py | Server.py | py | 6,615 | python | en | code | 0 | github-code | 90 |
17970512549 | H,W=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
A_dic={i+1:A[i] for i in range(N)}
Squares=[[0 for i in range(W)] for j in range(H)]
step_w=1
w,h,cnt=0,0,0
for k,v in A_dic.items():
for i in range(v):
cnt+=1
Squares[h][w]=str(k)
if cnt%W==0:
h+=1
... | Aasthaengg/IBMdataset | Python_codes/p03638/s002434634.py | s002434634.py | py | 420 | python | en | code | 0 | github-code | 90 |
18021859269 | N,Ma,Mb=map(int,input().split())
abc=[]
INF=float("inf")
for i in range(N):
a,b,c=map(int,input().split())
abc.append((a,b,c))
stack=set([(0,0)])
dp=[[[INF]*(401) for j in range(401)] for i in range(N+1)]
dp[0][0][0]=0
for i in range(N):
dp[i+1][0][0]=0
a,b,c=abc[i]
stack_=set()
for x,y in stack... | Aasthaengg/IBMdataset | Python_codes/p03806/s670479106.py | s670479106.py | py | 663 | python | en | code | 0 | github-code | 90 |
15773406626 | # Ein kjapp og enkel gjennomgang av nokre filhandteringsteknikkar i Python.
# https://www.w3schools.com/python/python_ref_file.asp
# Sjå også dokumentasjonen til Python:
# https://docs.python.org/3/library/io.html
dokument = open("fil.txt", "w")
dokument.write("Dette er linje 1\n")
dokument.write("Dette er linje 2\n")... | hausnes/IT2-2023-2024 | oop/fil-og-skriving/filoperasjonar-innebygd.py | filoperasjonar-innebygd.py | py | 734 | python | no | code | 1 | github-code | 90 |
9404737327 | from app.models import base
from sqlalchemy import (
Column,
String,
INTEGER,
)
class UserTeam(base):
__tablename__ = 'user-teams'
prefix = 'UT'
user_unid = Column(String(34))
team_unid = Column(String(34))
member_type = Column(INTEGER)
member_mappings = {
1: 'Parti... | mitchfriedman/SatedSolutions | app/models/user_team.py | user_team.py | py | 1,446 | python | en | code | 1 | github-code | 90 |
18116458499 | import math
n = int(input())
def three(p1x, p1y, p2x, p2y):
dx = (p2x - p1x)
dy = (p2y - p1y)
sx = dx / 3 + p1x
sy = dy / 3 + p1y
tx = p2x - (dx / 3)
ty = p2y - (dy / 3)
mtx = tx - sx
mty = ty - sy
rad = math.radians(60)
mux = mtx * math.cos(rad) - (mty * math.sin(rad))
mu... | Aasthaengg/IBMdataset | Python_codes/p02273/s691779051.py | s691779051.py | py | 874 | python | en | code | 0 | github-code | 90 |
73067927338 | import unittest
from fimutil.netam.nso import NsoClient
from fimutil.netam.sr_pce import SrPceClient
from fimutil.netam.arm import NetworkARM
class NetAmTest(unittest.TestCase):
def setUp(self) -> None:
pass
@unittest.skip
def testNsoClient(self):
nso = NsoClient()
devs = nso.dev... | fabric-testbed/information-model-utils | test/netam_test.py | netam_test.py | py | 1,114 | python | en | code | 2 | github-code | 90 |
13590302008 | from setuptools import setup, find_packages
__version__ = '1.0.0'
url = 'https://github.com/rusty1s/pytorch_geometric'
install_requires = [
'numpy',
'scipy',
'networkx',
'plyfile',
]
setup_requires = ['pytest-runner']
tests_require = ['pytest', 'pytest-cov']
setup(
name='torch_geometric',
ver... | Cyanogenoid/fspool | graphs/setup.py | setup.py | py | 827 | python | en | code | 44 | github-code | 90 |
18500431789 | import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline
# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()... | Aasthaengg/IBMdataset | Python_codes/p03268/s552633743.py | s552633743.py | py | 704 | python | en | code | 0 | github-code | 90 |
23714544871 | import cv2
import os
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(16, 16))
basedir = 'chest_xray'
for subdir in os.listdir(basedir):
for _class in os.listdir(os.path.join(basedir,subdir)):
for image_dir in os.listdir(os.path.join(basedir,subdir,_class)):
image_path = os.path.join(based... | YuanitaIP/DPS3-D-Bangkit-Final-Project-Assignment---Pneumonia-Classification | clahe.py | clahe.py | py | 528 | python | en | code | 0 | github-code | 90 |
15802221825 | # -*- coding: utf-8 -*-
"""
606. Construct String from Binary Tree
You need to construct a string consists of parenthesis and integers from a binary tree with the preorder
traversing way.
The null node needs to be represented by empty parenthesis pair "()".
And you need to omit all the empty parenthesis pairs that do... | tjyiiuan/LeetCode | solutions/python3/problem606.py | problem606.py | py | 996 | python | en | code | 0 | github-code | 90 |
29037549150 | #
# Nathan Lay
# AI Resource at National Cancer Institute
# National Institutes of Health
# January 2021
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE... | nslay/HingeTreeForTorch | experiments/run_abalone_reg.py | run_abalone_reg.py | py | 9,312 | python | en | code | 0 | github-code | 90 |
5261537528 | from collections import deque
l = [2,-1,-7,8,-15,30,24,6]
def printFN(l,k):
dq = deque()
for i in range(k):
if l[i] < 0:
dq.append(i)
# print(dq)
if len(dq) == 0:
print(0,end = " ")
else:
print(l[dq[0]],end= " ")
for i in range(k,len(l)):
if l[i... | ShubhamSinghal12/PythonDSAClassroomApril2022 | Lec29/FirstNegK.py | FirstNegK.py | py | 567 | python | en | code | 1 | github-code | 90 |
17944537909 | from collections import defaultdict
vis = [0 for i in range(0 , 2000)]
lt = [0 for i in range(0 , 2000)]
dis = [0 for i in range(0 , 2000)]
adj = defaultdict(list)
time = 0
ans = 0
def dfs(u , p):
global time , ans
time = time+1
lt[u]= dis[u]=time
vis[u]=1
for v in adj[u]:
if v==p:
continue
if vis[v]==0:
... | Aasthaengg/IBMdataset | Python_codes/p03575/s845693510.py | s845693510.py | py | 705 | python | en | code | 0 | github-code | 90 |
34870824750 | from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import Timedelta
import pandas._testing as tm
from pandas.core.arrays import (
DatetimeArray,
TimedeltaArray,
)
class TestNonNano:
@pytest.fixture(params=["s", "ms", "us"])
def unit(self, request):
... | pandas-dev/pandas | pandas/tests/arrays/test_timedeltas.py | test_timedeltas.py | py | 10,643 | python | en | code | 40,398 | github-code | 90 |
40886684262 | import xml.etree.ElementTree as etree
import codecs
import csv
import time
import os
import re
import json
import nltk
from nltk import word_tokenize
from nltk.stem import SnowballStemmer
import pickle as pkl
from gibberish_detector import detector
from tqdm import tqdm
# http://www.ibm.com/developerworks/xml/library/... | starc52/Wikipedia-Search-Engine | index_old.py | index_old.py | py | 6,947 | python | en | code | 0 | github-code | 90 |
3873944150 | import pygame
class Column:
def __init__(self, width, title):
self.width = width
self.title = title
class Listbox:
def __init__(self, game, x, y, width, max_items, columns, ondraw, onclick, onupdate):
self.game = game
self.x = x
self.y = y
self.width = width
... | RektInator/infprj2 | infprj2/listbox.py | listbox.py | py | 2,700 | python | en | code | 4 | github-code | 90 |
72207853418 | """
新建一个链表
"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def stringToListNode(input):
input = input.split(',')
dummyRoot = ListNode(0)
ptr = dummyRoot
for number in input:
ptr.next = ListNode(int(number))
ptr = ptr.next
ptr = dummyR... | Asunqingwen/LeetCode | AC组/链表.py | 链表.py | py | 555 | python | en | code | 0 | github-code | 90 |
73575666217 | def main():
lista = insertion([6,5,3,1,8,7,2,4])
print(lista)
def insertion(lista):
for i, number in enumerate(lista):
j = i - 1
while j >= 0 and number < lista[j]:
lista[i] = lista[j]
lista[j] = number
i-=1
j-=1
return lista
main() | Algoritmos-y-Programacion-2223-2-S5/Ejercicios-Clase | Semana 10/Lunes (1)/Lunes/insertion.py | insertion.py | py | 314 | python | en | code | 0 | github-code | 90 |
28111877027 | from db import *
from tabulate import tabulate
def addStudent(name, phno, address):
conn = connectDB()
if conn:
cursor = conn.cursor()
query = 'INSERT INTO STUDENT(name, phno, address) VALUES(%s, %s, %s);'
args = (name, phno, address)
cursor.execute(query, args)
... | RamanaMenda/library-management-system | method.py | method.py | py | 4,199 | python | en | code | 0 | github-code | 90 |
22029620172 | import os
import sys
import configparser
from rbnics.utils.decorators import overload, set_of
from rbnics.utils.mpi import parallel_io
class Config(object):
rbnics_directory = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir))
# Set class defaults
defaults = ... | RBniCS/RBniCS | rbnics/utils/config/config.py | config.py | py | 6,211 | python | en | code | 83 | github-code | 90 |
41849828080 | #Write a program that reads a list of numbers list from the first line and a number x from the second line, which prints out all the positions where the number x occurs
#in the given list list.
#Positions are numbered from zero, if the number x is not found in the list, output the string "None" (without quotes, with a... | Lavliet90/if_for_input_split.py | if_for_input_split.py | if_for_input_split.py | py | 573 | python | en | code | 0 | github-code | 90 |
10256157367 | # =============================================================================
# Programming Project 9
# Algorithm:
# read a file with information on pokemon video game
# build a nested dictionary
# loop prompting for a valid option
# call the specific function to display the data corresponding to the ... | palinaskakun/Pokedex | proj09.py | proj09.py | py | 16,462 | python | en | code | 0 | github-code | 90 |
34762866985 | import tensorflow as tf
def _float_feature(value):
return tf.train.Feature(float_list=tf.train.FloatList(value=[value]))
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def build_estimator_request(request, data):
COLUMNS=data["COLUMNS"]
FIELD_TYPES... | Mirco-Nani/tensorflow_model_server | inout/requests.py | requests.py | py | 1,238 | python | en | code | 0 | github-code | 90 |
8842637771 | from pymysql import *
class MysqlClient:
def __init__(self,user,password,database,host='localhost',port=3306):
self.conn = connect(host=host,port=port,user=user,password=password,database=database,charset='utf8')
self.cs = self.conn.cursor()
def close(self):
self.cs.close()
sel... | Clinkz-1/notes | buff/utils/mysql_test.py | mysql_test.py | py | 3,579 | python | en | code | 1 | github-code | 90 |
1879916936 | from unittest import TestCase
import requests
from acceptance_tests import DASHBOARD_SERVER_URL
class StatusTests(TestCase):
POSITIVE_STATUS = 'OK'
def test_health(self):
response = requests.get(f'{DASHBOARD_SERVER_URL}/health')
self.assertEqual(response.status_code, 200)
expected... | openedx/edx-analytics-dashboard | acceptance_tests/test_status.py | test_status.py | py | 712 | python | en | code | 72 | github-code | 90 |
17800899976 | import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
df_movies = pd.read_csv("data/movies_metadata.csv", usecols = ["id", "original_title", "revenue"])
df_rating = pd.read_csv("data/ratings_small.csv", usecols = ["movieId", "rating"])
df_rating.rename(columns = {"movieId": "id"}, inp... | giovanni-cutri/clustering-experiments | movies/cluster-analysis.py | cluster-analysis.py | py | 927 | python | en | code | 0 | github-code | 90 |
31423113693 | #! usr/bin/env/python3
# coding:utf-8
# @Time: 2019-10-10 16:12
# Author: turpure
from src.services.base_service import BaseService
import requests
import json
class Worker(BaseService):
def get_products(self):
base_url = 'http://111.231.88.85:38080/hysj_v2/ebay_api/item_infos?u_name=youran&time=15706... | yourant/ur_cleaner | sync/haiying/ebay_products.py | ebay_products.py | py | 2,615 | python | en | code | 0 | github-code | 90 |
5719628386 | #-------------------------------------------------------------------------------
# Name: parseHTMLimages.py
# Purpose: Displays the number of images in given url
# Usage: Requires one argument: a url.
#
# Author: Johanson Onyegbula
#
# Created: 25/06/2020
#-------------------------------------... | Johanson20/Python4Geoprocessing | ch20/parseHTMLimages.py | parseHTMLimages.py | py | 736 | python | en | code | 0 | github-code | 90 |
34709470554 | from pynboids import Boid
from random import randint
import pygame as pg
'''
Multilayer Boids test
Copyright (c) 2021 Nikolaus Stromberg
'''
BPL = 12 # How many boids per layer
WRAP = False # False avoids edges, True wraps boids to other side.
BGCOLOR = (0, 0, 42) # Background color in RGB.
... | TrendingTechnology/PyNBoids | multilayertest.py | multilayertest.py | py | 2,445 | python | en | code | null | github-code | 90 |
25020671528 | #!/usr/bin/env python
# coding=utf-8
import numpy as np
from cycler import cycler
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import matplotlib.patches as mpatches
import random
import crc16
from zlib import crc32
import hashlib
import pickl... | goodnighthy/MTNF | traffic_analysis/line/cache_update_method/simulation.py | simulation.py | py | 9,231 | python | en | code | 0 | github-code | 90 |
73496877415 | import json
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import Paginator
from rest_framework import serializers, viewsets
from backend.exception import ErrorCode, PlatformError
from backend.models import Report
from backend.util import UserHolder, Response, parse_data, page_params, ... | felixu1992/testing-platform | backend/handler/record/report.py | report.py | py | 2,593 | python | en | code | 0 | github-code | 90 |
18524173729 | n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
sum_list = [0] * 8
l_ppp = [0] * n
l_ppm = [0] * n
l_pmp = [0] * n
l_mpp = [0] * n
l_pmm = [0] * n
l_mpm = [0] * n
l_mmp = [0] * n
l_mmm = [0] * n
for i in range(n):
l_ppp[i] = l[i][0] + l[i][1] + l[i][2]
l_ppm[i] = l[i]... | Aasthaengg/IBMdataset | Python_codes/p03326/s944296622.py | s944296622.py | py | 1,157 | python | en | code | 0 | github-code | 90 |
16646026404 | from urllib import request
google_url_loc = 'http://samplecsvs.s3.amazonaws.com/TechCrunchcontinentalUSA.csv'
def download_csv_file(csv_url):
response = request.urlopen(csv_url)
csv = response.read()
str_data = str(csv)
lines = str_data.split('\\n')
dst = r'online.csv'
fp = open(dst, "w")
... | kusuma-bharath/Python | ex_dwnld_f_web.py | ex_dwnld_f_web.py | py | 421 | python | en | code | 0 | github-code | 90 |
72207987498 | # -*- coding: utf-8 -*-
# @Time : 2019/11/18 0018 9:56
# @Author : 没有蜡笔的小新
# @E-mail : sqw123az@sina.com
# @FileName: Integer Break.py
# @Software: PyCharm
# @Blog :https://blog.csdn.net/Asunqingwen
# @GitHub :https://github.com/Asunqingwen
"""
Given a positive integer n, break it into the sum of at least two ... | Asunqingwen/LeetCode | medium/Integer Break.py | Integer Break.py | py | 954 | python | en | code | 0 | github-code | 90 |
18490607909 | n = int(input())
v = list(map(int, input().split()))
from collections import Counter
odd_ary = v[::2]
even_ary = v[1::2]
# 最頻値top2
oc = Counter(odd_ary).most_common(2)
ec = Counter(even_ary).most_common(2)
if len(oc) == 1:
oc.append((0, 0))
if len(ec) == 1:
ec.append((0, 0))
if oc[0][0] != ec[0][0]:
prin... | Aasthaengg/IBMdataset | Python_codes/p03244/s387851570.py | s387851570.py | py | 422 | python | en | code | 0 | github-code | 90 |
7544954871 | from datetime import datetime
import logging
import tempfile
import os
# import logger
log = logging.getLogger(__name__)
def print_status(status):
'''print timestamped status update'''
print('--[' + datetime.now().strftime('%Y-%m-%d %H:%M:%S') + '] ' + status + '--')
log.info(status)
def create_temp_folder():
'... | DABAKER165/pepMeld | pepMeld/utils.py | utils.py | py | 3,735 | python | en | code | 2 | github-code | 90 |
27353926491 | import logging
from flask import Flask
from flask import request, Response
from viberbot.api.viber_requests import ViberMessageRequest, \
ViberConversationStartedRequest, ViberSubscribedRequest, \
ViberFailedRequest
from messages.messages import send_text_message, send_next_block
from bot.bot import viber
... | UAWarDevelopers/-viber_first_aid | main.py | main.py | py | 1,903 | python | en | code | 0 | github-code | 90 |
28449966986 | from engine.engine_template import EngineTemplate
from wifuxlogger import WifuxLogger as LOG
import network
sta_if = network.WLAN(network.STA_IF)
def run(cmds):
return eval("{}({})".format(cmds[1],EngineTemplate.exec_formatter_api(cmds)))
def connect(cmds):
blueprint = EngineTemplate.parameter_parser(cmds)
... | gooz-project/gooz-os-v1.0.0 | dev/wifi/core.py | core.py | py | 2,260 | python | en | code | 5 | github-code | 90 |
73402688616 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="link-crab",
version="0.2.1",
author="Krisztián Pál Klucsik",
author_email="klucsik.krisztian@gmail.com",
description="A link crawler and permission testing tool for websites",
long_des... | klucsik/link-crab | setup.py | setup.py | py | 951 | python | en | code | 0 | github-code | 90 |
28221838843 | s1 = input()
s2 = input()
len1, len2 = len(s1), len(s2)
# 长度数组
lst_lst = list()
# 初始数组
for i in range(len1+1):
tmp_lst = list()
for j in range(len2+1):
if i == 0:
tmp_lst.append(j)
elif j == 0:
tmp_lst.append(i)
else:
tmp_lst.append(0)
lst_lst.a... | HandsomeLuoyang/LuoGuProblems | 最小编辑距离-动态规划.py | 最小编辑距离-动态规划.py | py | 783 | python | en | code | 0 | github-code | 90 |
28770149543 | import random
from time import sleep
from observer import Observer
from data import fire_departments
from fire_units import FireDepartment, FireTruck, FreeTruck, BusyTruck
from event import Event, MZ, PZ
from iterator import Iterator
from strategies import DefaultStrategies, StrategyMZ, StrategyPZ
class Manager:
... | mzkaoq/simulation_of_deploying_firetrucks_for_emergency_situation | manager.py | manager.py | py | 1,521 | python | en | code | 0 | github-code | 90 |
22775678379 | import copy
import os
import jsonlines
from tqdm import tqdm
from typing import List, Optional, Tuple
import parlai.utils.logging as logging
from parlai.core.teachers import ChunkTeacher
from .build import build, DATASET_NAME_LOCAL
from .utils.text_utils import simplify_nq_example
from parlai.core.opt import Opt
from... | Seagate/cortx | doc/integrations/parlAI/parlai/tasks/natural_questions/agents.py | agents.py | py | 9,445 | python | en | code | 631 | github-code | 90 |
30572847665 | #https://blog.csdn.net/qq_47233366/article/details/122611672
import torch
import torchvision
import torch.nn as nn
import numpy as np
image_size = [1, 28, 28]
latent_dim = 100
batch_size = 4
#1、准备数据集
# Training
dataset = torchvision.datasets.MNIST("mnist_data", train=True, download=True,
... | wsj-create/GAN | test_gan.py | test_gan.py | py | 4,167 | python | en | code | 3 | github-code | 90 |
31779032908 | from django.contrib import admin
from . import models
class SectionInline(admin.TabularInline):
model = models.Section
class PageInline(admin.TabularInline):
model = models.Page
class CourseAdmin(admin.ModelAdmin):
readonly_fields = ('author', )
inlines = [SectionInline]
def save_model(self, request, obj, f... | Topliyak/teach-service | server/apps/courses/admin.py | admin.py | py | 886 | python | en | code | 0 | github-code | 90 |
35642698886 | from datetime import timedelta
from IPlugin import IPlugin
import os
# add proper error handling
class Linux(IPlugin):
def __init__(self, config, dispatcher):
self.allow_reboot_shutdown = config['allow_reboot_shutdown']
return
def handlemessage(self, bot, msg):
if msg.text.lower() == ... | BerndAmend/minion_bot | plugins/linux.py | linux.py | py | 1,433 | python | en | code | 1 | github-code | 90 |
41900878821 | def sum_rows(row1: list, row2: list):
"""
Summarizes two rows of the current simplex table. The lines are set in the parameters
:param row1: the first line is the summand
:param row2: the second line is the summand
:return: sum_rows (list): result summarizes
"""
row_sum = [0 for i in range(l... | AndreyRysistov/GomoryMethod | FunctionalApproach/table_tools.py | table_tools.py | py | 890 | python | en | code | 2 | github-code | 90 |
4465448172 | import os
from termcolor import colored
import yaml
from ..transformation.load_ground_truth import GroundTruthLoad
from ..classification.classification_task_manager import ClassificationTaskManager
from ..transformation.load_ground_truth import DatasetExporter
from ..helper_functions.logging_tool import LoggerSetup
... | tzamalisp/gsoc-music-classification-sklearn | classification/train_class.py | train_class.py | py | 4,524 | python | en | code | 0 | github-code | 90 |
21156333267 | from pages.locators import SupportPageLocators
class TestData:
number_of_users = [2, 4, 8, 16]
list_of_correct_ids = [2, 4, 6, 8]
list_of_incorrect_ids = [23, 44, 56]
number_of_delays = [2, 3, 4]
create_user_data = {
"name": "morpheus",
"job": "leader"
}
update_user_da... | bulatshuh/reqres_test | lib/test_data.py | test_data.py | py | 4,541 | python | en | code | 0 | github-code | 90 |
40580928256 | """
207. Course Schedule
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai.
For example, the pair [0, 1], indicates that to take c... | venkatsvpr/Problems_Solved | LC_Course_Schedule.py | LC_Course_Schedule.py | py | 2,115 | python | en | code | 3 | github-code | 90 |
28191315347 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index),
url(r'^process_registration$', views.process_registration),
url(r'^logincheck$', views.loginchk),
url(r'^travels/add$', views.newtrippage),
url(r'^travels/process_trip$', views.processtrip),
... | timquayle/tb | apps/tripsched/urls.py | urls.py | py | 1,221 | python | en | code | 0 | github-code | 90 |
6661967750 |
from io import BytesIO
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use('ggplot')
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['figure.facecolor']='w'
plt.rcParams['savefig.facecolor']='w'
plt.rcParams['text.color']='b'
plt.rcParams['xtick.labelsize']=16
plt.rcParams['ytick.labelsize']... | jameszlj/NLP_with_python | input/helper.py | helper.py | py | 3,170 | python | en | code | 2 | github-code | 90 |
19197547894 | from time import sleep
from .StepperDriver import *
try:
import RPi.GPIO as GPIO
except:
import Mock.GPIO as GPIO
class A4988Driver(StepperDriver):
__STEPS_PER_REVOLUTION = 200
def __init__(self, step_pin, dir_pin):
StepperDriver.__init__(self)
self.__step_pin = step_pin
self.... | MatheusKunnen/integration-workshop-3 | vending-machine/motion-system/MotionSystemController/A4988Driver.py | A4988Driver.py | py | 1,442 | python | en | code | 0 | github-code | 90 |
5438103749 | import argparse
import re
import pandas as pd
def get_commandline_args():
description = ('gets table of Lebedev coordinates and weights from the '
'source code from John Burkardt')
parser = argparse.ArgumentParser(description=description)
parser.add_argument('--source_filename',
... | lucasmyers97/lebedev-quadrature | scripts/get_lebedev_table_from_burkardt.py | get_lebedev_table_from_burkardt.py | py | 3,016 | python | en | code | 2 | github-code | 90 |
13674356510 | """
This script computes all results and plots concerning the flexibility potential of EV that were published in the paper
"Quantifying the Flexibility of Electric Vehicles in Germany and California – A Case Study".
"""
__author__ = "Michel Zadé"
__copyright__ = "2020 TUM-EWK"
__credits__ = []
__license__ = "GPL v3.0"... | tum-ewk/OpenTUMFlex | analysis/run_ev_case_study.py | run_ev_case_study.py | py | 4,191 | python | en | code | 20 | github-code | 90 |
239205234 | #!/usr/bin/env python
import time
import rospy
import math
import pandas as pd
import numpy as np
from geometry_msgs.msg import Twist,PoseStamped
from nav_msgs.msg import Odometry,Path
from array import *
import tf
import os
import rospy
import pickle
global x,y
class Test1():
def __init__(self):
self.g... | LiYifei1218/turtlebot-motion-planning | turtlebot.py | turtlebot.py | py | 5,781 | python | en | code | 0 | github-code | 90 |
319854124 | import argparse
import os
from net.initialization.folders.default_folders import default_folders_dict
from net.initialization.folders.experiment_complete_folders import experiment_complete_folders_dict
from net.initialization.path.experiment_complete_result_path import experiment_complete_result_path_dict
from net.ini... | cirorusso2910/GravityNet | net/initialization/init_complete.py | init_complete.py | py | 8,363 | python | en | code | 7 | github-code | 90 |
38416352358 | from flask import render_template, request, jsonify, abort, redirect, url_for, flash
from mdurocherart.contact import bp
from mdurocherart.contact.models import send_email, format_email, send_email_with_attachments
from mdurocherart.utils import _validate_file
@bp.route("/", methods=["GET"])
def homepage():
retur... | DKasonde/art_portfolio_site | src/mdurocherart/contact/routes.py | routes.py | py | 1,146 | python | en | code | 0 | github-code | 90 |
16363856248 | #!/usr/bin/env python
import unittest
from ct.crypto.asn1 import tag
class TagTest(unittest.TestCase):
"""Test tag encoding."""
def test_encode_read(self):
valid_tags = (
# (initializers, encoding)
((0, tag.UNIVERSAL, tag.PRIMITIVE), "\x00"),
((1, tag.UNIVERSAL, ... | google/certificate-transparency | python/ct/crypto/asn1/tag_test.py | tag_test.py | py | 2,505 | python | en | code | 862 | github-code | 90 |
38090004240 | #encoding=utf-8
import cv2
import numpy as np
import pickle
import matplotlib.pyplot as plt
import sys,os
from PIL import Image
##读取保存的列表文件
totalList = pickle.load(open("./totalList.txt",'rb'))
#patchInfo用于保存每一种场景有多少张图片以及每张图片有多少个patch
patchInfo = []
imageN = 0
patchN = 0
##保存截取的结果列表到本地的totalList.txt文件
fileSrc = "D:/Pyt... | hongge831/scene_change_detection | tools/imgaeCutTest/makeData.py | makeData.py | py | 1,049 | python | en | code | 0 | github-code | 90 |
32409714161 | # This is a sample Python script.
# Press Maiusc+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import tkinter as tk
home_gui = tk.Tk()
graph_gui = tk.Tk()
def home_button1_action():
print('primo est... | gamico001/regression_se | Test/test_More_GUI.py | test_More_GUI.py | py | 1,077 | python | en | code | 0 | github-code | 90 |
14227546868 | from turtle import Turtle, Screen
import random
#
#
#
class Food(Turtle):
def __init__(self):
"""
Constructor.-
"""
super().__init__()
self.shape("turtle")
self.penup()
self.shapesize(stretch_len=1, stretch_wid=1)
self.color("green")
... | fjpolo/Udemy100DaysOfCodeTheCompletePyhtonProBootcamp | Day020_021/food.py | food.py | py | 594 | python | en | code | 8 | github-code | 90 |
25112489446 | import pytesseract
from PIL import Image, ImageOps, ImageFilter
# Set the path to the tesseract executable if it's not in the PATH
# pytesseract.pytesseract.tesseract_cmd = '/usr/local/bin/tesseract' # Path to tesseract on macOS
# Function to preprocess and invert image colors
def preprocess_and_invert_image(image_p... | shmrymbd/ocr | untitled folder/new2.py | new2.py | py | 1,241 | python | en | code | 0 | github-code | 90 |
42130473014 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vohni', '0005_auto_20170401_1306'),
]
operations = [
migrations.AlterModelOptions(
name='day',
optio... | suchOK/saintelm_2017 | vohni/migrations/0006_auto_20170401_1316.py | 0006_auto_20170401_1316.py | py | 513 | python | en | code | 0 | github-code | 90 |
18314235369 | from collections import defaultdict
import sys
sys.setrecursionlimit(10**5)
def solve():
N = int(input())
G = defaultdict(list)
for i in range(N-1):
a, b = map(int,input().split())
a -= 1
b -= 1
G[a].append((b,i))
G[b].append((a,i))
res = [0] * (N-1)
dfs... | Aasthaengg/IBMdataset | Python_codes/p02850/s766291151.py | s766291151.py | py | 686 | python | en | code | 0 | github-code | 90 |
24191592158 | import math
# Get two numbers from the user.
num_items = int(input(f"Enter the number of items: "))
items_per_box = int(input(f"Enter the number of items per box: "))
# Compute the number of boxes by dividing
# and then calling the math.ceil function.
num_boxes = math.ceil(num_items / items_per_box)
# Display a blan... | byui-cse/cse111-course | docs/lesson02/check_solution.py | check_solution.py | py | 497 | python | en | code | 2 | github-code | 90 |
18197876729 | x,n=[int(x) for x in input().split()]
if n==0:
print(x)
else:
p=[int(x) for x in input().split()]
ans=[]
Flag=False
while ans==[]:
for i in range(105):
if x-i not in p:
ans.append(x-i)
Flag=True
break
elif x+i not in p:
ans.append(x+i)
Flag=True
... | Aasthaengg/IBMdataset | Python_codes/p02641/s530230180.py | s530230180.py | py | 368 | python | en | code | 0 | github-code | 90 |
18218587039 | import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
return int(input())
def inpl():
return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------
N, K = inpl()
dp = [False] * N
for i in range(K):
d = inp()
A = inpl()
... | Aasthaengg/IBMdataset | Python_codes/p02688/s268638487.py | s268638487.py | py | 540 | python | en | code | 0 | github-code | 90 |
72558385258 | class ExternalError(Exception):
pass
def load_yaml(yml_txt, file_name=None, valid=None):
"""Load a YAML file and optionally apply a validator."""
import yaml
try:
if file_name:
with open(file_name) as f:
yml_txt = f.read()
yml = yaml.safe_load(yml_txt)
... | briancamp/brlib | load_yaml.py | load_yaml.py | py | 557 | python | en | code | 0 | github-code | 90 |
18460259329 | H,W = list(map(int, input().split()))
S = [[1 if s=='#' else -1 for s in input()] for _ in range(H)]
def surround(matrix, fill=0):
if not isinstance(matrix, list):
raise
if not all([isinstance(rows, list) for rows in matrix]):
raise
if not all([len(rows)==len(matrix[0]) for rows in matrix]):
raise
... | Aasthaengg/IBMdataset | Python_codes/p03157/s717959563.py | s717959563.py | py | 1,238 | python | en | code | 0 | github-code | 90 |
40247486539 | """Crea una función llamada devolver_distintos() que reciba 3
integers como parámetros.
Si la suma de los 3 numeros es mayor a 15, va a devolver el
número mayor.
Si la suma de los 3 numeros es menor a 10, va a devolver el
número menor.
Si la suma de los 3 números es un valor entre 10 y 15
(incluidos) va a devolver el n... | DARANCOG/Python-Projects | Día #5/Ejercicio_1.py | Ejercicio_1.py | py | 732 | python | es | code | 0 | github-code | 90 |
73514797738 | import itertools
import math
from collections import defaultdict, Counter
def sieve(x: int) -> list:
_out = [0] * (x + 1)
_out[0] = _out[1] = 0
i = 2
while i <= math.sqrt(x):
if not _out[i]:
k = i ** 2
while k <= x:
# This condition ensures that only t... | kerwei/treasure-trove | nondivisor.py | nondivisor.py | py | 1,953 | python | en | code | 0 | github-code | 90 |
21756340460 | import os
import re
import argparse
import subprocess
import shutil
def main():
parser = argparse.ArgumentParser(description="基于Blast筛选Novoplasty产生的几个option中哪个是最佳序列")
parser.add_argument("-i", "--input", required=False, default=r"D:\working\Develop\EasyMiner Develop\EasyMiner\bin\Debug\net6.0-windows\results\6... | sculab/EasyMiner | scripts/check_option_blast.py | check_option_blast.py | py | 3,091 | python | en | code | 1 | github-code | 90 |
70807740457 | import sys
import os
import json
import tce_py.tce_report as report
def _read_conf(path):
with open(path, "r") as fp:
conf = json.load(fp)
p = os.path.abspath(path)
conf["tcedir"] = os.path.dirname(p)
return conf
def main(argv):
if len(argv) != 5:
raise ValueError("invalid cmdlin... | oktetlabs/test-environment | tools/tce/tce_merge_report.py | tce_merge_report.py | py | 769 | python | en | code | 4 | github-code | 90 |
24381503317 | """
This file is part of Athena.
Athena is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Athena is distributed in th... | magdalene/athena-legislation | legislation/data_processing/notify.py | notify.py | py | 2,867 | python | en | code | 0 | github-code | 90 |
18072358639 | # ABC042D - いろはちゃんとマス目 / Iroha and a Grid (ARC058D)
def comb(n: int, r: int) -> int:
return fact[n] * inv[n - r] * inv[r]
def main():
global fact, inv
H, W, A, B = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7
# table of factorials
fact, x = [1] * (H + W + 1), 1
for i in range(1, H + ... | Aasthaengg/IBMdataset | Python_codes/p04046/s205926498.py | s205926498.py | py | 773 | python | en | code | 0 | github-code | 90 |
13307195719 | #!/usr/bin/env python3
import nice
import json
import re
from bs4 import BeautifulSoup
url_override = {
# Badly written disambiguation page:
'https://de.wikipedia.org/wiki/Christian_Petry': 'https://de.wikipedia.org/wiki/Christian_Petry_(Politiker)',
'https://de.wikipedia.org/wiki/Charles_Huber': 'https:... | Schwenger/House-Of-Tweets | tools/PhotoMiner/wikify_each.py | wikify_each.py | py | 15,868 | python | en | code | 0 | github-code | 90 |
27997923331 | from jinja2 import Environment, FileSystemLoader, select_autoescape, meta, Template
from sql_gen.template_source import TemplateSource
from sql_gen.prompter import Prompter
from sql_gen.filter_loader import load_filters
import filters.description
from filters.description import DescriptionFilter
import os,sys
user_pat... | vecin2/em-dev-tools | build/lib.linux-x86_64-2.7/sql_gen/sql_gen.py | sql_gen.py | py | 2,683 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.