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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18336269159 |
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
import math
def is_prime(n):
if n == 1: return False
for k in range(2... | Aasthaengg/IBMdataset | Python_codes/p02900/s086024773.py | s086024773.py | py | 648 | python | en | code | 0 | github-code | 90 |
72071244458 | # -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
"""통과"""
import sys
from collections import defaultdict, deque
def sysinput():
return sys.stdin.readline().rstrip()
sysprint = sys.stdout.write
n = int(sysinput())
m = int(sysinput())
friends = defaultdict(list)
for a in range(m):
u, v = map(int, sysinput()... | dig04214/python-algorithm | challenge/7/7_2.py | 7_2.py | py | 593 | python | en | code | 0 | github-code | 90 |
38633742014 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 23 15:06:45 2019
@author: Emma
Creates the animation videos to study the behaviour of individual runs.
Run the ebola model with store_data = True
The resulting csv files are loaded by this script and used to generate the videos
See bottom of this script on how to conca... | edenbrok/thesis | Final Model/VisualisationGenerator.py | VisualisationGenerator.py | py | 9,177 | python | en | code | 0 | github-code | 90 |
27096423548 | from spack import *
class RVisnetwork(RPackage):
"""Provides an R interface to the 'vis.js' JavaScript charting library. It
allows an interactive visualization of networks."""
homepage = "https://github.com/datastorm-open/visNetwork"
url = "https://cran.r-project.org/src/contrib/visNetwork_1.0.1... | matzke1/spack | var/spack/repos/builtin/packages/r-visnetwork/package.py | package.py | py | 675 | python | en | code | 2 | github-code | 90 |
13385870076 | import os
import re
import setuptools
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, "__init__.py")).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
with open("README.md", "r")... | acivitillo/giotto | setup.py | setup.py | py | 828 | python | en | code | 4 | github-code | 90 |
19667907925 | #풀이 2
def solution(n, lost, reserve):
chkreserve = [r for r in reserve if r not in lost]
chklost = [l for l in lost if l not in reserve]
for r in chkreserve:
left = r-1
right = r+1
if left in chklost:
chklost.remove(left)
elif right in chklost:
... | EonJu/programmers_python | 체육복.py | 체육복.py | py | 1,393 | python | en | code | 0 | github-code | 90 |
9484996160 |
def promptInput():
height = float(input('Bitte gib deine Korpergröße in m ein: '))
weight = int(input('Bitte gib dein Gewicht in kg ein: '))
return height, weight
def calculateBMI(height, weight):
return round((weight / (height * height)), 1)
def interpretResult(bmi):
if bmi < 19.0:
pr... | kelvin-homann/refugeeks | python_1/bmi_functions.py | bmi_functions.py | py | 565 | python | de | code | 2 | github-code | 90 |
7607069504 | import openai
import os
# Set up the OpenAI API client
openai.api_key = os.environ["OPENAI_API_KEY"]
def chat(prompt: str):
# Call the ChatCompletion API
try:
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", ... | jonasft/openai-api-cli | chat_completion_example.py | chat_completion_example.py | py | 1,018 | python | en | code | 0 | github-code | 90 |
35903252288 | from typing import List, Type
import pygame as pg
from .base import Scene, SceneParameter
from ..engine.board import Board
from ..engine.speed import create_accelerator, Factor, create_speed_generator
from ..engine.texture import ColorTexture, ColorContent
from ..engine.typing import (
type_of_level,
... | pandabb3356/pygame-tetris | tetris/scene/tetris.py | tetris.py | py | 6,857 | python | en | code | 0 | github-code | 90 |
70069535018 | from typing import List, Tuple
import input as inp
import re
class Line():
start: Tuple[int, int]
end: Tuple[int, int]
def __init__(self, start: Tuple[int, int], end: Tuple[int, int]) -> None:
self.start = start
self.end = end
def __str__(self) -> str:
return f"""{self.start}... | Filodoxia/advent-of-code | 2021/day5.py | day5.py | py | 5,483 | python | en | code | 0 | github-code | 90 |
9989478768 | from helpers import mysqlConnector
from flask import current_app, g, Response
import json
from flask_jwt_extended import jwt_required
from .users import user_required
@current_app.route('/v1/products', methods=['GET'])
@user_required
def getAllProducts():
sqlQuery= "SELECT id, name, price FROM products;"
cursor = my... | hek23/KeroHogar-USACH | api/controllers/products.py | products.py | py | 1,481 | python | en | code | 0 | github-code | 90 |
18266614299 | n=int(input())
x=list(map(int,input().split()))
ans=1000000000000
for p in range(100):
a=0
for i in range(n):
a+=(x[i]-p)**2
if a < ans:
ans = a
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02767/s751350875.py | s751350875.py | py | 185 | python | en | code | 0 | github-code | 90 |
18501964931 | """Creates Flask/html interface
switch between mocpi and raspi
"""
from flask import Flask, render_template, request
#from library.mocpi import contraption
from library.raspi import contraption
app = Flask(__name__)
ledcon = contraption.PiLedContraption()
@app.route('/')
def index():
return render_template('in... | musicalmacdonald/pi_led_contraption | library/contraption_flask_app.py | contraption_flask_app.py | py | 3,533 | python | en | code | 0 | github-code | 90 |
13224844061 | import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.exceptions import UnknownColumnNameError
@pytest.mark.parametrize(
("rows", "expected"),
[
(
[],
Table(),
),
(
[
Row({"A": 1, "B": 4, "C": "d"}),
... | Safe-DS/Library | tests/safeds/data/tabular/containers/_table/test_from_rows.py | test_from_rows.py | py | 1,621 | python | en | code | 11 | github-code | 90 |
11765312012 | # /usr/bin/env python
# coding: utf8
'''
Implémentation de la view qui permet à un membre du staff de voir les
informations sur une personne et de les modifier
'''
from itertools import chain
import datetime
from tennis.models import Court, Pair, Ranking, LogActivity
from django.contrib.auth.models import User
import ... | fthuin/software_engineering_project | ASMAE/tennis/views_helper/staff_user_edition.py | staff_user_edition.py | py | 4,100 | python | en | code | 1 | github-code | 90 |
36734220187 | from os import listdir
from os.path import isfile
import re
from ..shared import GlobalVariables
from ..debug import DebugPhotoFileFinder as debug
debug = debug()
def find_photos():
if not GlobalVariables.RECEIPT_LOCATION:
raise EnvironmentError('Receipt location not initialized')
ph... | DerekYu177/ExpenseManager | modules/data_file_manager/photo_file_finder.py | photo_file_finder.py | py | 851 | python | en | code | 1 | github-code | 90 |
73527259178 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from func import *
from params import mnist_para
class MNIST(nn.Module):
def __init__(self, train=mnist_para.train_thresh, thresh=mnist_para.init_thresh, heterogeneity=mnist_para.hete_thresh, tau=mnist_para.tau, P=10, time_step=mnist_pa... | sunhongze/STL-SNN | spiking_model.py | spiking_model.py | py | 2,089 | python | en | code | 2 | github-code | 90 |
18160014979 | #import torch
class solution(object):
def __init__(self, D: int, T: int, S: int)-> None:
self.D = D
self.T = T
self.S = S
def solve(self)->bool:
return ['No','Yes'][(self.D/self.S) <= self.T]
if __name__=='__main__':
# x = int(input())
D,T,S= map( int , input()... | Aasthaengg/IBMdataset | Python_codes/p02570/s735893885.py | s735893885.py | py | 403 | python | en | code | 0 | github-code | 90 |
40254257193 | import os
import pickle
from time import *
print("\n**********Welcome to BOOK STORE********\n")
print()
# Customer Details
cus_name = input("Enter Customer Name: ")
cus_id = input("Enter Customer Id: ")
# Receipt Details
bill_no = input("Enter bill no.: ")
print()
# - Discount
print("\n----------------------------... | Hackprince99/pythoncode | MY_SQL/BOOK_STORE.py | BOOK_STORE.py | py | 7,279 | python | en | code | 1 | github-code | 90 |
21675223589 | import pandas as pd
import csv
import numpy as np
import scipy.stats
from sklearn_pandas import DataFrameMapper
from sklearn.preprocessing import LabelEncoder
def csv_to_txt():
d = pd.read_csv('emails.csv')
df = pd.DataFrame(d)
for row in df['message']:
# Indexes of From, To, Subject, CC to parse... | riki95/social-networks-anonymization | csv to dataset/converter.py | converter.py | py | 2,098 | python | en | code | 5 | github-code | 90 |
37257567607 | def parseInput(fileName):
numbers = []
with open(fileName) as f:
for line in f:
num = int(line.replace("\n", ""))
numbers.append(num)
return numbers
def part1(fileName):
nums = parseInput(fileName)
index = 25
prev25List = nums[:index]
prev25 = set(prev25List... | jessicamerritt/AoC2020 | day9.py | day9.py | py | 1,503 | python | en | code | 0 | github-code | 90 |
71694809577 | #!/usr/bin/python
import sys
import getopt
import os
import requests
import os
def test_ms2lda_motifdb():
server_url = 'https://ms2lda.org/motifdb/'
print('Grabbing the latest Motifs from MS2LDA')
motifset_dict = requests.get(server_url + 'list_motifsets/').json()
db_list = []
db_list.append(2... | CCMS-UCSD/CCMS-Integration-Tests | external_api_tests/test.py | test.py | py | 832 | python | en | code | 1 | github-code | 90 |
40754704950 | #!/usr/bin/env python3
import logging
import sys
import os
from argparse import ArgumentParser, SUPPRESS
from pathlib import Path
from time import perf_counter
import cv2
import numpy as np
from openvino.inference_engine import IECore
#sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python'))
sys.path... | visiont3lab/openvino | ws/sample-app/blade.py | blade.py | py | 7,760 | python | en | code | 1 | github-code | 90 |
13643523658 | """Convert Dirt Patch CSV into a python list."""
import csv
import re
with open("doors.csv", newline="") as csvfile:
patch_data = csv.reader(csvfile, delimiter=",", quotechar="|")
door_data_json = []
for idx, row in enumerate(patch_data):
if idx > 0:
door_data_json.append(
... | 2dos/DK64-Randomizer | tools/importers/tns_wrinkly_doors.py | tns_wrinkly_doors.py | py | 3,198 | python | en | code | 44 | github-code | 90 |
1393634949 | """
URL configuration for mercury3 project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/dev/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='hom... | jacobvalenta/mercury3 | mercury3/urls.py | urls.py | py | 1,739 | python | en | code | 0 | github-code | 90 |
10815322292 | from caravel_cocotb.caravel_interfaces import * # import python APIs
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles, with_timeout
import sys
sys.path.append("../../../rgb_mixer")
from encoder import Encoder
clocks_per_phase = 10
async def run_encoder_tes... | mattvenn/caravel_user_project_mpw9e | verilog/dv/cocotb/rgb_mixer/rgb_mixer.py | rgb_mixer.py | py | 2,680 | python | en | code | 0 | github-code | 90 |
30102530904 | def get_int_input():
while True:
try:
s = input()
return int(s)
except ValueError:
print("Input value is not integer. Please try again ...")
def check_day(num):
if 6 <= num <= 7:
print("Yes, it's weekend")
elif 0 < num < 6:
print("No, it'... | DmitryFedoroff/python | geekbrains/weekend-or-not/program.py | program.py | py | 470 | python | en | code | 1 | github-code | 90 |
23933222883 | """Call to the plebdisc functions.
What are "xp" and "yp" ?
The similarity matrix is rotated by 45 degrees. To visualise it, take the DTW
matrix between 2 words. The "xp" axis is along the DTW path and "yp" is
orthogonal to "xp". The values of "yp" are also shifted so that they are
always positive.
What are Dot, DotX... | Rachine/ZRTools | plebdisc_interface/plebdisc.py | plebdisc.py | py | 4,333 | python | en | code | null | github-code | 90 |
18502016199 | #!/usr/bin/env python
# coding: utf-8
# In[6]:
import numpy as np
# In[33]:
H,W = map(int, input().split())
a = []
for _ in range(H):
row = input()
a.append([1 if row[i] == "#" else 0 for i in range(W)])
# In[36]:
a_array = np.array(a)
col_flag = True
row_flag = True
# print(a_array)
while col_flag:
... | Aasthaengg/IBMdataset | Python_codes/p03273/s497811455.py | s497811455.py | py | 869 | python | en | code | 0 | github-code | 90 |
40116348968 | import boto3
#
# LISTAR ARQUIVOS SALVOS NO AWS S3
#
#login conta aws amazon
Diretorio_S3='NOME DO SEU DIRETÓRIO AQUI'
aws_access_key_id2='DIGITE AWS_ACCESS KEY AQUI'
aws_secret_access_key2= 'DIGITE AWS_SECRET_ACCESS KEY AQUI'
# region_name2='DIGITE AQUI A REGIÃO DO SEU DIRETÓRIO_S3'
region_name2='us-east-1'
s3_reso... | mcaires2/Textratc_with_aws_pdf_multiple_pages_tables_text | listar_arquivos_s3.py | listar_arquivos_s3.py | py | 633 | python | pt | code | 2 | github-code | 90 |
4122890114 | import numpy as np
from typing import List, Tuple
from inverse_reinforcement_learning.feature_expectations_extractor import FeatureExpectationExtractor
class RewardCalculator:
def __init__(self, reward_shape:tuple, states:List[Tuple]):
self.states = states
self.reward_shape = reward_shape
d... | bartekwojcik/DataPreprocessingMasters | src/inverse_reinforcement_learning/reward_calculator.py | reward_calculator.py | py | 977 | python | en | code | 0 | github-code | 90 |
4169521194 | from tkinter import *
from tkinter import ttk
from tkinter.simpledialog import askstring
import os
import json
# Ctrl-f function in MainWindow opens a SearchWindow
# Toplevel specifies that this is a subclass of another tkinter window
class SearchWindow(Toplevel):
def __init__(self, parent, attributes=None)... | RealityAnchor/ries-gpt-ui | search_window.py | search_window.py | py | 5,853 | python | en | code | 11 | github-code | 90 |
18444662709 | N, M = map(int, input().split())
A = list(map(int, input().split()))
tab = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
A_cmp = {}
for Ai in sorted(A):
A_cmp[tab[Ai]] = Ai
A = list(A_cmp.values())
A.sort(key=lambda x: -x)
memo = [None] * (N + 1)
memo[0] = 0
import sys
sys.setrecursionlimit(100000)
def dp(X):
if X < 0: re... | Aasthaengg/IBMdataset | Python_codes/p03128/s410398153.py | s410398153.py | py | 756 | python | en | code | 0 | github-code | 90 |
73035067498 | import re
from datetime import datetime
import logging
from app import augur
def verify_previous_login_credentials(bearer_token, refresh_token, expiration):
"""Attemps to verify whether
preexisting login credentials are still valid.
Args:
bearer_token (str): Preexisting bearer token
refre... | oss-aspen/8Knot | 8Knot/pages/index/login_help.py | login_help.py | py | 5,865 | python | en | code | 33 | github-code | 90 |
15801845225 | # -*- coding: utf-8 -*-
"""
1529. Bulb Switcher IV
There is a room with n bulbs, numbered from 0 to n-1, arranged in a row from left to right.
Initially all the bulbs are turned off.
Your task is to obtain the configuration represented by target where target[i] is '1' if the i-th bulb
is turned on and is '0' if it is... | tjyiiuan/LeetCode | solutions/python3/problem1529.py | problem1529.py | py | 1,007 | python | en | code | 0 | github-code | 90 |
40271042947 | __author__ = "Cristian Orgaz Portero"
__copyright__ = "Copyright (C) 2023 Cristian Orgaz Portero"
__license__ = "Public Domain"
__version__ = "1.0"
# Usamos las librerias panda, requests y numpy
import pandas as pd
import requests
from datetime import datetime
import os
# leemos el fichero y lo guardamos en la variable... | corgazp/tfm-uoc | scripts/getBioactivities.py | getBioactivities.py | py | 3,214 | python | en | code | 0 | github-code | 90 |
34401629724 | # Real-time Human Face Recognition - 1
# Capturing images from webcam and storing in human_faces folder
# Import Computer Vision package - cv2
import cv2
# Import Numerical Python package - numpy as np
import numpy as np
# Load human face cascade file using cv2.CascadeClassifier built-in function
# cv2.CascadeClassi... | SunilKumar-ugra/opencv_tutorials | Codes/Image_processing_projects/Project_5-Real_time_Human_Face_Recognition/5.5-Human_Face_Recognition-1.py | 5.5-Human_Face_Recognition-1.py | py | 3,438 | python | en | code | 1 | github-code | 90 |
27678528866 | #!/usr/bin/python
from urllib import request as urllib2
from bs4 import BeautifulSoup
import os.path
class txwqSgfParser:
def __init__(self):
self.currentPage = 1
self.pageLimited = None
def getCatalogUrl(self):
url = "http://weiqi.qq.com/qipu/index/p/%d.html" %(se... | sanfanling/foxGo | websgf/txwqSgfParser.py | txwqSgfParser.py | py | 1,589 | python | en | code | 1 | github-code | 90 |
25287035324 | from flask import Flask, request, jsonify
import aiml
import os
from datetime import datetime
kernel = aiml.Kernel()
def chatbot():
# Create the kernel and learn AIML files
kernel.learn("std-startup.xml")
kernel.respond("load aiml b")
time = datetime.now()
timestamp = time.strftime("%d/%m/%Y %H:... | nitin-sontineni/MyChatbot | AIML/app.py | app.py | py | 2,512 | python | en | code | 0 | github-code | 90 |
22207943118 | class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows <= 1 or numRows >= len(s):
return s
arr = [''] * numRows
line, step = 0, -1
for c in s:
arr[line] += c... | Eurus-Holmes/LCED | ZigZag Conversion.py | ZigZag Conversion.py | py | 449 | python | en | code | 11 | github-code | 90 |
6959037901 | import keras
import numpy as np
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.text import text_to_word_sequence
import random
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers impor... | chengstark/pyClarion_components | Keras_shape.py | Keras_shape.py | py | 4,015 | python | en | code | 0 | github-code | 90 |
4157007316 | import numpy as np
import os
import torch
from PIL import Image
from torchvision import transforms
from config import DAVIS_validation_root
from misc import check_mkdir, AvgMeter, cal_precision_recall_mae, cal_fmeasure
from networks.PDBM_single import PDBM_single
torch.cuda.set_device(0)
ckpt_path = './models'
exp_... | eraserNut/Video_segmentation_pytorch | infer_single.py | infer_single.py | py | 2,918 | python | en | code | 1 | github-code | 90 |
18440334499 | from itertools import product
n,a,b,c = map(int,input().split())
l = [int(input()) for _ in range(n)]
tar = [a,b,c]
ans = float("inf")
for p in product(range(4),repeat=n):
mp = 0
length = [0]*3
for i,j in enumerate(p):
if j == 3: continue
if length[j] > 0: mp += 10
length[j] += l[i]... | Aasthaengg/IBMdataset | Python_codes/p03111/s050813751.py | s050813751.py | py | 460 | python | en | code | 0 | github-code | 90 |
4965626692 | #!/usr/bin/env python
from http.server import test as run_dev_server, SimpleHTTPRequestHandler
import os
class SuffixHandler(SimpleHTTPRequestHandler):
def do_GET(self):
path = self.translate_path(self.path)
if not os.path.exists(path):
self.path = f"{self.path.rstrip('/')}.html"
... | bradbeattie/iscanadafair.ca | dev_server.py | dev_server.py | py | 383 | python | en | code | 0 | github-code | 90 |
43223223642 | from os import listdir
from os.path import isdir, isfile
from json import dump as compile_json
import os.path
def es72(dirname: str, json_file: str) -> int:
"""Design a function es72(dirname, jsonfile) such that:
- it is recursive or uses recursive functions(s)/method(s),
- it receives as arguments a directory pat... | devExcale/acsai-homework-y1 | ex72/program.py | program.py | py | 1,856 | python | en | code | 1 | github-code | 90 |
4963453172 | from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand
from django.db import transaction
from federal_common import sources
from federal_common.sources import EN, FR
from federal_common.utils import fetch_url, url_tweak, get_cached_dict, get_cached_obj
from parliaments import models
from tqdm... | bradbeattie/api.iscanadafair.ca | parliaments/management/commands/augment_parties_lop_party.py | augment_parties_lop_party.py | py | 2,804 | python | en | code | 10 | github-code | 90 |
25250368089 | import os
from contextlib import closing
from datetime import datetime, date
import pytz
from dotenv import load_dotenv
import pendulum
import psycopg2
from psycopg2.extras import DictCursor
from tools.schedule_tools.utils import get_now
load_dotenv()
PG_DB_DATABASE = os.environ.get('PG_DB_DATABASE', default='sched... | SevenLines/Smart-schedule-IRNITU_ver2 | db/postgre_storage.py | postgre_storage.py | py | 10,032 | python | en | code | 0 | github-code | 90 |
19655808230 | # mastermind-bot - A mastermind bot for slack
# © 2015 João Victor Duarte Martins <jvdm@sdf.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
major = 0
minor = 1... | jvdm/mastermind-bot | macacoprego/mastermind_bot/version_info.py | version_info.py | py | 375 | python | en | code | 0 | github-code | 90 |
43749998271 | import re
import threading
import requests
from bs4 import BeautifulSoup
DOMAIN = "https://django-anuncios.solyd.com.br"
URL_AUTO = "https://django-anuncios.solyd.com.br/automoveis/"
LINKS = []
TELEFONES = []
def buscar(url):
try:
resposta = requests.get(url)
if resposta.status_code == 200:
... | Askback/Python-CrawlerTel | Crawler.py | Crawler.py | py | 2,771 | python | pt | code | 0 | github-code | 90 |
45712592839 | import io
import requests
import uuid
import time
import json
from PIL import Image
def NOCR(image):
api_url = 'https://h6hbsebz4c.apigw.ntruss.com/custom/v1/25926/fbd974e2f18872b0966c49dd21b13da2d84ff0d9a5410aa23b60497acc4e0977/general'
secret_key = 'ZXdTS3RRUFpOcmxYSHVab2NQdk5ybkxTZ3VRbnZHbGM='
buffer = io.Bytes... | NayounK1m/MediTest | Server/NOCR.py | NOCR.py | py | 1,062 | python | en | code | 0 | github-code | 90 |
17959838629 | def main():
N = int(input())
P = [int(_) for _ in input().split()]
i = 1
output = 0
while i <= N:
if i == P[i-1]:
output += 1
if i < N and i+1 == P[i]:
i += 2
continue
i += 1
print(output)
return
if __name__ == '__main... | Aasthaengg/IBMdataset | Python_codes/p03612/s765307355.py | s765307355.py | py | 336 | python | en | code | 0 | github-code | 90 |
41751024299 | import os
base_dir = '/home/mds/PointRCNN/data/KITTI/object/training_4'
path = os.path.join(base_dir, 'calib/')
for i in range(390):
os.rename(path + '%010d' % i + '.txt', path + '%06d' % i + '.txt') | DahunChoi/BPC_Project | PointRCNN/rename.py | rename.py | py | 208 | python | en | code | 0 | github-code | 90 |
3668441446 | #import socket module
from socket import *
import sys # In order to terminate the program
serverSocket = socket(AF_INET, SOCK_STREAM)
#Prepare a sever socket
serverPort = 12000
serverSocket.bind(('192.168.0.121', serverPort))
serverSocket.listen(1)
while True:
#Establish the connection
print('Ready to serve.... | PocketSpiders/Networking | lab4/webServer.py | webServer.py | py | 1,281 | python | en | code | 0 | github-code | 90 |
36533731642 | # -*- coding: utf-8 -*-
# Imported from flask-rest-jsonapi
# https://github.com/miLibris/flask-rest-jsonapi
from urllib.parse import urlencode
from copy import deepcopy
DEFAULT_PAGE_SIZE = 20
def pagination_links(object_count, query, base_url):
"""Add pagination links to result
Parameters
----------
... | force-h2020/tornado-rest-jsonapi | tornado_rest_jsonapi/pagination.py | pagination.py | py | 1,987 | python | en | code | 0 | github-code | 90 |
16138426025 | class DoubleLinkedList():
def __init__(self, data):
self.next = None
self.prev = None
self.data = data
def insert_middle(self, prev_node, data):
if prev_node is None:
return
new_node = DoubleLinkedList(data)
new_node.next = prev_node.next
prev_... | FizzyViking/LinkedList-Visualising-with-Manim | DoubleLinkedList.py | DoubleLinkedList.py | py | 455 | python | en | code | 0 | github-code | 90 |
16226843636 | """An unblock all script.
This will attempt to unblock all reads on all channels.
This should result in a read length histogram that has very short peaks (<1kb) as these are the smallest chunks that we can acquire.
If you are not seeing these peaks, the ``break_reads_after_seconds`` parameter in the MinKNOW configurati... | LooseLab/readfish | src/readfish/entry_points/unblock_all.py | unblock_all.py | py | 2,287 | python | en | code | 148 | github-code | 90 |
36470602795 | # Tells you the amount of free ram and free Disk
import subprocess
import re
cmd1 = "free -h"
cmd2 = "df -h"
def gcis(str1):
args = str1.split(" ")
out = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
process, err = out.communicate()
process = process.decode('utf-8')
return (re.sub(" +... | Cod3Bende4/Tools | Ram_Disk_Check.py | Ram_Disk_Check.py | py | 948 | python | en | code | 0 | github-code | 90 |
18380826319 | def main():
n = int(input())
ABs = [list(map(int, input().split())) for _ in range(n)]
ABs = sorted(ABs, key=lambda x: x[1])
Count = 0
for AB in ABs:
Count += AB[0]
if Count > AB[1]:
print("No")
exit()
print("Yes")
if __name__ == "__main__":
main()
| Aasthaengg/IBMdataset | Python_codes/p02996/s312105736.py | s312105736.py | py | 319 | python | en | code | 0 | github-code | 90 |
31819192071 | from django.contrib.auth import login
from django.contrib.messages.api import success
from django.http.response import HttpResponse
from django.shortcuts import redirect, render
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from .models import Car, Ca... | LL-Etiane/tms | cars/views.py | views.py | py | 9,446 | python | en | code | 2 | github-code | 90 |
37516488176 | import sys, math
CNTRL = "~~~~~~~"
debug = False
def main(args):
with open(args[1],'r') as code:
register, program = sectioner([line for line in code]);
names,init_state = prepare(register)
tokens = tokenize(program)
result = Qal(init_state,tokens,names)
if debug:
... | nickhayeck/qal | main.py | main.py | py | 6,130 | python | en | code | 0 | github-code | 90 |
23905201229 | """
Builds runs table for snakemake
"""
import numpy as np
import os
import pandas as pd
def build_runs():
seeds = 20
dataset = 'mnist'
prefix = '/home/alex/mixture-gan/experiments/auto3/'
mixtures = list(np.geomspace(0.01, 0.5, 10))
mixtures.append(0.4)
data = []
for seed in range(seeds):... | atong01/mixture-gan | experiments/make_runs.py | make_runs.py | py | 714 | python | en | code | 3 | github-code | 90 |
32824514927 | #coding: utf-8
import subprocess, sys, os
import threading, time, datetime
import logging, argparse
import shutil
import zipfile
logging.basicConfig(level = logging.INFO, format='%(asctime)s - %(levelname)s [%(filename)s:%(lineno)d]: %(message)s')
def execShellDaemon(cmd):
'''
async
'''
return subpr... | CrackerCat/apuller | apuller.py | apuller.py | py | 13,155 | python | en | code | 0 | github-code | 90 |
18973801693 | from zxing import *
zxing_location = ".."
testimage = "sample.png"
def test_barcode_parser():
text = """
file:/home/oostendo/Pictures/datamatrix/4-contrastcrop.bmp (format: DATA_MATRIX, type: TEXT):
Raw result:
36MVENBAEEAS04403EB0284ZB
Parsed result:
36MVENBAEEAS04403EB0284ZB
Also, there were 4 result points.
... | oostendo/python-zxing | zxing/tests.py | tests.py | py | 921 | python | en | code | 264 | github-code | 90 |
9861921727 | #! /usr/bin/python
"""
Colection of various functions
=========================================================================
=========================================================================
get_data: reading data
=========================================================================
====================... | janbolmer/molec | bin/spec_functions.py | spec_functions.py | py | 37,367 | python | en | code | 2 | github-code | 90 |
3001959048 | # coding: utf-8
import boto3
import email
import json
import logging
import os
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
def handler(event, context):
logger.info("Collecting event record data...")
record = event["Records"][0]
try:
logger.info("Looking for SES event...")
bu... | sevenmachines/cloudformation-seslambdaforwarder | ses_lambda_forwarder.py | ses_lambda_forwarder.py | py | 3,038 | python | en | code | 0 | github-code | 90 |
18113052959 | d = set()
n = int(input())
for i in range(n):
raw=input().split()
if raw[0] == 'insert':
d.add(raw[1])
else:
if raw[1] in d:
print('yes')
else:
print('no')
| Aasthaengg/IBMdataset | Python_codes/p02269/s536281787.py | s536281787.py | py | 217 | python | en | code | 0 | github-code | 90 |
13224862891 | import pytest
from safeds.data.tabular.containers import Table
from safeds.data.tabular.transformation import OneHotEncoder
from safeds.exceptions import TransformerNotFittedError
@pytest.mark.parametrize(
("table_to_fit", "column_names", "table_to_transform"),
[
(
Table(
{... | Safe-DS/Library | tests/safeds/data/tabular/containers/_table/test_inverse_transform_table.py | test_inverse_transform_table.py | py | 3,490 | python | en | code | 11 | github-code | 90 |
8265874868 | from django import forms
from profileapp.models import ProfileUser, Post, Comment
from datetime import date
#forms
class UserProfileRegisterForm(forms.ModelForm):
#Adding class attributes and placeholders to model fields
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... | NemoKam/DjangoSimpleForum | forum/profileapp/forms.py | forms.py | py | 3,592 | python | en | code | 0 | github-code | 90 |
17946227229 | import bisect
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))
import collections
d_cnt = collections.Counter(d_li)
t_cnt = collections.Counter(t_li)
#print(d_cnt,t_cnt)
for t in t_cnt.items():
#print(d_cnt,d_cnt[t[0]],t[1])
if d_cnt[t[0]] < t[1]:
... | Aasthaengg/IBMdataset | Python_codes/p03578/s898608996.py | s898608996.py | py | 366 | python | en | code | 0 | github-code | 90 |
33764398235 | import pygame
import telebot
import sys
import os
from dotenv import load_dotenv, find_dotenv
from markup import kb
load_dotenv(find_dotenv())
bot = telebot.TeleBot(os.getenv('token'))
pygame.init()
fps = 40
pygame.display.set_caption('БАТЛ КВАДРАТОВ')
screen = pygame.display.set_mode((600, 600))
clock = pygame.tim... | AlesyaSeliazniova30032012/pygame_and_bot_result | main.py | main.py | py | 2,941 | python | en | code | 0 | github-code | 90 |
26018433027 | # -*- coding: utf-8 -*-
import pytest
from fake_fs import make_fake_fstools
from teuthology.describe_tests import (tree_with_info, extract_info,
get_combinations)
from teuthology.exceptions import ParseError
realistic_fs = {
'basic': {
'%': None,
'base': {
... | qiankunzheng/teuthology | teuthology/test/test_describe_tests.py | test_describe_tests.py | py | 9,142 | python | en | code | null | github-code | 90 |
26689060711 | """Flask app for Cupcakes"""
from flask import Flask, request, jsonify, render_template
app = Flask(__name__)
from models import db, connect_db, Cupcake
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql:///cupcakes'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = "105-919-298"
conn... | annaspencer/flask-cupcakes | app.py | app.py | py | 2,018 | python | en | code | 0 | github-code | 90 |
72089976297 | from os.path import dirname, join
from setuptools import find_packages, setup
from profiles import get_version
def fread(fname):
with open(join(dirname(__file__), fname), 'r') as f:
return f.read()
setup(
name = "django-extensible-profiles",
packages = find_packages(),
include_package_data=Tr... | incuna/django-extensible-profiles | setup.py | setup.py | py | 563 | python | en | code | 6 | github-code | 90 |
5763039689 | from PyQt5.QtWidgets import QMenu, QInputDialog, QAction
from PyQt5.QtGui import QCursor
import matplotlib
import classes
class PanelChart:
def redraw_chart(self):
'''redraw chart on data derived from database
'''
self.ui.widget.canvas.ax.clear() # clean widet
selected, selrows = ... | PawelKra/LDB_MEASURE | panel_chart.py | panel_chart.py | py | 7,155 | python | en | code | 0 | github-code | 90 |
18891119315 | # Contains base classes for model components with maximum of two child nodes - Double Child
import abc
import statistics
import mvc_base.model as model
from core.constants import left, right, white, black, grey_node, hint_frame, circle_node_text_modifier
class DCTree(model.Tree, abc.ABC):
"""Contains methods sim... | MarcinKozak005/Educational-tree-GUI | mvc_base/model_double_child.py | model_double_child.py | py | 20,812 | python | en | code | 0 | github-code | 90 |
19116920452 | import sqlite3
from datetime import date
from typing import Any
import pandas
import yfinance as yf
import config
def updatePrice(max_price):
connection = sqlite3.connect(config.DB_FILE)
connection.row_factory = sqlite3.Row
cursor = connection.cursor()
cursor.execute("""SELECT id,symbol, name from s... | adityakdevin/trading | latestfutureprices.py | latestfutureprices.py | py | 1,382 | python | en | code | 0 | github-code | 90 |
25253964622 | import sys
from collections import deque
N = int(sys.stdin.readline())
result = [i for i in range(10)]
def dfs():
q = deque()
for i in range(1, 10):
q.append((i, str(i)))
while q:
if len(result) == N+1:
break
x, y = q.popleft()
if x != 0:
for i in ra... | choinara0/Algorithm | Baekjoon/BackTracking/1038번 - 감소하는 수/1038번 - 감소하는 수.py | 1038번 - 감소하는 수.py | py | 516 | python | en | code | 0 | github-code | 90 |
25023084528 | #!/usr/bin/env python3
import sys
from sodacomm.tools import testwrapper
def longest_sub_seq(arr, k):
v2i = {0:-1}
s = 0
_len = 0
for i, v in enumerate(arr):
s += v
v2i.setdefault(s, i)
j = v2i.get(s - k, i)
_len = max(_len, i-j)
return _len
def longest_sub_pn(arr)... | missingjs/soda | works/zcy2/c8/q11.py | q11.py | py | 991 | python | en | code | 0 | github-code | 90 |
34253181925 | import vim
import re
import subprocess
from functools import wraps
def vim_func(vim_fname_or_func=None, conv=None):
'''Expose a python function to vim, optionally overriding its name.'''
def wrap_func(func, vim_fname, conv):
fname = func.func_name
vim_fname = vim_fname or fname
arg_n... | derekelkins/agda-vim | agda.py | agda.py | py | 17,777 | python | en | code | 125 | github-code | 90 |
26872871095 | import pickle
import numpy as np
class CellObj:
''' An object which contains object coordinates,bounded image and mask arrays, center coordinates etc'''
def __init__(self,index, box_coord, image, mask, contour, image_hash):
self.original_image_hash = image_hash
self.box_coord = box_coord
... | Dmitry-Khochanskiy/Cell_extractor_analyser | modules/cellobj.py | cellobj.py | py | 1,678 | python | en | code | 0 | github-code | 90 |
42059357553 | from rest_framework import permissions
class IsUserOrReadOnly(permissions.BasePermission):
"""
Object-level permission to only allow owners of an object to edit it.
"""
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True... | agconti/cookiecutter-django-rest | {{cookiecutter.github_repository_name}}/{{cookiecutter.app_name}}/users/permissions.py | permissions.py | py | 357 | python | en | code | 1,446 | github-code | 90 |
22708525138 | import utime
from Maix import GPIO
from board import board_info
from fpioa_manager import fm
fm.register(18,fm.fpioa.GPIO0)
led_b = GPIO(GPIO.GPIO0,GPIO.OUT)
led_b.value(1)
import utime
from Maix import GPIO
from fpioa_manager import fm
import sensor, image, lcd, time
import KPU as kpu
import utime
from Maix imp... | 18281765528/picture_handle | mask_detect.py | mask_detect.py | py | 2,709 | python | en | code | 0 | github-code | 90 |
21307150808 | from Crypto.Util.number import inverse
E = {'a': 497, 'b': 1768, 'p': 9739, 'G': (1804, 5368)}
def pt_add(p, q, E):
zero = (0, 0)
if p == zero:
return q
elif q == zero:
return p
else:
x1, y1 = p
x2, y2 = q
if x1 == x2 and y1 == -y2:
return zero
... | samoersnaes/cryptohack | ecc/ecc.py | ecc.py | py | 772 | python | en | code | 1 | github-code | 90 |
14419118062 | from unittest import TestCase
import mock
from trading_system import consts
from trading_system.api import beans
from trading_system.api.bitfinex.clients import BitfinexClient
from trading_system.api.bitfinex.markets import BitfinexMarketApi
class BitfinexMarketApiTestCase(TestCase):
market_api = NotImplemented... | vinicius-ronconi/bitcoin-trading-system | trading_system/api/bitfinex/tests/markets_test.py | markets_test.py | py | 3,161 | python | en | code | 2 | github-code | 90 |
43659218918 | import shortuuid
import shutil
import time
import os
import json
from csv import reader
import openreview
from openreview import OpenReviewException
from enum import Enum
from threading import Lock
from .utils import JobConfig, APIRequest, JobDescription, JobStatus, SUPERUSER_IDS, RedisDatabase
user_index_file_lock =... | openreview/openreview-expertise | expertise/service/expertise.py | expertise.py | py | 16,709 | python | en | code | 25 | github-code | 90 |
75033915816 | import math
import numpy as np
class PlayersRoleSet(object):
# constants
segment_values = {'x':{'start':3, 'end':102}, 'y':{'start':0, 'end':68}} # segment start and end: used in scaling
# default vars
role_segment_coords = {'LB':[-1, 40, -1, 19], # Left Back
'C... | anaramirli/predict-soccer-ball-location | src/classes/PlayersRoleSet.py | PlayersRoleSet.py | py | 7,006 | python | en | code | 19 | github-code | 90 |
20051574404 | # -*- coding: utf-8 -*-
import os
if __name__ == "__main__":
f = open("guess.txt", "r")
lines = f.readlines()
f.close()
print("{")
print("\t\"guess\": [")
is_first_conversion = True
for line in lines:
line=line.strip('\n')
conversation = line.split('谜底:');
history ... | Qiware/aibot | corpus/data/chinese/guess.py | guess.py | py | 1,140 | python | en | code | 46 | github-code | 90 |
41982883547 | from pysnmp.hlapi import *
import socket
import sys
import datetime
from time import sleep
crestron_ip = '192.168.0.5'
crestron_port = 505
# Create a UDP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = (crestron_ip, crestron_port)
while 1:
current_time1 = datetime.datetime.now()
e... | 0009281/Mikrotik-to-Crestron-statistics | mikrotik-crestron-stat.py | mikrotik-crestron-stat.py | py | 2,011 | python | en | code | 1 | github-code | 90 |
5124616456 | from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='Home'),
path('conocenos/', views.conocenos, name='Conocenos'),
path('servicios', views.servicios, name="Servicios"),
path('casos_de_exito/', views.casosDeExito, name='Casos_de_Exito'),
path('contactanos/', v... | sparisca04/pixales | main/urls.py | urls.py | py | 360 | python | en | code | 0 | github-code | 90 |
43040742187 | '''
(6) On a given day (average basis), a student is observed to spend
33% of time in studying,
30% in sleeping,
18% in playing,
5% for hobby activities,
and rest for spending with friends and family.
Plot a pie chart showing his daily activities.
'''
import matplotlib.pyplot as plt
plt.rcdefaults()
def Generat... | KausikN/BTech_BigData_Files | ProblemSet_1/6.py | 6.py | py | 690 | python | en | code | 1 | github-code | 90 |
8954840279 | ####################
# bitmap Analysis ##
####################
import binascii as bin
import sys
FILE_NAME = './character/1.bmp'
FILE_NAME = sys.argv[1] if len(sys.argv) == 2 else FILE_NAME
print(FILE_NAME)
# Start data-bit address
bfOffBitsStart = 10 #byte
bfOffBits = 4
# Image(width, height)
bfWidthStart = 18
bfH... | b-konishi/BitmapAnalyzer | binary.py | binary.py | py | 1,885 | python | en | code | 0 | github-code | 90 |
73405727655 | # -*- coding: utf-8 -*-
"""
Contributors:
- Louis Rémus
"""
import os
import sys
import torch
from torchvision import datasets, transforms
import numpy as np
# noinspection PyUnresolvedReferences
from mnist_basenet_torch import BaseNet
import matplotlib.pyplot as plt
# Add src path
sys.path.append(os.path.dirname... | louis-r/adversarial_models | mnist/fgsm_mnist.py | fgsm_mnist.py | py | 1,595 | python | en | code | 0 | github-code | 90 |
15235998347 | class Gizmo(object):
def __init__(self):
print('Gizmo id : %d' % id(self))
if __name__ == "__main__":
x = Gizmo()
#y = Gizmo() * 10
#튜플의 상대적 불변성 테스트
t1 = (1, 2, [30, 40])
t2 = (1, 2, [30, 40])
print(t1 == t2)
print(id(t1))
t1[-1].append(50)
print(id(t1))
| ElvinKim/python_master | fluent_python/object_reference/variable_example.py | variable_example.py | py | 336 | python | ko | code | 2 | github-code | 90 |
34553700804 | from topfarm.constraint_components.capacity import CapacityConstraint
import numpy as np
import topfarm
from topfarm.tests.test_files import xy3tb
from topfarm._topfarm import TopFarmProblem
from topfarm.easy_drivers import EasySimpleGADriver
def test_capacity_as_penalty():
tf = xy3tb.get_tf(design_vars={topfarm.... | DTUWindEnergy/TopFarm2 | topfarm/tests/test_constraint/test_capacityComp.py | test_capacityComp.py | py | 1,744 | python | en | code | 8 | github-code | 90 |
3163676467 | from PyQt4.QtCore import QString
from PyQt4.QtCore import QTranslator
from PyQt4.QtCore import QUrl
from PyQt4.QtCore import SIGNAL
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QDesktopServices
from PyQt4.QtGui import QGridLayout
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QIcon
from PyQt4.QtGui ... | Freeseer/freeseer | src/freeseer/frontend/qtcommon/AboutWidget.py | AboutWidget.py | py | 6,097 | python | en | code | 214 | github-code | 90 |
36707172082 | from setuptools import setup, find_packages
import os
version = '0.2.1'
setup(name='socialapps.dmessages',
version=version,
description="In-site direct messaging system",
long_description=open("README.txt").read() + "\n" +
open(os.path.join("docs", "HISTORY.txt")).read(),
... | iservicesmx/socialapps.dmessages | setup.py | setup.py | py | 1,016 | python | en | code | 1 | github-code | 90 |
20432177280 | '''
문제 : 부족한 금액 계산하기
날짜 : 21.08.26
'''
def solution(price, money, count):
answer = -1
temp = 0
for i in range(count):
temp += price*(i+1)
if(money >= temp):
answer = 0
else:
answer = temp - money
return answer | NyeongB/python_2 | coding/coding_02.py | coding_02.py | py | 283 | python | en | code | 0 | github-code | 90 |
20198749683 | # Afk plugin from TamilUserBot ported from uniborg
import asyncio
import time
import html
from datetime import datetime
from telethon import events
from telethon.tl import functions, types
from userbot import ALIVE_NAME, CMD_HELP
from userbot.utils import admin_cmd
from userbot import BOTLOG, BOTLOG_CHATID
from userbo... | TamilBots/TamilUserBot | userbot/plugins/afk.py | afk.py | py | 10,467 | python | en | code | 13 | github-code | 90 |
17969850809 | n=int(input())
c=list(map(int, input().split()))
a = 0
a2 = 0
a4 = 0
for i in c:
if i%2 != 0:
a += 1
if i%2 == 0 and i%4 != 0:
a2 += 1
if i%4 == 0:
a4 += 1
if a == 0 :
print('Yes')
if a > 0 and a2 == 0:
if a <= a4 +1 :
print('Yes')
else:
print('No')
if a... | Aasthaengg/IBMdataset | Python_codes/p03637/s156958035.py | s156958035.py | py | 404 | python | en | code | 0 | github-code | 90 |
10391730602 | import os
import sys
import pickle
import datetime
import copy
from itertools import groupby
from operator import itemgetter
import glob
import numpy as np
import pandas as pd
import pyproj
import xarray as xr
from affine import Affine
import rasterio as rio
_PATH = os.path.dirname(os.path.realpath(__file__))
print('... | nicksteiner/gmuds | gmuds.py | gmuds.py | py | 18,128 | python | en | code | 1 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.