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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
22489010308 | def operation_to_reach(x1,y1,alpha1,x2,y2,alpha2):#what to do ? same code as last year YESS less to do \o/ and this time we don't have to take into account the reverse gear manually that's done by the code.
if x1==x2 and y1==y2 :
gamma=alpha2-alpha1
if gamma>180:
gamma=gamma-360
... | Forcemay/Robot_2020 | object/Drop_brain.py | Drop_brain.py | py | 18,622 | python | en | code | 0 | github-code | 90 |
18477459189 | N = int(input())
A = [int(x) for x in input().split()]
mean_a = sum(A)/N
ans = 0
ans_dist = float('inf')
for ind,a in enumerate(A):
if(abs(mean_a-a)<ans_dist):
ans_dist = abs(mean_a-a)
ans = ind
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p03214/s044013969.py | s044013969.py | py | 226 | python | en | code | 0 | github-code | 90 |
71215357417 | # -*- coding: utf-8 -*-
import numpy as np
import time
import json
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import normalize
from collections import defaultdict
from multiprocessing import Pool
from sklearn.utils import shuffle
from functools import partial
np.seterr(all='ignore... | IngvarBjarki/master_thesis | Logistic Regression with Differential privacy/main.py | main.py | py | 7,698 | python | en | code | 1 | github-code | 90 |
37248470100 | import sys
part1 = 0
part2 = 0
f = open(sys.argv[1])
data = f.read().strip().split('\n')
def move(x, y, direction):
if direction == 'R':
x += 1
elif direction == 'L':
x -= 1
elif direction == 'U':
y += 1
elif direction == 'D':
y -= 1
return x, y
def move_toward(... | hmludwig/aoc2022 | src/day09.py | day09.py | py | 1,188 | python | en | code | 0 | github-code | 90 |
32984884735 | from mongoengine import *
from spaceone.core.model.mongo_model import MongoModel
class DataSourceRuleCondition(EmbeddedDocument):
key = StringField(required=True)
value = StringField(required=True)
operator = StringField(choices=('eq', 'contain', 'not', 'not_contain'))
class DataSourceRuleOptions(Embed... | cloudforet-io/cost-analysis | src/spaceone/cost_analysis/model/data_source_rule_model.py | data_source_rule_model.py | py | 1,836 | python | en | code | 8 | github-code | 90 |
35219510695 | """
This script loads data from Postgres SQL in AWS EC2
into a Pandas DataFrame. It then cleans the data
and applies feature engineering based on information
collected during exploratory data analysis.
This script outputs a CSV of cleaned data with feature
engineered columns.
"""
import pandas as pd
from sqlalchemy i... | ARauckhorst/Personal_Projects | Data Science Projects/Predicting SBA Loan Defaults/data_cleaning.py | data_cleaning.py | py | 5,549 | python | en | code | 0 | github-code | 90 |
18107258699 | # coding: utf-8
# Here your code !
n=int(input())
cards=input().split()
def bubble_sort(cards_b,n):
for i in range(n):
for j in range(-1,-n,-1):
a=int(cards_b[j][1])
b=int(cards_b[j-1][1])
if a<b:
cards_b[j],cards_b[j-1]=cards_b[j-1],cards_b[j]
return... | Aasthaengg/IBMdataset | Python_codes/p02261/s324604112.py | s324604112.py | py | 807 | python | en | code | 0 | github-code | 90 |
18387494829 | N = int(input())
A = sorted(list(map(int,input().split())))
ans_list = []
p = []
n = []
# 最大にプラス、最小にマイナスを割り当てる
p.append(A[-1])
n.append(A[0])
# 正ならプラスを負ならマイナスを割り当てる
for a in A[1:-1]:
if a >= 0:
p.append(a)
elif a < 0:
n.append(a)
# プラスが1つになるまで消す
res = n[0]
for ep in p[1:]:
ans_list.appen... | Aasthaengg/IBMdataset | Python_codes/p03007/s564529015.py | s564529015.py | py | 672 | python | ja | code | 0 | github-code | 90 |
39722083733 | from flask import *
from flask_restful import Resource, Api
import json
app = Flask(__name__)
api = Api(app)
students = [
{
'name': 'Amal Mathews',
'ID': '201AEM021',
'course': 1,
'group no': 1
},
{
'name': 'Sadi Kamla',
'ID': '210ADB101',
'course': 3... | Mathews-Antu/RAE553-W12 | app.py | app.py | py | 1,674 | python | en | code | 0 | github-code | 90 |
18179396273 | #!/usr/bin/env python3
"""Flask with babel"""
from flask_babel import Babel
from flask import Flask, g, render_template, request
users = {
1: {"name": "Balou", "locale": "fr", "timezone": "Europe/Paris"},
2: {"name": "Beyonce", "locale": "en", "timezone": "US/Central"},
3: {"name": "Spock", "locale": "kg... | n1klaus/alx-backend | 0x02-i18n/5-app.py | 5-app.py | py | 1,605 | python | en | code | 0 | github-code | 90 |
31283177132 | import time
from datetime import datetime
from openerp.report import report_sxw
from openerp import pooler
class course_search(report_sxw.rml_parse):
def __init__(self, cr, uid, ids, context):
super(course_search,self).__init__(cr, uid, ids, context=context)
self.localcontext.update({
'time':time,
... | karim-omran/openerp-addons | hr_training/report/course_search.py | course_search.py | py | 1,125 | python | en | code | 0 | github-code | 90 |
18043096819 | n = int(input())
x = 0
ans = []
for i in range(1,10000000):
x += i
ans.append(i)
if x >= n:
break
if x != n:
ans.remove(x-n)
for i in ans:
print(i) | Aasthaengg/IBMdataset | Python_codes/p03910/s928028897.py | s928028897.py | py | 180 | python | en | code | 0 | github-code | 90 |
27202995898 | # Author: Nicholas Mosca
# ejection fraction vs serum creatine
from data_editing import *
import matplotlib.pyplot as plt
# scatter plot
# plt.scatter(death_sc, death_ef, marker='^',label = 'dead',color = 'blue')
# plt.scatter(living_sc, living_ef, marker='o', label = 'survived',color = 'orange')
# plt.plot([dea... | njmosca/Machine-Learning | ef_vs_sc.py | ef_vs_sc.py | py | 874 | python | en | code | 0 | github-code | 90 |
16213767702 | from collections import defaultdict
def walk(current, visited, drill, history):
if current == 'end':
return 1
neighbors = (network[current] - visited) if not drill else network[current]
neighbors -= {'start'}
if not neighbors:
return 0
paths = 0
for n in neighbors:
... | carrdelling/AdventOfCode2021 | day12/gold.py | gold.py | py | 999 | python | en | code | 0 | github-code | 90 |
10664811490 | import imp
import os
import string
import unidecode
import math
from googletrans import Translator
#recupera dados de uma planilha
def recuperaDados(arquivo):
with open(arquivo, 'r', encoding='utf8') as f:
reader = csv.reader(f, delimiter=';')
linha = 0
tweet = []
urls = ["transla... | PeSantanna/5Periodo | Recuperação de Informação/Python/teste1.py | teste1.py | py | 1,274 | python | pt | code | 1 | github-code | 90 |
36056818929 | import random
import time
from common.bookApi import bookApi
from Bot.bookChaptersListBot import getBookChaptersList, getBookChaptersListByBookId
from Bot.bookChapterContentBot import getBookChapterContent, saveBookChapterContent
while True:
print('****************************')
print('欢迎进入笔趣阁图书txt下载系统!')
... | zhemowanglike/BookRobot | main.py | main.py | py | 3,962 | python | en | code | 0 | github-code | 90 |
28885009931 | # 线程,进程
# 进程是资源单位,每一个进程至少要有一个线程
# 线程是执行单位
# 多线程程序中必须要有main函数, 代表其主线程
# 启动每一个程序默认都会右主线程, 默认都是main函数所在的线程
# 设置多线程的两种方式:
import threading
from threading import Thread # 导入线程类
# 第一种开启线程的方式:
def fun():
threading.current_thread().name = 'fun'
for i in range(10000):
print(threading.current_thread())
... | WakingHours-GitHub/PythonCrawler | 第四章/4_1多线程.py | 4_1多线程.py | py | 1,275 | python | zh | code | 2 | github-code | 90 |
73821239655 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
#import keras an... | Adrian-Cantu/PhANNs | model_training/07_train.py | 07_train.py | py | 8,436 | python | en | code | 18 | github-code | 90 |
42169580238 | import tornado.web
import tornado.ioloop
import tornado.httpserver
from tornado.options import define, options
from url import handlers
import config
define("port", type=int, default=8000, help="run server port")
async def init_db_pool():
return await asyncpg.create_pool(database=config.sql_options[... | ngnetboy/tornado-basicproject | heima_project/server.py | server.py | py | 1,156 | python | en | code | 0 | github-code | 90 |
12142743216 | # -*- coding: utf-8 -*-
# © 2016 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, exceptions, _
import logging
try:
from asm.api import API as asm_api
except ImportError:
logger = logging.getLogger(__name__)
message = "Install ASM from Pypi... | Comunitea/CMNT_00056_2016_BT | project-addons/carrier_send_shipment_asm/models/carrier_api.py | carrier_api.py | py | 820 | python | en | code | 0 | github-code | 90 |
14030555550 | #numbers
# import math
# print(math.pi)
# print(math.sqrt(85))
# import random
# print(random.random())
# print(random.choice([1,2,3,4]))
# print('I\'m \"ok\".') # Use escape character \
# print('\\\t\\') # t = tab
# print('\\\n\\') # n = new line
# print('''line1
# ... line2
# ... line3''')
# ... to display multipl... | dchu07/MIS3640 | Review/session03.py | session03.py | py | 884 | python | en | code | 0 | github-code | 90 |
24290142921 | from collections import defaultdict
from flask_restful import Resource
from src.models.all_models import PhoneModel
class Phone(Resource):
@classmethod
def get(cls, phone) -> tuple:
phone_object = PhoneModel.find_by_phone(phone)
if phone_object:
return phone_object.json()
... | NaomiKriger/pdf_crawler | src/resources/phone.py | phone.py | py | 1,463 | python | en | code | 1 | github-code | 90 |
43659165118 | import csv, importlib, itertools, json, math, os, pickle, random
from collections import defaultdict
import numpy as np
import openreview
from expertise.utils.batcher import Batcher
from expertise.dataset import Dataset
from expertise.config import ModelConfig
import expertise.utils as utils
from expertise.utils.data... | openreview/openreview-expertise | expertise/preprocess/bert/setup_bert_lookup.py | setup_bert_lookup.py | py | 2,149 | python | en | code | 25 | github-code | 90 |
28693863837 | #!/usr/bin/env python3
from conllu import conllu_sentences
import glob
import os
from sklearn.metrics import cohen_kappa_score, confusion_matrix
dir1 = 'Evaluation/NewSentencesInessa'
dir2 = 'Evaluation/NewSentencesEleni'
pos1, pos2, rel1, rel2 = [], [], [], []
n, posmatch, labelmatch, headmatch, relmatch = 0, 0, 0,... | iscl-lrl/CappadocianUDs | Scripts/iaa.py | iaa.py | py | 2,564 | python | en | code | 0 | github-code | 90 |
41329302400 | from dagster import Definitions, OpExecutionContext, op, job, FilesystemIOManager
from dagster_shell import execute_shell_command
from assets.airbyte import airbyte_assets
from assets.dbt import dbt_assets, DBT_PROJECT_PATH, DBT_PROFILES
from dagster_dbt import DbtCliClientResource
resources = {
"dbt": DbtCliClien... | sekuel/dockerized-dagster-ingestion-as-code | data_pipeline/defs.py | defs.py | py | 1,273 | python | en | code | 0 | github-code | 90 |
19825926599 | from custom_exceptions.no_account_found import NoAccountFound
from data_access_layer.account_data_access.account_dao_interface import AccountDAOInterface
from entities.account_class_info import Account
from utils.create_connection import connection
class AccountDAOImp(AccountDAOInterface):
def create_account_reco... | jthapa25/first-practice-repo | data_access_layer/account_data_access/account_dao_imp.py | account_dao_imp.py | py | 3,162 | python | en | code | 0 | github-code | 90 |
32998415441 | import copy
from collections import defaultdict
from hashlib import sha1
import itertools
import json
import numpy as np
import random
from sklearn.model_selection import train_test_split
random.seed(102)
def class_distribution(utterances):
class_counts = {'Irrelevant': 0, 'More':0, 'Yes': 0, 'No': 0}
for utt... | IBM/UrcaNet | create_new_dataset.py | create_new_dataset.py | py | 7,659 | python | en | code | 2 | github-code | 90 |
18230154039 | x=input()
x_list=x.split()
N=int(x_list[0])
M=int(x_list[1])
y=input()
y_list=y.split()
sum1=0
count=0
for i in range(M):
s=int(y_list[count])
count+=1
sum1+=s
if N>=sum1:
print(N-sum1)
else:
print(-1) | Aasthaengg/IBMdataset | Python_codes/p02706/s539795869.py | s539795869.py | py | 215 | python | en | code | 0 | github-code | 90 |
42219183991 | # 본 문제는 python 의 빠른 기초 학습을 위해 설계된 문제로서 python 코드 제출을 기준으로 설명되어 있습니다.
# ------
# 영문 소문자 'q'가 입력될 때까지
# 입력한 문자를 계속 출력하는 프로그램을 작성해보자.
# 영문 소문자 'q'가 입력될 때까지 입력한 문자를 계속 출력한다.
#입력예시
# x
# b
# k
# d
# l
# q
# g
# a
# c
a=input().split()
for c in a :
print(c)
if c=='q' :
break
... | TaeYeon-kim-ai/python_basic | python20_02_test_q.py | python20_02_test_q.py | py | 521 | python | ko | code | 0 | github-code | 90 |
18568644809 | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,fl... | Aasthaengg/IBMdataset | Python_codes/p03439/s043931928.py | s043931928.py | py | 2,253 | python | en | code | 0 | github-code | 90 |
28771064220 | # Modified by Microsoft Corporation.
# Licensed under the MIT license.
'''
Specify what to run in `config/experiments.json`
Then run `python run_lab.py` or `yarn start`
'''
# from convlab.experiment import analysis, retro_analysis
# from convlab.experiment.monitor import InfoSpace
import os
import sys
import pydash a... | ConvLab/ConvLab | run.py | run.py | py | 3,743 | python | en | code | 398 | github-code | 90 |
33458069034 | from functools import cache
from unittest import TestCase
class Solution:
def integerBreak(self, n: int) -> int:
@cache
def dp(num: int) -> int:
if num <= 3:
return num
res = num
for i in range(2, num):
res = max(res, i * dp(num - i))
... | Samuel-Black/leetcode | integer-break.py | integer-break.py | py | 590 | python | en | code | 0 | github-code | 90 |
70255990697 | import unittest
from anova_testing.split_csvs import SplitCsvFiles
import pandas as pd
import os
class TestSplitCsv(unittest.TestCase):
def setUp(self) -> None:
self.split_csv = SplitCsvFiles(gene_ko_file='./mock_gene_KO.tsv',
mutation_file='./mock_mutation.tsv')
... | mobi98/anova_testing | anova_testing/__tests__/test_split_csv.py | test_split_csv.py | py | 1,433 | python | en | code | 0 | github-code | 90 |
23773531037 | import sys
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from werkzeug.urls import url_parse
from flask import Flask
class WSGIRequestHandler(BaseHTTPRequestHandler):
def make_environ(self):
request_url = url_parse(self.path)
if not request_url.scheme and req... | pginca/PGIWSGI | http_server.py | http_server.py | py | 3,062 | python | en | code | 0 | github-code | 90 |
26999564718 | import pandas as pd
import argparse
import logging
import os
import shutil
import yaml
import datetime
import time
import pickle
import requests
from bs4 import BeautifulSoup
#### Setting up argparse ####
parser = argparse.ArgumentParser()
parser.add_argument('-save_dir_name', type=str, help='the name of the director... | HrachYeghiazaryan/Book-Recommender-System | src/scraping.py | scraping.py | py | 2,973 | python | en | code | 0 | github-code | 90 |
40796012585 | import requests
import json
r = requests.get("https://thenetmonitor.org/v2/countries")
print ("successfully got response!")
#JSONify since the API call is super slow
r = r.json()
print("JSONING!!!")
print(r)
#save the data into a JSON file
with open('data.json', 'w') as outfile:
json.dump(r, outfile, ensure_ascii... | jazzminewang/internet_heatmap | data/get_data.py | get_data.py | py | 331 | python | en | code | 0 | github-code | 90 |
22207093078 | class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
result = "1"
for __ in range(1, n):
result = self.getNext(result)
return result
def getNext(self, s):
result = []
start = 0
while start ... | Eurus-Holmes/LCED | Count and Say.py | Count and Say.py | py | 564 | python | en | code | 11 | github-code | 90 |
40651129037 | import sys
def between(a,b):
nbX = []
if a < b:
for i in range(a,b):
nbX.append(i)
return nbX
else:
between(b,a)
if len(sys.argv) != 3 or not sys.argv[1].isnumeric() or not sys.argv[2].isnumeric():
print("error")
exit()
else:
[print(i, end=" ") for i in bet... | Grimmins/Eau | eau09.py | eau09.py | py | 377 | python | en | code | 0 | github-code | 90 |
32405254300 | import random
import numpy as np
import torch
import os
from collections import OrderedDict
from utils.f0_utils import get_cont_lf0, convert_continuous_f0
import resampy
from .audio_utils import MAX_WAV_VALUE, load_wav, mel_spectrogram, normalize
def read_fids(fid_list_f):
with open(fid_list_f, 'r') as f:
... | warisqr007/vc-spk-loss | src/data_load.py | data_load.py | py | 7,465 | python | en | code | 0 | github-code | 90 |
74382011815 | import sys, os;
def edit(full_name):
cmd = 'npp ' + full_name
import subprocess
PIPE = subprocess.PIPE
p = subprocess.Popen(cmd)
cwd = os.path.dirname(os.path.abspath(__file__))
c_template = cwd + r'\c_template.cpp'
desc_file = sys.argv[1]
desc_makro = sys.argv[2]
full_name = sys.argv[3]... | zv-proger/ol_programms | code_gen/codegen.py | codegen.py | py | 2,029 | python | en | code | 0 | github-code | 90 |
2454756641 | import spotipy
import json
from spotipy import oauth2
import operator
from pprint import pprint
from sklearn import preprocessing
import numpy as np
from mapreduce import mapreduce
import sqlite3
import copy
import sys
class kmeans(object):
def __init__(self, numClusters, numIterations):
'''
Create our number o... | petrosdawit/hip_hop_recommender | kmeans.py | kmeans.py | py | 4,997 | python | en | code | 0 | github-code | 90 |
72779965738 | """
User registration functions
Created by Hangyu Fan, May 6, 2018
Last modified: May 6, 2018
"""
import time
from django.contrib.auth import get_user_model
from base.exceptions import *
from base.util.phone_validator import phone_validator
from base.util.misc_validators import validators
from base.util.temp_session... | fhydralisk/walibackend | usersys/funcs/registration.py | registration.py | py | 5,071 | python | en | code | 1 | github-code | 90 |
8938452797 | from __future__ import absolute_import
import os
import re
from collections import OrderedDict
from functools import wraps
from urllib.parse import urljoin
import falcon
from falcon import HTTP_METHODS
import hug.api
import hug.interface
import hug.output_format
from hug import introspect
from hug.exceptions import ... | hugapi/hug | hug/routing.py | routing.py | py | 22,515 | python | en | code | 6,741 | github-code | 90 |
32919549862 | import sys
import os
D = {}
files = os.listdir('.')
for f in files:
if f[-6:]=='blated':
inFile = open(f)
for line in inFile:
line = line.strip()
fields = line.split()
D[fields[0]]=1
inFile.close()
print(len(D))
| wanghuanwei-gd/SIBS | RNAseqMSMS/2-sv/2-split-mapped/1-num-blated.py | 1-num-blated.py | py | 278 | python | en | code | 0 | github-code | 90 |
14502147602 | """Visualization helpers. Heavily influenced by `matterport/Mask_RCNN`
"""
import random
import torch
import numpy as np
import colorsys
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon, Rectangle
from skimage.measure import find_contours
plt.ion()
def display_images(images, cols=4, size=14, chan... | milani/science-bowl-2018 | visualization.py | visualization.py | py | 5,086 | python | en | code | 1 | github-code | 90 |
35934340539 | from PIL import Image
import glob
import sys
def adjust_pixel_values(pixels, x, y):
rgba_info = pixels[x, y]
r_channel = rgba_info[0]
g_channel = rgba_info[1]
b_channel = rgba_info[2]
if r_channel > g_channel and r_channel > b_channel:
pixels[x, y] = (255, 0, 0)
if g_channel > r_channe... | pedrovgs/DeepPanel | CheckSegmentationMasksQuality.py | CheckSegmentationMasksQuality.py | py | 1,886 | python | en | code | 103 | github-code | 90 |
12397615260 | import logging
import os
import socket
from logging.handlers import SysLogHandler
from inspect import getframeinfo, stack
EGRESS_LOG_MESSAGE_FORMAT = "[Egress] URL: {url:s} | Method: {method:s} | Status: {status_code:d} | Request Header: {request_header:s} | Request Body: {request_body:s} | Response Header: {response... | YansenChristian/automation | utilities/logger.py | logger.py | py | 2,972 | python | en | code | 0 | github-code | 90 |
18559283609 | n,k = map(int,input().split())
ans = 0
for i in range(k+1,n+1):
kosu = n // i
ans += kosu*(i-(k+1)+1)
if n % i == 0:
continue
if k == 0:
ans += max(0,n%i-k)
else:
ans += max(0,n%i-(k-1))
# print(i,ans)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03418/s484516392.py | s484516392.py | py | 266 | python | en | code | 0 | github-code | 90 |
17440160060 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# The GPU id to use, usually either "0" or "1"
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import tensorflow as tf
from tensorflow.keras import backend as kb
import tensorflow.keras, time, uuid, pickle,... | rist-ro/training-neural-connectivities | MaskTrainer.py | MaskTrainer.py | py | 19,094 | python | en | code | 3 | github-code | 90 |
22181185533 | from datetime import datetime
from cassandra.cluster import Cluster
import sys
import numpy as np
cluster = Cluster(['52.41.153.121'])
session = cluster.connect('fx')
#Creating the pivot points
file1 = sys.argv[1]
pattern = '%Y%m%d %H:%M:%S.%f'
list_of_vals = []
list_of_nums = []
list_of_prices_ = []
list_of_price... | yygrechka/insight-DE-project | data_munge/make_anchors.py | make_anchors.py | py | 1,650 | python | en | code | 1 | github-code | 90 |
31375132092 | import argparse
import logging
import toml
logger = logging.getLogger(__name__)
LOG_LEVELS = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']
LOG_FORMAT = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
LOG_DATE = '%m-%d %H:%M'
def parse_args(DESCRIPTION):
parser = argparse.ArgumentParser(
d... | rhafer/wamukap | wamukap/common/utils.py | utils.py | py | 3,290 | python | en | code | 0 | github-code | 90 |
11772120316 | import json
from django.db.models import ObjectDoesNotExist
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from app_utilities.models import Translation
from app_user.models import Address
from django.core import serializers
@csrf_exempt
def get_message(request):
"""
... | jmlm74/CheckListMgr | app_utilities/views.py | views.py | py | 1,571 | python | en | code | 0 | github-code | 90 |
41153935759 | from collections import deque
import copy
n, m = map(int, input().split())
datas = [list(map(int, input().split())) for _ in range(n)]
max_safety_area = 0
def proceed():
global max_safety_area
copy_datas = copy.deepcopy(datas)
visited = [[False] * m for _ in range(n)]
dx = [-1, 0, 1, 0]
dy = [0... | jhLim97/practice-coding-test | 백준/bj14502.py | bj14502.py | py | 1,268 | python | en | code | 0 | github-code | 90 |
70695856938 | vowels = ['a', 'e', 'i', 'o', 'u']
word = input ("Forneça uma palavra para buscar por vogais: ")
found = {}
for letter in word:
if letter in vowels:
# Inicializa o item do dicionário se for encontrado e elimina o erro: KeyError
found.setdefault(letter, 0)
# incrementa o item em 1
f... | Stiy27/headfirst | vowels6.py | vowels6.py | py | 429 | python | pt | code | 0 | github-code | 90 |
16947949241 | """
Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.
"""
class Solution:
def firstUniqChar(self, s: str) -> int:
hashset = {}
for i in range(len(s)):
if hashset.get(s[i]):
hashset[s[i]] += 1
els... | iamsuman/algorithms | iv/Leetcode/easy/387_first_unique_character_string.py | 387_first_unique_character_string.py | py | 562 | python | en | code | 2 | github-code | 90 |
12710542883 | from __future__ import print_function
import os
import sys
import numpy
import cdutil
import vcs
import cdms2
import genutil.statistics
from acme_diags.metrics import rmse, corr, min_cdms, max_cdms, mean
from acme_diags.driver.utils import get_output_dir, _chown
import acme_diags.plot.vcs as utils
textcombined_objs ... | CDAT/acme_diags | acme_diags/plot/vcs/polar_plot.py | polar_plot.py | py | 5,342 | python | en | code | null | github-code | 90 |
71794666537 | from urllib.request import build_opener,HTTPHandler,Request, ProxyHandler
#创建HTTPHanlder
http_handler = ProxyHandler({"http":"122.72.18.35:80"})
#没有设置代理
http_handler_none = ProxyHandler({})
#True使用代理,False不使用代理
proxy_swich = False
if proxy_swich:
# 自定义opener
opener = build_opener(http_handler)
else:
#没有设置代理,直接请求... | LIMr1209/Internet-worm | day02/teacher/06.免费代理.py | 06.免费代理.py | py | 906 | python | en | code | 0 | github-code | 90 |
4064966344 | # i=1;
#
# while i<=5:
# print('*' * i)
# i+=1
# print("Done")
guess_number=9
guess_count=0
guess_limit=3
print(f"Guess the correct value in {guess_limit} attempt")
while guess_count<guess_limit:
guess=int(input("Guess: "))
guess_count+=1
if guess == guess_number:
print("You won !!")
... | Vikas6206/PythonBasics | home/sample/beginner/WhileExample.py | WhileExample.py | py | 360 | python | en | code | 0 | github-code | 90 |
13808697880 | #!/usr/bin/env python3
import argparse
import base64
import http.client
import json
import subprocess
import time
import urllib.parse
import urllib.request
from pathlib import Path
from typing import Any
from .settings import Settings
def base64url(data: bytes) -> str:
return base64.urlsafe_b64encode(data).rstr... | NixOS/nixpkgs-merge-bot | nixpkgs_merge_bot/github.py | github.py | py | 6,236 | python | en | code | 13 | github-code | 90 |
15799346301 | from django.urls import path
from django.conf.urls import url
from .views import add_biodata, agency_cart, enquiry, maid_list, product, edit_biodata, delete_biodata, shortlist_enquiry
urlpatterns = [
path('', enquiry, name="enquiry"),
path('shortlist_enquiry', shortlist_enquiry, name="shortlist_enquiry"),
... | Code-Institute-Submissions/eileensiah-Project-4 | agency/urls.py | urls.py | py | 679 | python | en | code | 0 | github-code | 90 |
73404340135 | import math
import numpy as np
import random
import matplotlib.pyplot as plt
import pygame
'''
Mapping
1. Start with 10000 particles centered at starting location - particles have similar or identical x,y and pose
2. Robot Moves
3. Move particles per the probability of moving by a certain distance and t... | gilyaary/robot_planing | slam/gil_slam.py | gil_slam.py | py | 11,502 | python | en | code | 0 | github-code | 90 |
18410125799 | n = int(input())
S = [input() for _ in range(n)]
XA = 0
BA = 0
BX = 0
cnt = 0
for s in S:
cnt+=s.count('AB')
if s[0]!='B' and s[-1]=='A':
XA+=1
elif s[0]=='B' and s[-1]=='A':
BA+=1
elif s[0]=='B' and s[-1]!='A':
BX+=1
if BA==0:
cnt+=min(XA,BX)
else:
if XA+BX>0:
cn... | Aasthaengg/IBMdataset | Python_codes/p03049/s535046943.py | s535046943.py | py | 375 | python | en | code | 0 | github-code | 90 |
31504357006 | # -------------------------------------------------------------------------
# AUTHOR: Aditya Dhar
# FILENAME: knn.py
# SPECIFICATION: Uses knn algorithm to make predictions
# FOR: CS 4200- Assignment #2
# TIME SPENT: 45 minutes
# -----------------------------------------------------------*/
# IMPORTANT NOTE: D... | ProJedi1234/CS4200_Assignment_2 | knn.py | knn.py | py | 2,946 | python | en | code | 0 | github-code | 90 |
13915972235 | import logging
import os
from typing import Text, Optional, Union
import click
import json
import datasets
import transformers
from classification.sentence import SentenceClassifier
from classification.token import TokenClassifier
from utils.helpers import makerdir
from utils.model_selection import select_model_sugges... | heraclex12/octopus | run_cli.py | run_cli.py | py | 9,821 | python | en | code | 2 | github-code | 90 |
17991268589 | from math import ceil
def is_ok(m):
tmp = h[:]
for i in range(N):
tmp[i] -= m*B
flag = True
for i in tmp:
if i > 0:
flag = False
break
if flag:##全部0以下
return True
else:
rem = 0
for i in tmp:
if i > 0:
... | Aasthaengg/IBMdataset | Python_codes/p03700/s685444344.py | s685444344.py | py | 646 | python | en | code | 0 | github-code | 90 |
33579896599 | import random
import time
def roll_dice() -> None:
"""
Simulates the rolling of a dice.
Prompts the user to roll the dice or quit, and continues to roll the dice
until the user quits.
"""
DICE_SIDES = 6
while True:
roll_again = input("[r]oll or [q]uit: ").lower()
... | Danjamesd/Dice-Roller | main.py | main.py | py | 722 | python | en | code | 0 | github-code | 90 |
18446335889 | from collections import Counter
city = [list(map(int,input().split())) for _ in range(3)]
li = []
for i in range(3):
for j in range(2):
li.append(city[i][j])
c = Counter(li)
for i in range(1,5):
if c[i] >= 3:
print("NO")
exit()
print("YES") | Aasthaengg/IBMdataset | Python_codes/p03130/s441161554.py | s441161554.py | py | 294 | python | en | code | 0 | github-code | 90 |
25588630204 | import os
import sys
BANNED_FILENAMES = [
"BUILD.gn",
]
os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "../../.."))
bad = []
for filename in BANNED_FILENAMES:
if os.path.exists(filename):
bad.append(filename)
if bad:
for file in bad:
print("%s should not exist" % file)
sys.exit(... | grpc/grpc | tools/run_tests/sanity/check_banned_filenames.py | check_banned_filenames.py | py | 323 | python | en | code | 39,468 | github-code | 90 |
74762920936 | # $begin adfun.py$$ $newlinech #$$
# $spell
# adfun
# $$
#
# $section adfun: Example and Test$$
#
# $index adfun, example$$
# $index example, adfun$$
#
# $code
# $verbatim%example/adfun.py%0%# BEGIN CODE%# END CODE%1%$$
# $$
# $end
# BEGIN CODE
from pycppad import *
def pycppad_test_adfun() :
# record operations at x... | b45ch1/pycppad | example/adfun.py | adfun.py | py | 851 | python | en | code | 19 | github-code | 90 |
1563758540 | # make the mask for cms
# first load the data for cms
# now making the CMS mask
import os
import numpy as np
from matplotlib.pyplot import ion, figure, clf, clim, imshow, pause, plot
from SciStreams.interfaces.databroker.databases import databases
from SciStreams.config import config
from SciStreams.tools.MaskCreat... | CFN-softbio/SciStreams | SciStreams/examples/mask_creation.py | mask_creation.py | py | 6,031 | python | en | code | 0 | github-code | 90 |
37487379681 | import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import pandas as pd
import os
import sys
import time
import tensorflow as tf
from tensorflow.python import keras
print(tf.__version__)
print(sys.version_info)
for module in mpl, np, pd, sklearn, tf, keras:
print(module.__na... | Freshield/LEARN_Tensorflow2 | muke_class/chp3/a4_tf_function_and_auto_graph.py | a4_tf_function_and_auto_graph.py | py | 2,255 | python | en | code | 0 | github-code | 90 |
18309759209 | #!/usr/bin/env python3
def main():
N = int(input())
S = input()
seen = set()
ans = 0
for i in range(N - 2):
if S[i] in seen:
continue
seen.add(S[i])
for j in range(i + 1, N - 1):
if S[i] + S[j] in seen:
continue
seen.add(S[... | Aasthaengg/IBMdataset | Python_codes/p02844/s328345234.py | s328345234.py | py | 570 | python | en | code | 0 | github-code | 90 |
23420476755 | from pysagepay.request import Request
from pysagepay.response import Response, FakeResponse
from pysagepay.utils import encode_transaction_request
from unittest import TestCase
from nose.tools import *
import mock
class TestRequest(TestCase):
def test_set_url(self):
request = Request()
url = 'https... | RossLote/sagepy | tests/test_request.py | test_request.py | py | 1,063 | python | en | code | 0 | github-code | 90 |
37272193136 | import time
import re
from pymysql import *
STASUS_ROOT = "./templates"
url = dict()
def route(temp):
def set_func(func):
# 添加文件对应的函数名到字典
url[temp] = func
def call_func(file_name):
return func(file_name)
return call_func
return set_func
@route(r"/index\.html$")... | chen849157649/mini_web | mini-web/dynamic/mini-frame.py | mini-frame.py | py | 4,185 | python | en | code | 0 | github-code | 90 |
3416469142 | import unittest
from selenium import webdriver
PATH = "C:\chromedriver.exe"
driver = webdriver.Chrome(PATH)
class TestOP(unittest.TestCase):
def test_OpenBar_PositiveT_Smoketest(self):
driver.get("file:///C:/Users/Niki/Documents/GitHub/JavaScript/navmenu/index.html")
self.assertEqual(driver.find_... | nikiyyy/JavaScript | navmenu/Unittests.py | Unittests.py | py | 767 | python | en | code | 0 | github-code | 90 |
30554289357 | def solution(n):
startN = 1
tryCount = 1
answer = 0
while startN >= 1:
startN = tryGetStartInt(n, tryCount)
#정수이면
if startN >= 1 and int(startN) == startN:
answer += 1
tryCount += 1
return answer
# 정수로 나누어떨어지는지 확인
def tryGetStartInt(n, count):
... | nagneo/programmers | numberDivision/solution.py | solution.py | py | 416 | python | en | code | 0 | github-code | 90 |
12607725855 | from collections import Counter
def number_sequence():
numbers_list = [1, 5, 6, 3, 2, 1, 5, 6, 7]
# list of numbers
counter = Counter(numbers_list)
# Uses an in built module to count through each item in the list and see if they are the same
print(counter)
# prints the list of each number and ... | jessebridge/CP2410pracs | week1/number_sequence.py | number_sequence.py | py | 657 | python | en | code | 0 | github-code | 90 |
21312186415 | import random
# Создание узла дерево
def make_node(key):
if key is not None:
size = 1
else:
size = 0
return [key, None, None, size, 1] # [0-key, 1-left, 2-brother, 3-size, 4-high]
# Получение размера узла с учетом поддеревьев
def get_size(node):
if node is None:
... | GavrilovaAnna/Labs | lab4trees.py | lab4trees.py | py | 8,677 | python | en | code | 0 | github-code | 90 |
72587043176 | import os
from torch.utils.data import Dataset
import cv2
class MedicalDataSets(Dataset):
def __init__(
self,
base_dir=None,
split="train",
transform=None,
train_file_dir="train.txt",
val_file_dir="val.txt",
):
self._base_dir = ba... | FengheTan9/Medical-Image-Segmentation-Benchmarks | src/dataloader/dataset.py | dataset.py | py | 1,809 | python | en | code | 36 | github-code | 90 |
33874438068 | from nodes import Node
class Stack():
def __init__(self):
self.__bottom = None
self.__top = None
self.__size = 0
def push(self, element):
node = Node(element)
if self.__is_empty():
self.__bottom = node
self.__top = node
else:
self.__top.next = node
... | m-fidalgo/data-structures | 04-stacks/stacks.py | stacks.py | py | 1,072 | python | en | code | 0 | github-code | 90 |
21698368191 | # demo1.py :演示OCR基础功能
# demo2.py :演示可视化接口
# 👉 demo3.py :演示OCR文段后处理(段落合并)接口
from PPOCR_api import PPOCR
from PPOCR_visualize import visualize # 可视化
import tbpu
# 初始化识别器对象,传入 PaddleOCR_json.exe 的路径
ocr = PPOCR(r'…………\PaddleOCR_json.exe')
print(f'初始化OCR成功,进程号为{ocr.ret.pid}')
testImg = r'………\测试.png'
# OCR识别图片,获... | huyuejingling/PaddleOCR-json | api/python/demo3.py | demo3.py | py | 1,230 | python | zh | code | null | github-code | 90 |
22033289332 | A = "A"
B = "B"
C = "C"
D = "D"
state = {}
action = None
model = {A: None, B: None, C: None, D: None}
RULE_ACTION = {
1: "Suck",
2: "Right",
3: "Left",
4: "Down",
5: "Up",
6: "NoOp"
}
rules = {
(A, "Dirty"): 1,
(B, "Dirty"): 1,
(C, "Dirty"): 1,
(D, "Dirty"): 1,
(A, "Clean")... | Rasje17/4SemExer | Alexander/Artificial intelligence/Agents/REFLEX_AGENT_WITH_STATE.py | REFLEX_AGENT_WITH_STATE.py | py | 2,050 | python | en | code | 0 | github-code | 90 |
18998867111 | # testing using the pytest library and pytest-benchmark
from particle_simulator import Particle, ParticleSimulator
def test_evolve(benchmark):
particles = [
Particle(0.3, 0.5, +1),
Particle(0.0, -0.5, -1),
Particle(-0.1, -0.4, +3)
]
simulator = ParticleSimulator(particles)
... | Bohdan-at-Kulinich/advanced_py | test_simulator.py | test_simulator.py | py | 754 | python | en | code | 0 | github-code | 90 |
40171722688 | result1=0
result2=0
def add1(num):
global result1
result1 += num
return result1
def add2(num):
global result2
result2 += num
return result2
print(add1(3))
print(add1(4))
print(add2(3))
print(add2(7))
class Calculator:
def __init__(self):
self.result=0
d... | ubin7810/test | 201114.py | 201114.py | py | 1,158 | python | en | code | 0 | github-code | 90 |
70904621097 | import sys
input = sys.stdin.readline
def solution(n): # bottom-up
dp = [0] * (n + 1)
dp[:4] = [0, 1, 2, 4]
if n > 3:
for i in range(4, n + 1):
dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3] # i-1번쨰에서 '+1', i-2번째에서 '+2', i-3번째에서 '+3'
return dp[n]
t = int(input())
for _ in range(t):
... | dohun31/algorithm | 2021/week_07/210816/9095.py | 9095.py | py | 384 | python | en | code | 1 | github-code | 90 |
18270988239 | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
def main():
N = [0] + list(map(int, tuple(input().rstrip("\n"))))
Ncopy = N.copy()
ans = 0
flag = False
for i in range(len(N)-1, 0, -1):
if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i-1] <= 4):
ans += Ncopy[i]
... | Aasthaengg/IBMdataset | Python_codes/p02775/s168363148.py | s168363148.py | py | 630 | python | en | code | 0 | github-code | 90 |
9299224763 | entries = []
with open('phoneData.txt') as data:
for line in data:
items = line.split('\t')
name = items[0] + ', ' + items[1]
area = items[2][:3]
number = items[2][4:-1]
entries.append([name, area, number])
entries.sort()
for entry in entries:
print('{0:24s}... | RafaelGarcia21/Python-Practice | 7/7.5.py | 7.5.py | py | 370 | python | en | code | 1 | github-code | 90 |
17951217099 | from functools import wraps
class FlaskDt():
def __init__(self, db):
self.db = db
def display_table(self, func):
@wraps(func)
def get_table(tablename, *args, **kwargs):
"""This function queries all data of a given table given the tablename
:param tabl... | GreatDt1/flaskdt | src/flask_dt.py | flask_dt.py | py | 1,367 | python | en | code | 1 | github-code | 90 |
71509256617 |
from . import index_blu
from flask import render_template
from flask import current_app
from flask import session
from ... import constants
from ...models import User, News, Category
from flask import request
from flask import jsonify
from ...utils.response_code import RET
@index_blu.route('/')
def index():
#... | liudiyilalala/Xinjing-information-network | info/modules/index/views.py | views.py | py | 3,951 | python | zh | code | 0 | github-code | 90 |
18353797043 | import json
import logging
from django.conf import settings
from django.utils.encoding import filepath_to_uri
from rest_framework import viewsets
from rest_framework.serializers import HyperlinkedModelSerializer, \
ReadOnlyField, Serializer
from rest_framework.authentication import SessionAuthentication, BasicAut... | praekelt/jmbo | jmbo/api/__init__.py | __init__.py | py | 5,055 | python | en | code | 13 | github-code | 90 |
40886625156 | ### Programacion de Computadoras IV
## Taller 8
# Braulio Rodriguez 8-899-1093
from flask import Flask
from flask_mail import Mail, Message
from threading import Thread
app = Flask(__name__)
app.config['MAIL_SERVER'] = 'localhost'
app.config['MAIL_PORT'] = 25
app.config['MAIL_USERNAME'] = 'user@gmail.c... | BraulioRodriguez/PROGIV-Taller8 | Taller8.py | Taller8.py | py | 1,443 | python | en | code | 0 | github-code | 90 |
1975218405 | # Enter your code here. Read input from STDIN. Print output to STDOUT
'''
Sample Input
5
1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2
Sample Output
8
'''
K = int(input())
ele_group = list(map(int, input().split()))
d = dict()
for a in set(ele_group):
d.setdefault(a, 0)
for x in ele_group:
d[x]... | thirawarit/HackerRank-Challenge | The-captain-room.py | The-captain-room.py | py | 736 | python | en | code | 2 | github-code | 90 |
27903356374 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch
import gym
from agents.reinforce_agent import ReinforceAgent
from utils.network_architectures import Actor, ActorWithoutBaseline, ActorWithSharedLayers
from utils.wrappers import make_cartpole_swing_up
import matplotlib.pyplot as plt
device = torch.devic... | maxencefaldor/policy-gradient | main.py | main.py | py | 1,768 | python | en | code | 1 | github-code | 90 |
18412751162 | import random
start = input('Please enter start random number: ')
end = input('Please enter end random number: ')
start = int(start)
end = int(end)
r = random.randint(start, end)
count = 0
while True:
count += 1 #count = count + 1
num = input('Please input number: ')
num = int(num)
if num == r:
print('Success')
... | wjrflaehd/number | number.py | number.py | py | 472 | python | en | code | 0 | github-code | 90 |
18020912389 | def DFS(num):
global ans,color
color[num]="black"
if "white" not in color[1:]:
ans +=1
for i in MAP[num]:
if color[i]=="white":
DFS(i)
color[num]="white"
n,m=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(m)]
MAP=[[] for _ in range(n+1)]
for... | Aasthaengg/IBMdataset | Python_codes/p03805/s470313009.py | s470313009.py | py | 434 | python | en | code | 0 | github-code | 90 |
13266361442 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# for i in range(100, 1000):
# bai = i // 100
# shi = (i // 10) % 10
# ge = i % 10
# if bai ** 3 + shi **3 +ge ** 3 == i:
# print(i)
def shuixianhua(m, n):
for i in range(m, n):
bai = i // 100
shi = (i // 10) % 10
ge = i... | feiyu7348/python-Learning | 算法/水仙花数.py | 水仙花数.py | py | 444 | python | en | code | 0 | github-code | 90 |
16945444932 | # nyt_queries.py
# -*- coding: utf-8 -*-
# @Author: Sidharth Mishra
# @Date: 2017-03-15 12:36:16
# @Last Modified by: Sidharth Mishra
# @Last Modified time: 2017-05-06 14:38:40
'''
This script contains the demo for using PyMongo and connecting to mongodb database and queries
for the usecases.
'''
# python standa... | sidmishraw/nosql_boa_nyt_archiver | nyt_queries.py | nyt_queries.py | py | 36,547 | python | en | code | 0 | github-code | 90 |
17987389609 | import sys
# sys.setrecursionlimit(100000)
from collections import defaultdict
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
def main():
n = input_int()
A = input_int_list()
cnt = defa... | Aasthaengg/IBMdataset | Python_codes/p03695/s934846436.py | s934846436.py | py | 830 | python | en | code | 0 | github-code | 90 |
29006969073 | import cvxpy as cvx
import numpy as np
import cvxpy.settings as s
from cvxpy.tests.base_test import BaseTest
from cvxpy.reductions.solvers.defines \
import INSTALLED_SOLVERS
MIP_SOLVERS = [cvx.ECOS_BB, cvx.GUROBI, cvx.MOSEK]
class TestMIPVariable(BaseTest):
""" Unit tests for the expressions/shape module. ""... | johnjaniczek/SFCLS | venv/lib/python3.5/site-packages/cvxpy/tests/test_mip_vars.py | test_mip_vars.py | py | 4,395 | python | en | code | 12 | github-code | 90 |
30148564793 | from api import db
from api.model.database.privileges import Privilegio
from api.service.metadata import CreateMetadata
from api.util.errors import BadFormatError, ForbiddenError
ADMINISTRADOR = 1
MODERADOR = 2
USUARIO_COMUM = 3
def All():
privileges = Privilegio.query.all()
return [privilege.serialize() fo... | UnifespCodeLab/plasmedis-api | api/service/privileges.py | privileges.py | py | 879 | 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.